Files
puppet-keystone/spec/classes/keystone_cron_token_flush_spec.rb
Emilien Macchi c39fca28e6 crontab: ensure the script is run with bash shell
Some distros does not provide a default shell for Keystone user.
We can run the crontab by force shell usage and avoid running
issues.

Change-Id: Ib05522d922fecfbd28aa8a8b092b4d3b47172d00
2014-12-09 13:34:40 -05:00

69 lines
1.9 KiB
Ruby

require 'spec_helper'
describe 'keystone::cron::token_flush' do
let :facts do
{ :osfamily => 'Debian' }
end
describe 'with default parameters' do
it 'configures a cron' do
should contain_cron('keystone-manage token_flush').with(
:ensure => 'present',
:command => 'keystone-manage token_flush >>/var/log/keystone/keystone-tokenflush.log 2>&1',
:environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
:user => 'keystone',
:minute => 1,
:hour => 0,
:monthday => '*',
:month => '*',
:weekday => '*'
)
end
end
describe 'when specifying a maxdelay param' do
let :params do
{
:maxdelay => 600
}
end
it 'configures a cron with delay' do
should contain_cron('keystone-manage token_flush').with(
:ensure => 'present',
:command => 'sleep `expr ${RANDOM} \\% 600`; keystone-manage token_flush >>/var/log/keystone/keystone-tokenflush.log 2>&1',
:environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
:user => 'keystone',
:minute => 1,
:hour => 0,
:monthday => '*',
:month => '*',
:weekday => '*'
)
end
end
describe 'when specifying a maxdelay param' do
let :params do
{
:ensure => 'absent'
}
end
it 'configures a cron with delay' do
should contain_cron('keystone-manage token_flush').with(
:ensure => 'absent',
:command => 'keystone-manage token_flush >>/var/log/keystone/keystone-tokenflush.log 2>&1',
:environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
:user => 'keystone',
:minute => 1,
:hour => 0,
:monthday => '*',
:month => '*',
:weekday => '*'
)
end
end
end