87bb46ca7082ef4c243d335c30b2c0cbf2a04c5a
[mirror/dsa-puppet.git] / 3rdparty / modules / glance / spec / classes / glance_cache_pruner_spec.rb
1 require 'spec_helper'
2
3 describe 'glance::cache::pruner' do
4
5   shared_examples_for 'glance cache pruner' do
6
7     context 'when default parameters' do
8
9       it 'configures a cron' do
10          should contain_cron('glance-cache-pruner').with(
11           :command     => 'glance-cache-pruner ',
12           :environment => 'PATH=/bin:/usr/bin:/usr/sbin',
13           :user        => 'glance',
14           :minute      => '*/30',
15           :hour        => '*',
16           :monthday    => '*',
17           :month       => '*',
18           :weekday     => '*'
19         )
20       end
21     end
22
23     context 'when overriding parameters' do
24       let :params do
25         {
26           :minute           => 59,
27           :hour             => 23,
28           :monthday         => '1',
29           :month            => '2',
30           :weekday          => '3',
31           :command_options  => '--config-dir /etc/glance/',
32         }
33       end
34       it 'configures a cron' do
35         should contain_cron('glance-cache-pruner').with(
36           :command     => 'glance-cache-pruner --config-dir /etc/glance/',
37           :environment => 'PATH=/bin:/usr/bin:/usr/sbin',
38           :user        => 'glance',
39           :minute      => 59,
40           :hour        => 23,
41           :monthday    => '1',
42           :month       => '2',
43           :weekday     => '3'
44         )
45       end
46     end
47   end
48
49   context 'on Debian platforms' do
50     let :facts do
51       { :osfamily => 'Debian' }
52     end
53     include_examples 'glance cache pruner'
54     it { should contain_cron('glance-cache-pruner').with(:require     => 'Package[glance-api]')}
55   end
56
57   context 'on RedHat platforms' do
58     let :facts do
59       { :osfamily => 'RedHat' }
60     end
61     include_examples 'glance cache pruner'
62     it { should contain_cron('glance-cache-pruner').with(:require     => 'Package[openstack-glance]')}
63   end
64
65 end