puppet-barbican/spec/classes/barbican_db_sync_spec.rb
Juan Antonio Osorio Robles a51b1e0d66 Call sync secret store on db-sync
Due to race conditions when doing the secret store sync in the code, we
opted for requiring the command to be explicitly called. This reflects
the new requirement by adding the secret store sync in the db-sync
manifest.

Change-Id: I61544d2defa3fd7f28c312ce94a753f36a2b7d30
Related-Bug: #1738863
2018-03-20 11:06:38 +02:00

96 lines
3.4 KiB
Ruby

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