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
43
44
45
46
47
48
49
50
51
52
53
|
require 'spec_helper'
describe 'haproxy::listen' do
let(:title) { 'tyler' }
let(:facts) {{ :ipaddress => '1.1.1.1' }}
context "when only one port is provided" do
let(:params) do
{
:name => 'croy',
:ports => '18140'
}
end
it { should contain_concat__fragment('croy_listen_block').with(
'order' => '20-croy-00',
'target' => '/etc/haproxy/haproxy.cfg',
'content' => "listen croy\n\n bind 1.1.1.1:18140\n\n balance roundrobin\n option tcplog\n option ssl-hello-chk\n"
) }
end
context "when an array of ports is provided" do
let(:params) do
{
:name => 'apache',
:ipaddress => '23.23.23.23',
:ports => [
'80',
'443',
]
}
end
it { should contain_concat__fragment('apache_listen_block').with(
'order' => '20-apache-00',
'target' => '/etc/haproxy/haproxy.cfg',
'content' => "listen apache\n\n bind 23.23.23.23:80\n\n bind 23.23.23.23:443\n\n balance roundrobin\n option tcplog\n option ssl-hello-chk\n"
) }
end
context "when a comma-separated list of ports is provided" do
let(:params) do
{
:name => 'apache',
:ipaddress => '23.23.23.23',
:ports => '80,443'
}
end
it { should contain_concat__fragment('apache_listen_block').with(
'order' => '20-apache-00',
'target' => '/etc/haproxy/haproxy.cfg',
'content' => "listen apache\n\n bind 23.23.23.23:80\n\n bind 23.23.23.23:443\n\n balance roundrobin\n option tcplog\n option ssl-hello-chk\n"
) }
end
end
|