|
47 | 47 | .with(content: %r{CacheEnable disk \/\nCacheRoot \"\/var\/cache\/apache2\/mod_cache_disk\"\nCacheDirLevels 2\nCacheDirLength 1\nCacheIgnoreHeaders Set-Cookie}) |
48 | 48 | } |
49 | 49 | end |
| 50 | + context 'with $default_cache_enable = false' do |
| 51 | + let :pre_condition do |
| 52 | + 'class{ "apache": |
| 53 | + apache_version => "2.4", |
| 54 | + default_mods => ["cache"], |
| 55 | + mod_dir => "/tmp/junk", |
| 56 | + }' |
| 57 | + end |
| 58 | + |
| 59 | + let(:params) { { 'default_cache_enable' => false } } |
| 60 | + |
| 61 | + it { is_expected.to compile } |
| 62 | + it { is_expected.to contain_class('apache::mod::disk_cache') } |
| 63 | + it { is_expected.to contain_class('apache::mod::cache').that_comes_before('Class[Apache::Mod::Disk_cache]') } |
| 64 | + it { is_expected.to contain_apache_mod('cache_disk') } |
| 65 | + it { |
| 66 | + is_expected.to contain_file('disk_cache.conf') |
| 67 | + .with(content: %r{CacheRoot \"\/var\/cache\/apache2\/mod_cache_disk\"\nCacheDirLevels 2\nCacheDirLength 1\nCacheIgnoreHeaders Set-Cookie}) |
| 68 | + } |
| 69 | + end |
| 70 | + context 'with $default_cache_enable = true' do |
| 71 | + let :pre_condition do |
| 72 | + 'class{ "apache": |
| 73 | + apache_version => "2.4", |
| 74 | + default_mods => ["cache"], |
| 75 | + mod_dir => "/tmp/junk", |
| 76 | + }' |
| 77 | + end |
| 78 | + |
| 79 | + let(:params) { { 'default_cache_enable' => true } } |
| 80 | + |
| 81 | + it { is_expected.to compile } |
| 82 | + it { is_expected.to contain_class('apache::mod::disk_cache') } |
| 83 | + it { is_expected.to contain_class('apache::mod::cache').that_comes_before('Class[Apache::Mod::Disk_cache]') } |
| 84 | + it { is_expected.to contain_apache_mod('cache_disk') } |
| 85 | + it { |
| 86 | + is_expected.to contain_file('disk_cache.conf') |
| 87 | + .with(content: %r{CacheEnable disk \/\nCacheRoot \"\/var\/cache\/apache2\/mod_cache_disk\"\nCacheDirLevels 2\nCacheDirLength 1\nCacheIgnoreHeaders Set-Cookie}) |
| 88 | + } |
| 89 | + end |
| 90 | + context 'with $default_cache_enable = foo' do |
| 91 | + let :pre_condition do |
| 92 | + 'class{ "apache": |
| 93 | + apache_version => "2.4", |
| 94 | + default_mods => ["cache"], |
| 95 | + mod_dir => "/tmp/junk", |
| 96 | + }' |
| 97 | + end |
| 98 | + |
| 99 | + let(:params) { { 'default_cache_enable' => 'foo' } } |
| 100 | + |
| 101 | + it { is_expected.to compile } |
| 102 | + it { is_expected.to contain_class('apache::mod::disk_cache') } |
| 103 | + it { is_expected.to contain_class('apache::mod::cache').that_comes_before('Class[Apache::Mod::Disk_cache]') } |
| 104 | + it { is_expected.to contain_apache_mod('cache_disk') } |
| 105 | + it { |
| 106 | + is_expected.to contain_file('disk_cache.conf') |
| 107 | + .with(content: %r{CacheEnable disk \/\nCacheRoot \"\/var\/cache\/apache2\/mod_cache_disk\"\nCacheDirLevels 2\nCacheDirLength 1\nCacheIgnoreHeaders Set-Cookie}) |
| 108 | + }.to raise_error(Puppet::Error, 'default_cache_enable must be true or false') |
| 109 | + end |
50 | 110 | end |
51 | 111 |
|
52 | 112 | context 'on a RedHat 6-based OS' do |
|
88 | 148 | .with(content: %r{CacheEnable disk \/\nCacheRoot \"\/var\/cache\/httpd\/proxy\"\nCacheDirLevels 2\nCacheDirLength 1\nCacheIgnoreHeaders Set-Cookie}) |
89 | 149 | } |
90 | 150 | end |
| 151 | + context 'with $default_cache_enable = false' do |
| 152 | + let :pre_condition do |
| 153 | + 'class{ "apache": |
| 154 | + apache_version => "2.4", |
| 155 | + default_mods => ["cache"], |
| 156 | + mod_dir => "/tmp/junk", |
| 157 | + }' |
| 158 | + end |
| 159 | + |
| 160 | + let(:params) { { 'default_cache_enable' => false } } |
| 161 | + |
| 162 | + it { is_expected.to compile } |
| 163 | + it { is_expected.to contain_class('apache::mod::disk_cache') } |
| 164 | + it { is_expected.to contain_class('apache::mod::cache').that_comes_before('Class[Apache::Mod::Disk_cache]') } |
| 165 | + it { is_expected.to contain_apache_mod('cache_disk') } |
| 166 | + it { |
| 167 | + is_expected.to contain_file('disk_cache.conf') |
| 168 | + .with(content: %r{CacheRoot \"\/var\/cache\/apache2\/mod_cache_disk\"\nCacheDirLevels 2\nCacheDirLength 1\nCacheIgnoreHeaders Set-Cookie}) |
| 169 | + } |
| 170 | + end |
| 171 | + context 'with $default_cache_enable = true' do |
| 172 | + let :pre_condition do |
| 173 | + 'class{ "apache": |
| 174 | + apache_version => "2.4", |
| 175 | + default_mods => ["cache"], |
| 176 | + mod_dir => "/tmp/junk", |
| 177 | + }' |
| 178 | + end |
| 179 | + |
| 180 | + let(:params) { { 'default_cache_enable' => true } } |
| 181 | + |
| 182 | + it { is_expected.to compile } |
| 183 | + it { is_expected.to contain_class('apache::mod::disk_cache') } |
| 184 | + it { is_expected.to contain_class('apache::mod::cache').that_comes_before('Class[Apache::Mod::Disk_cache]') } |
| 185 | + it { is_expected.to contain_apache_mod('cache_disk') } |
| 186 | + it { |
| 187 | + is_expected.to contain_file('disk_cache.conf') |
| 188 | + .with(content: %r{CacheEnable disk \/\nCacheRoot \"\/var\/cache\/apache2\/mod_cache_disk\"\nCacheDirLevels 2\nCacheDirLength 1\nCacheIgnoreHeaders Set-Cookie}) |
| 189 | + } |
| 190 | + end |
| 191 | + context 'with $default_cache_enable = foo' do |
| 192 | + let :pre_condition do |
| 193 | + 'class{ "apache": |
| 194 | + apache_version => "2.4", |
| 195 | + default_mods => ["cache"], |
| 196 | + mod_dir => "/tmp/junk", |
| 197 | + }' |
| 198 | + end |
| 199 | + |
| 200 | + let(:params) { { 'default_cache_enable' => 'foo' } } |
| 201 | + |
| 202 | + it { is_expected.to compile } |
| 203 | + it { is_expected.to contain_class('apache::mod::disk_cache') } |
| 204 | + it { is_expected.to contain_class('apache::mod::cache').that_comes_before('Class[Apache::Mod::Disk_cache]') } |
| 205 | + it { is_expected.to contain_apache_mod('cache_disk') } |
| 206 | + it { |
| 207 | + is_expected.to contain_file('disk_cache.conf') |
| 208 | + .with(content: %r{CacheEnable disk \/\nCacheRoot \"\/var\/cache\/apache2\/mod_cache_disk\"\nCacheDirLevels 2\nCacheDirLength 1\nCacheIgnoreHeaders Set-Cookie}) |
| 209 | + }.to raise_error(Puppet::Error, 'default_cache_enable must be true or false') |
| 210 | + end |
91 | 211 | end |
92 | 212 | context 'on a FreeBSD OS' do |
93 | 213 | include_examples 'FreeBSD 10' |
|
134 | 254 | .with(content: %r{CacheEnable disk \/\nCacheRoot \"\/var\/cache\/mod_cache_disk\"\nCacheDirLevels 2\nCacheDirLength 1\nCacheIgnoreHeaders Set-Cookie}) |
135 | 255 | } |
136 | 256 | end |
| 257 | + context 'with $default_cache_enable = false' do |
| 258 | + let :pre_condition do |
| 259 | + 'class{ "apache": |
| 260 | + apache_version => "2.4", |
| 261 | + default_mods => ["cache"], |
| 262 | + mod_dir => "/tmp/junk", |
| 263 | + }' |
| 264 | + end |
| 265 | + |
| 266 | + let(:params) { { 'default_cache_enable' => false } } |
| 267 | + |
| 268 | + it { is_expected.to compile } |
| 269 | + it { is_expected.to contain_class('apache::mod::disk_cache') } |
| 270 | + it { is_expected.to contain_class('apache::mod::cache').that_comes_before('Class[Apache::Mod::Disk_cache]') } |
| 271 | + it { is_expected.to contain_apache_mod('cache_disk') } |
| 272 | + it { |
| 273 | + is_expected.to contain_file('disk_cache.conf') |
| 274 | + .with(content: %r{CacheRoot \"\/var\/cache\/apache2\/mod_cache_disk\"\nCacheDirLevels 2\nCacheDirLength 1\nCacheIgnoreHeaders Set-Cookie}) |
| 275 | + } |
| 276 | + end |
| 277 | + context 'with $default_cache_enable = true' do |
| 278 | + let :pre_condition do |
| 279 | + 'class{ "apache": |
| 280 | + apache_version => "2.4", |
| 281 | + default_mods => ["cache"], |
| 282 | + mod_dir => "/tmp/junk", |
| 283 | + }' |
| 284 | + end |
| 285 | + |
| 286 | + let(:params) { { 'default_cache_enable' => true } } |
| 287 | + |
| 288 | + it { is_expected.to compile } |
| 289 | + it { is_expected.to contain_class('apache::mod::disk_cache') } |
| 290 | + it { is_expected.to contain_class('apache::mod::cache').that_comes_before('Class[Apache::Mod::Disk_cache]') } |
| 291 | + it { is_expected.to contain_apache_mod('cache_disk') } |
| 292 | + it { |
| 293 | + is_expected.to contain_file('disk_cache.conf') |
| 294 | + .with(content: %r{CacheEnable disk \/\nCacheRoot \"\/var\/cache\/apache2\/mod_cache_disk\"\nCacheDirLevels 2\nCacheDirLength 1\nCacheIgnoreHeaders Set-Cookie}) |
| 295 | + } |
| 296 | + end |
| 297 | + context 'with $default_cache_enable = foo' do |
| 298 | + let :pre_condition do |
| 299 | + 'class{ "apache": |
| 300 | + apache_version => "2.4", |
| 301 | + default_mods => ["cache"], |
| 302 | + mod_dir => "/tmp/junk", |
| 303 | + }' |
| 304 | + end |
| 305 | + |
| 306 | + let(:params) { { 'default_cache_enable' => 'foo' } } |
| 307 | + |
| 308 | + it { is_expected.to compile } |
| 309 | + it { is_expected.to contain_class('apache::mod::disk_cache') } |
| 310 | + it { is_expected.to contain_class('apache::mod::cache').that_comes_before('Class[Apache::Mod::Disk_cache]') } |
| 311 | + it { is_expected.to contain_apache_mod('cache_disk') } |
| 312 | + it { |
| 313 | + is_expected.to contain_file('disk_cache.conf') |
| 314 | + .with(content: %r{CacheEnable disk \/\nCacheRoot \"\/var\/cache\/apache2\/mod_cache_disk\"\nCacheDirLevels 2\nCacheDirLength 1\nCacheIgnoreHeaders Set-Cookie}) |
| 315 | + }.to raise_error(Puppet::Error, 'default_cache_enable must be true or false') |
| 316 | + end |
137 | 317 | end |
138 | 318 | end |
0 commit comments