Files
puppet-mistral/spec/classes/mistral_db_sync_spec.rb
ZhongShengping da173ebd0b Allow db sync timeouts to be configurable
As Openstack projects continue to have longer database migration
chains, the Puppet default timeout of 300 seconds for an execution
is becoming too short a duration on some hardware, leading to timeouts.
As projects continue to add more migration scripts without pruning
the base, timeouts will continue to become more frequent unless
this time can be expanded.

Change-Id: Ib8c2242c76106ecb41c267fe75f8f824e2934cc1
Closes-Bug: #1904962
2020-11-23 09:27:52 +08:00

61 lines
1.8 KiB
Ruby

require 'spec_helper'
describe 'mistral::db::sync' do
shared_examples_for 'mistral-db-sync' do
it { is_expected.to contain_class('mistral::deps') }
it 'runs mistral-db-manage upgrade head' do
is_expected.to contain_exec('mistral-db-sync').with(
:command => 'mistral-db-manage --config-file=/etc/mistral/mistral.conf upgrade head',
:path => '/usr/bin',
:user => 'mistral',
:refreshonly => 'true',
:try_sleep => 5,
:tries => 10,
:timeout => 300,
:logoutput => 'on_failure',
:subscribe => ['Anchor[mistral::install::end]',
'Anchor[mistral::config::end]',
'Anchor[mistral::dbsync::begin]'],
:notify => 'Anchor[mistral::dbsync::end]',
:tag => 'openstack-db',
)
is_expected.to contain_exec('mistral-db-populate').with(
:command => 'mistral-db-manage --config-file=/etc/mistral/mistral.conf populate',
:path => '/usr/bin',
:user => 'mistral',
:refreshonly => 'true',
:timeout => 300,
:logoutput => 'on_failure',
:subscribe => ['Anchor[mistral::install::end]',
'Anchor[mistral::config::end]',
'Anchor[mistral::dbsync::begin]'],
:notify => 'Anchor[mistral::dbsync::end]',
:tag => 'openstack-db',
)
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge(OSDefaults.get_facts({
:os_workers => 8,
:concat_basedir => '/var/lib/puppet/concat'
}))
end
it_configures 'mistral-db-sync'
end
end
end