puppet-neutron/spec/classes/neutron_db_sync_spec.rb
Mike Bayer adaee02815 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.

The proposed change adds a configuration option db_sync_timeout
which maintains the Puppet default of 300 but allows TripleO to
change the timeout to something higher.

Change-Id: I6b30a4d9e3ca25d9a473e4eb614a8769fa4567e7
2017-01-18 15:51:08 -05:00

89 lines
2.5 KiB
Ruby

require 'spec_helper'
describe 'neutron::db::sync' do
shared_examples_for 'neutron-dbsync' do
it 'runs neutron-db-sync' do
is_expected.to contain_exec('neutron-db-sync').with(
:command => 'neutron-db-manage upgrade heads',
:path => '/usr/bin',
:refreshonly => 'true',
:try_sleep => 5,
:tries => 10,
:timeout => 300,
:logoutput => 'on_failure',
:subscribe => ['Anchor[neutron::install::end]',
'Anchor[neutron::config::end]',
'Anchor[neutron::dbsync::begin]'],
:notify => 'Anchor[neutron::dbsync::end]',
)
end
describe "overriding extra_params" do
let :params do
{
:extra_params => '--config-file /etc/neutron/neutron.conf',
}
end
it {
is_expected.to contain_exec('neutron-db-sync').with(
:command => 'neutron-db-manage --config-file /etc/neutron/neutron.conf upgrade heads',
:path => '/usr/bin',
:refreshonly => 'true',
:try_sleep => 5,
:tries => 10,
:timeout => 300,
:logoutput => 'on_failure',
:subscribe => ['Anchor[neutron::install::end]',
'Anchor[neutron::config::end]',
'Anchor[neutron::dbsync::begin]'],
:notify => 'Anchor[neutron::dbsync::end]',
)
}
end
describe "overriding db_sync_timeout" do
let :params do
{
:db_sync_timeout => 750,
}
end
it {
is_expected.to contain_exec('neutron-db-sync').with(
:command => 'neutron-db-manage upgrade heads',
:path => '/usr/bin',
:refreshonly => 'true',
:try_sleep => 5,
:tries => 10,
:timeout => 750,
:logoutput => 'on_failure',
:subscribe => ['Anchor[neutron::install::end]',
'Anchor[neutron::config::end]',
'Anchor[neutron::dbsync::begin]'],
:notify => 'Anchor[neutron::dbsync::end]',
)
}
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({
:processorcount => 8,
:concat_basedir => '/var/lib/puppet/concat'
}))
end
it_configures 'neutron-dbsync'
end
end
end