summaryrefslogtreecommitdiff
path: root/spec/defines/balancermember_spec.rb
blob: 4566ca490669d33712acde3a11b4d5fd9ff19462 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
require 'spec_helper'

describe 'haproxy::balancermember' do
  let(:title) { 'tyler' }
  let(:facts) do
    { :ipaddress => '1.1.1.1',
      :hostname  => 'dero'
    }
  end

  context 'with a single balancermember option' do
    let(:params) do
      { :name                   => 'tyler',
        :listening_service      => 'croy',
        :balancer_port          => '18140',
        :balancermember_options => 'check'
      }
    end

    it { should contain_concat__fragment('croy_balancermember_tyler').with(
      'order'   => '20',
      'target'  => '/etc/haproxy/haproxy.cfg',
      'content' => "  server  dero 1.1.1.1:18140  check\n"
      ) }
  end

  context 'with multiple balancermember options' do
    let(:params) do
      { :name                   => 'tyler',
        :listening_service      => 'croy',
        :balancer_port          => '18140',
        :balancermember_options => ['check', 'close']
      }
    end

    it { should contain_concat__fragment('croy_balancermember_tyler').with(
      'order'   => '20',
      'target'  => '/etc/haproxy/haproxy.cfg',
      'content' => "  server  dero 1.1.1.1:18140  check close\n"
      ) }
  end
end