@@ -29,12 +29,10 @@ class { 'haproxy':
29
29
end
30
30
end
31
31
32
- describe port ( '9090' ) do
33
- it { is_expected . not_to be_listening }
34
- end
35
-
36
- describe port ( '9091' ) do
37
- it { is_expected . not_to be_listening }
32
+ [ '9090' , '9091' ] . each do |port |
33
+ describe port ( port ) do
34
+ it { is_expected . not_to be_listening }
35
+ end
38
36
end
39
37
end
40
38
@@ -93,43 +91,43 @@ class { 'haproxy': }
93
91
end
94
92
end
95
93
end
94
+ end
96
95
97
- context 'when "httpchk" option is defined and $sort_options_aphabetic => true' do
98
- pp_httpchk_option = <<-PUPPETCODE
99
- class { 'haproxy::globals':
100
- sort_options_alphabetic => true,
101
- }
102
- class { 'haproxy': }
103
- haproxy::listen { 'stats':
104
- ipaddress => '127.0.0.1',
105
- ports => ['9091'],
106
- mode => 'http',
107
- }
108
- haproxy::backend { 'servers':
109
- mode => 'http',
110
- sort_options_alphabetic => true,
111
- options => {
112
- 'option' => [
113
- 'httpchk',
114
- ],
115
- 'http-check' => 'disable-on-404',
116
- 'server' => [
117
- 'srv1 127.0.0.1:9091 check',
118
- ],
119
- },
120
- }
121
- PUPPETCODE
96
+ describe 'when "httpchk" option is defined and $sort_options_aphabetic => true' do
97
+ pp_httpchk_option = <<-PUPPETCODE
98
+ class { 'haproxy::globals':
99
+ sort_options_alphabetic => true,
100
+ }
101
+ class { 'haproxy': }
102
+ haproxy::listen { 'stats':
103
+ ipaddress => '127.0.0.1',
104
+ ports => ['9091'],
105
+ mode => 'http',
106
+ }
107
+ haproxy::backend { 'servers':
108
+ mode => 'http',
109
+ sort_options_alphabetic => true,
110
+ options => {
111
+ 'option' => [
112
+ 'httpchk',
113
+ ],
114
+ 'http-check' => 'disable-on-404',
115
+ 'server' => [
116
+ 'srv1 127.0.0.1:9091 check',
117
+ ],
118
+ },
119
+ }
120
+ PUPPETCODE
122
121
123
- it 'overrides $sort_options_aphabetic to false and warn' do
124
- apply_manifest ( pp_httpchk_option , catch_failures : true ) do |r |
125
- expect ( r . stderr ) . to contain %r{Overriding\s the\s value\s of\s \$ sort_options_alphabetic\s to\s "false"\s due\s to\s "httpchk"\s option\s defined}
126
- end
122
+ it 'overrides $sort_options_aphabetic to false and warn' do
123
+ apply_manifest ( pp_httpchk_option , catch_failures : true ) do |r |
124
+ expect ( r . stderr ) . to contain %r{Overriding\s the\s value\s of\s \$ sort_options_alphabetic\s to\s "false"\s due\s to\s "httpchk"\s option\s defined}
127
125
end
126
+ end
128
127
129
- describe file ( '/etc/haproxy/haproxy.cfg' ) do
130
- its ( :content ) do
131
- is_expected . to match %r{backend\s servers\n \s +mode\s http\n \s +option\s httpchk\n \s +http-check\s +disable-on-404}
132
- end
128
+ describe file ( '/etc/haproxy/haproxy.cfg' ) do # rubocop:disable RSpec/NestedGroups
129
+ its ( :content ) do
130
+ is_expected . to match %r{backend\s servers\n \s +mode\s http\n \s +option\s httpchk\n \s +http-check\s +disable-on-404}
133
131
end
134
132
end
135
133
end
0 commit comments