puppet-neutron/spec/classes/neutron_db_sync_spec.rb
ZhongShengping 51dd0b90ef Add 'openstack-db' tag to db-sync Exec resource
In order to make easy orchestration on all OpenStack db-sync, add this
tag so people can use this tag in composition layer.
A use case it to set some orchestration to make sure MySQL Galera is
ready before running any Exec with this tag.

Change-Id: I2c215acfbfda9b6a8db88f4ab37db8ef911ea17e
Closes-Bug: #1755102
2018-03-12 16:33:09 +08:00

91 lines
2.6 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]',
:tag => 'openstack-db',
)
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]',
:tag => 'openstack-db',
)
}
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