puppet-swift/spec/classes/swift_keymaster.rb
Takashi Kajinami ceaf421eb8 Do not hardcode default of [ksm_keymaster] meta_version_to_write
meta_version_to_write=1 should be used until swift is upgraded from
2.20.0(Stein), but that version is quite old and we don't expect
current puppet-swift is used with such old version.

Also, meta_version_to_write=2 should be used until swift is upgrade
from 2.25.0(Ussuri) but again this version is too old and out of our
current support scope.

This change removes the hard-coded default(1) so that the latest value
(3) is used instead.

Change-Id: I87fe552e9a8d7f7214985c1ecb7abfff1f1abb18
2022-01-25 21:52:06 +09:00

45 lines
2.0 KiB
Ruby

require 'spec_helper'
describe 'swift::keymaster' do
shared_examples 'swift::keymaster' do
describe "when using default parameters" do
it { is_expected.to contain_swift_keymaster_config('kms_keymaster/api_class').with_value('castellan.key_manager.barbican_key_manager.BarbicanKeyManager') }
it { is_expected.to contain_swift_keymaster_config('kms_keymaster/username').with_value('swift') }
it { is_expected.to contain_swift_keymaster_config('kms_keymaster/project_name').with_value('services') }
it { is_expected.to contain_swift_keymaster_config('kms_keymaster/project_domain_id').with_value('default') }
it { is_expected.to contain_swift_keymaster_config('kms_keymaster/user_domain_id').with_value('default') }
it { is_expected.to contain_swift_keymaster_config('kms_keymaster/meta_version_to_write').with_value('<SERVICE DEFAULT>') }
end
describe "when overriding default parameters" do
let :params do
{
:key_id => 'dummy_key_id',
:password => 'fake_password',
:auth_endpoint => 'http://127.0.0.1:5000',
:project_name => 'barbican_swift_service',
:meta_version_to_write => 3,
}
end
it { is_expected.to contain_swift_keymaster_config('kms_keymaster/key_id').with_value('dummy_key_id') }
it { is_expected.to contain_swift_keymaster_config('kms_keymaster/password').with_value('fake_password').with_secret(true) }
it { is_expected.to contain_swift_keymaster_config('kms_keymaster/auth_endpoint').with_value('http://127.0.0.1:5000') }
it { is_expected.to contain_swift_keymaster_config('kms_keymaster/project_name').with_value('barbican_swift_service') }
it { is_expected.to contain_swift_keymaster_config('kms_keymaster/meta_version_to_write').with_value('3') }
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())
end
it_configures 'swift::keymaster'
end
end
end