Files
puppet-gnocchi/spec/classes/gnocchi_db_sync_spec.rb
ZhongShengping d595457836 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: I800fd9a00ddf7e7ca0ebd54c9d203cf04477aa3b
Closes-Bug: #1755102
2018-03-12 16:33:07 +08:00

63 lines
1.9 KiB
Ruby

require 'spec_helper'
describe 'gnocchi::db::sync' do
shared_examples_for 'gnocchi-dbsync' do
it 'runs gnocchi-manage db_sync' do
is_expected.to contain_exec('gnocchi-db-sync').with(
:command => 'gnocchi-upgrade --config-file /etc/gnocchi/gnocchi.conf ',
:path => '/usr/bin',
:user => 'gnocchi',
:refreshonly => 'true',
:try_sleep => 5,
:tries => 10,
:logoutput => 'on_failure',
:subscribe => ['Anchor[gnocchi::install::end]',
'Anchor[gnocchi::config::end]',
'Anchor[gnocchi::dbsync::begin]'],
:notify => 'Anchor[gnocchi::dbsync::end]',
:tag => 'openstack-db',
)
end
describe "overriding extra_opts" do
let :params do
{
:extra_opts => '--skip-storage',
}
end
it { is_expected.to contain_exec('gnocchi-db-sync').with(
:command => 'gnocchi-upgrade --config-file /etc/gnocchi/gnocchi.conf --skip-storage',
:path => '/usr/bin',
:user => 'gnocchi',
:refreshonly => 'true',
:try_sleep => 5,
:tries => 10,
:logoutput => 'on_failure',
:subscribe => ['Anchor[gnocchi::install::end]',
'Anchor[gnocchi::config::end]',
'Anchor[gnocchi::dbsync::begin]'],
:notify => 'Anchor[gnocchi::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 'gnocchi-dbsync'
end
end
end