
In a recent commit [1] the keystone token flush cron job was changed to run twice a day. However, this change was not enough for big deployments. After getting some customer feedback and looking at what other projects are doing [2] [3] [4]. It seems that running this job hourly is the way to go. [1] Ia0b0fb422318712f4b0f4d023cbb3a61d40bb85d [2] https://www.ibm.com/support/knowledgecenter/en/SSB27U_6.4.0/com.ibm.zvm.v640.hcpo4/exptoken.htm [3] https://review.openstack.org/#/c/88670/8 [4] https://github.com/openstack/charm-keystone/blob/master/templates/keystone-token-flush Change-Id: I6ec7ec8111bd93e5638cfe96189e36f0e0691d65 Related-Bug: #1649616
106 lines
3.2 KiB
Ruby
106 lines
3.2 KiB
Ruby
require 'spec_helper'
|
|
|
|
describe 'keystone::cron::token_flush' do
|
|
|
|
let :facts do
|
|
@default_facts.merge({ :osfamily => 'Debian' })
|
|
end
|
|
|
|
let :params do
|
|
{ :ensure => 'present',
|
|
:minute => 1,
|
|
:hour => '*',
|
|
:monthday => '*',
|
|
:month => '*',
|
|
:weekday => '*',
|
|
:maxdelay => 0,
|
|
:destination => '/var/log/keystone/keystone-tokenflush.log' }
|
|
end
|
|
|
|
describe 'with default parameters' do
|
|
it 'configures a cron' do
|
|
is_expected.to contain_cron('keystone-manage token_flush').with(
|
|
:ensure => params[:ensure],
|
|
:command => "keystone-manage token_flush >>#{params[:destination]} 2>&1",
|
|
:environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
|
:user => 'keystone',
|
|
:minute => params[:minute],
|
|
:hour => params[:hour],
|
|
:monthday => params[:monthday],
|
|
:month => params[:month],
|
|
:weekday => params[:weekday],
|
|
:require => 'Package[keystone]',
|
|
)
|
|
end
|
|
end
|
|
|
|
describe 'when specifying a maxdelay param' do
|
|
before :each do
|
|
params.merge!(
|
|
:maxdelay => 600
|
|
)
|
|
end
|
|
|
|
it 'configures a cron with delay' do
|
|
is_expected.to contain_cron('keystone-manage token_flush').with(
|
|
:ensure => params[:ensure],
|
|
:command => "sleep `expr ${RANDOM} \\% #{params[:maxdelay]}`; keystone-manage token_flush >>#{params[:destination]} 2>&1",
|
|
:environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
|
:user => 'keystone',
|
|
:minute => params[:minute],
|
|
:hour => params[:hour],
|
|
:monthday => params[:monthday],
|
|
:month => params[:month],
|
|
:weekday => params[:weekday],
|
|
:require => 'Package[keystone]',
|
|
)
|
|
end
|
|
end
|
|
|
|
describe 'when specifying a user param' do
|
|
let :params do
|
|
{
|
|
:user => 'keystonecustom'
|
|
}
|
|
end
|
|
|
|
it 'configures a cron with delay' do
|
|
is_expected.to 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 => 'keystonecustom',
|
|
:minute => 1,
|
|
:hour => '*',
|
|
:monthday => '*',
|
|
:month => '*',
|
|
:weekday => '*',
|
|
:require => 'Package[keystone]',
|
|
)
|
|
end
|
|
end
|
|
|
|
describe 'when disabling cron job' do
|
|
before :each do
|
|
params.merge!(
|
|
:ensure => 'absent'
|
|
)
|
|
end
|
|
|
|
it 'configures a cron with delay' do
|
|
is_expected.to contain_cron('keystone-manage token_flush').with(
|
|
:ensure => params[:ensure],
|
|
:command => "keystone-manage token_flush >>#{params[:destination]} 2>&1",
|
|
:environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
|
:user => 'keystone',
|
|
:minute => params[:minute],
|
|
:hour => params[:hour],
|
|
:monthday => params[:monthday],
|
|
:month => params[:month],
|
|
:weekday => params[:weekday],
|
|
:require => 'Package[keystone]',
|
|
)
|
|
end
|
|
end
|
|
end
|