Skip to content

Commit 594c16a

Browse files
committed
Move Apache 2.2 access parameter tests around
The previous location was testing it on a vhost that's absent. This is now testing it on the very complex test where it's present. This is important because in the future the whole directories concat fragment isn't rendered on absent vhosts.
1 parent ee2e723 commit 594c16a

File tree

1 file changed

+33
-34
lines changed

1 file changed

+33
-34
lines changed

spec/defines/vhost_spec.rb

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,20 @@
171171
'set_output_filter' => 'output_filter' },
172172
{ 'path' => '/var/www/files/input_filtered',
173173
'set_input_filter' => 'input_filter' },
174+
{
175+
'path' => '/var/www/foo',
176+
'provider' => 'files',
177+
'allow' => 'from 127.0.0.5',
178+
'deny' => 'from all',
179+
'order' => 'deny,allow',
180+
},
181+
{
182+
'path' => '/var/www/protected-files',
183+
'provider' => 'files',
184+
'allow' => ['from 127.0.0.1', 'from 127.0.0.2'],
185+
'deny' => ['from 127.0.0.3', 'from 127.0.0.4'],
186+
'satisfy' => 'any',
187+
},
174188
{ 'path' => '/var/www/files',
175189
'provider' => 'location',
176190
'limit' => [
@@ -617,6 +631,7 @@
617631
}
618632
it { is_expected.to contain_concat__fragment('rspec.example.com-itk') }
619633
it { is_expected.to contain_concat__fragment('rspec.example.com-fallbackresource') }
634+
620635
it {
621636
is_expected.to contain_concat__fragment('rspec.example.com-directories')
622637
.with_content(%r{^\s+<Proxy "\*">$})
@@ -726,6 +741,24 @@
726741
.with_content(%r{^\s+SSLVerifyClient\soptional$})
727742
.with_content(%r{^\s+SSLVerifyDepth\s10$})
728743
}
744+
# the following style is only present on Apache 2.2
745+
# That is used in SLES 11, RHEL6, Amazon Linux
746+
if (facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'].to_i < 7) ||
747+
(facts[:os]['name'] == 'Amazon') ||
748+
(facts[:os]['name'] == 'SLES' && facts[:os]['release']['major'].to_i < 12)
749+
it {
750+
is_expected.to contain_concat__fragment('rspec.example.com-directories')
751+
.with_content(%r{^\s+Allow from 127\.0\.0\.1$})
752+
.with_content(%r{^\s+Allow from 127\.0\.0\.2$})
753+
.with_content(%r{^\s+Allow from 127\.0\.0\.5$})
754+
.with_content(%r{^\s+Deny from 127\.0\.0\.3$})
755+
.with_content(%r{^\s+Deny from 127\.0\.0\.4$})
756+
.with_content(%r{^\s+Deny from all$})
757+
.with_content(%r{^\s+Satisfy any$})
758+
.with_content(%r{^\s+Order deny,allow$})
759+
}
760+
end
761+
729762
it { is_expected.to contain_concat__fragment('rspec.example.com-additional_includes') }
730763
it {
731764
is_expected.to contain_concat__fragment('rspec.example.com-logging')
@@ -1269,23 +1302,6 @@
12691302
'manage_docroot' => true,
12701303
'logroot' => '/tmp/logroot',
12711304
'logroot_ensure' => 'absent',
1272-
'directories' => [
1273-
{
1274-
'path' => '/var/www/files',
1275-
'provider' => 'files',
1276-
'allow' => ['from 127.0.0.1', 'from 127.0.0.2'],
1277-
'deny' => ['from 127.0.0.3', 'from 127.0.0.4'],
1278-
'satisfy' => 'any',
1279-
},
1280-
{
1281-
'path' => '/var/www/foo',
1282-
'provider' => 'files',
1283-
'allow' => 'from 127.0.0.5',
1284-
'deny' => 'from all',
1285-
'order' => 'deny,allow',
1286-
},
1287-
],
1288-
12891305
}
12901306
end
12911307

@@ -1318,23 +1334,6 @@
13181334
it { is_expected.not_to contain_concat__fragment('rspec.example.com-itk') }
13191335
it { is_expected.not_to contain_concat__fragment('rspec.example.com-fallbackresource') }
13201336
it { is_expected.to contain_concat__fragment('rspec.example.com-directories') }
1321-
# the following style is only present on Apache 2.2
1322-
# That is used in SLES 11, RHEL6, Amazon Linux
1323-
if (facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'].to_i < 7) ||
1324-
(facts[:os]['name'] == 'Amazon') ||
1325-
(facts[:os]['name'] == 'SLES' && facts[:os]['release']['major'].to_i < 12)
1326-
it {
1327-
is_expected.to contain_concat__fragment('rspec.example.com-directories')
1328-
.with_content(%r{^\s+Allow from 127\.0\.0\.1$})
1329-
.with_content(%r{^\s+Allow from 127\.0\.0\.2$})
1330-
.with_content(%r{^\s+Allow from 127\.0\.0\.5$})
1331-
.with_content(%r{^\s+Deny from 127\.0\.0\.3$})
1332-
.with_content(%r{^\s+Deny from 127\.0\.0\.4$})
1333-
.with_content(%r{^\s+Deny from all$})
1334-
.with_content(%r{^\s+Satisfy any$})
1335-
.with_content(%r{^\s+Order deny,allow$})
1336-
}
1337-
end
13381337
it { is_expected.not_to contain_concat__fragment('rspec.example.com-additional_includes') }
13391338
it { is_expected.to contain_concat__fragment('rspec.example.com-logging') }
13401339
it { is_expected.to contain_concat__fragment('rspec.example.com-serversignature') }

0 commit comments

Comments
 (0)