|
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\n}) |
| 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\n}) |
| 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.not_to compile } |
| 102 | + end |
50 | 103 | end |
51 | 104 |
|
52 | 105 | context 'on a RedHat 6-based OS' do |
|
88 | 141 | .with(content: %r{CacheEnable disk \/\nCacheRoot \"\/var\/cache\/httpd\/proxy\"\nCacheDirLevels 2\nCacheDirLength 1\nCacheIgnoreHeaders Set-Cookie}) |
89 | 142 | } |
90 | 143 | end |
| 144 | + context 'with $default_cache_enable = false' do |
| 145 | + let :pre_condition do |
| 146 | + 'class{ "apache": |
| 147 | + apache_version => "2.4", |
| 148 | + default_mods => ["cache"], |
| 149 | + mod_dir => "/tmp/junk", |
| 150 | + }' |
| 151 | + end |
| 152 | + |
| 153 | + let(:params) { { 'default_cache_enable' => false } } |
| 154 | + |
| 155 | + it { is_expected.to compile } |
| 156 | + it { is_expected.to contain_class('apache::mod::disk_cache') } |
| 157 | + it { is_expected.to contain_class('apache::mod::cache').that_comes_before('Class[Apache::Mod::Disk_cache]') } |
| 158 | + it { is_expected.to contain_apache__mod('cache_disk') } |
| 159 | + it { |
| 160 | + is_expected.to contain_file('disk_cache.conf') |
| 161 | + .with(content: %r{CacheRoot \"\/var\/cache\/httpd\/proxy\"\nCacheDirLevels 2\nCacheDirLength 1\n}) |
| 162 | + } |
| 163 | + end |
| 164 | + context 'with $default_cache_enable = true' do |
| 165 | + let :pre_condition do |
| 166 | + 'class{ "apache": |
| 167 | + apache_version => "2.4", |
| 168 | + default_mods => ["cache"], |
| 169 | + mod_dir => "/tmp/junk", |
| 170 | + }' |
| 171 | + end |
| 172 | + |
| 173 | + let(:params) { { 'default_cache_enable' => true } } |
| 174 | + |
| 175 | + it { is_expected.to compile } |
| 176 | + it { is_expected.to contain_class('apache::mod::disk_cache') } |
| 177 | + it { is_expected.to contain_class('apache::mod::cache').that_comes_before('Class[Apache::Mod::Disk_cache]') } |
| 178 | + it { is_expected.to contain_apache__mod('cache_disk') } |
| 179 | + it { |
| 180 | + is_expected.to contain_file('disk_cache.conf') |
| 181 | + .with(content: %r{CacheEnable disk \/\nCacheRoot \"\/var\/cache\/httpd\/proxy\"\nCacheDirLevels 2\nCacheDirLength 1\n}) |
| 182 | + } |
| 183 | + end |
| 184 | + context 'with $default_cache_enable = foo' do |
| 185 | + let :pre_condition do |
| 186 | + 'class{ "apache": |
| 187 | + apache_version => "2.4", |
| 188 | + default_mods => ["cache"], |
| 189 | + mod_dir => "/tmp/junk", |
| 190 | + }' |
| 191 | + end |
| 192 | + |
| 193 | + let(:params) { { 'default_cache_enable' => 'foo' } } |
| 194 | + |
| 195 | + it { is_expected.not_to compile } |
| 196 | + end |
91 | 197 | end |
92 | 198 | context 'on a FreeBSD OS' do |
93 | 199 | include_examples 'FreeBSD 10' |
|
134 | 240 | .with(content: %r{CacheEnable disk \/\nCacheRoot \"\/var\/cache\/mod_cache_disk\"\nCacheDirLevels 2\nCacheDirLength 1\nCacheIgnoreHeaders Set-Cookie}) |
135 | 241 | } |
136 | 242 | end |
| 243 | + context 'with $default_cache_enable = false' do |
| 244 | + let :pre_condition do |
| 245 | + 'class{ "apache": |
| 246 | + apache_version => "2.4", |
| 247 | + default_mods => ["cache"], |
| 248 | + mod_dir => "/tmp/junk", |
| 249 | + }' |
| 250 | + end |
| 251 | + |
| 252 | + let(:params) { { 'default_cache_enable' => false } } |
| 253 | + |
| 254 | + it { is_expected.to compile } |
| 255 | + it { is_expected.to contain_class('apache::mod::disk_cache') } |
| 256 | + it { is_expected.to contain_class('apache::mod::cache').that_comes_before('Class[Apache::Mod::Disk_cache]') } |
| 257 | + it { is_expected.to contain_apache__mod('cache_disk') } |
| 258 | + it { |
| 259 | + is_expected.to contain_file('disk_cache.conf') |
| 260 | + .with(content: %r{CacheRoot \"\/var\/cache\/mod_cache_disk\"\nCacheDirLevels 2\nCacheDirLength 1\n}) |
| 261 | + } |
| 262 | + end |
| 263 | + context 'with $default_cache_enable = true' do |
| 264 | + let :pre_condition do |
| 265 | + 'class{ "apache": |
| 266 | + apache_version => "2.4", |
| 267 | + default_mods => ["cache"], |
| 268 | + mod_dir => "/tmp/junk", |
| 269 | + }' |
| 270 | + end |
| 271 | + |
| 272 | + let(:params) { { 'default_cache_enable' => true } } |
| 273 | + |
| 274 | + it { is_expected.to compile } |
| 275 | + it { is_expected.to contain_class('apache::mod::disk_cache') } |
| 276 | + it { is_expected.to contain_class('apache::mod::cache').that_comes_before('Class[Apache::Mod::Disk_cache]') } |
| 277 | + it { is_expected.to contain_apache__mod('cache_disk') } |
| 278 | + it { |
| 279 | + is_expected.to contain_file('disk_cache.conf') |
| 280 | + .with(content: %r{CacheEnable disk \/\nCacheRoot \"\/var\/cache\/mod_cache_disk\"\nCacheDirLevels 2\nCacheDirLength 1\n}) |
| 281 | + } |
| 282 | + end |
| 283 | + context 'with $default_cache_enable = foo' do |
| 284 | + let :pre_condition do |
| 285 | + 'class{ "apache": |
| 286 | + apache_version => "2.4", |
| 287 | + default_mods => ["cache"], |
| 288 | + mod_dir => "/tmp/junk", |
| 289 | + }' |
| 290 | + end |
| 291 | + |
| 292 | + let(:params) { { 'default_cache_enable' => 'foo' } } |
| 293 | + |
| 294 | + it { is_expected.not_to compile } |
| 295 | + end |
137 | 296 | end |
138 | 297 | end |
0 commit comments