Improve unit test coverage of gnocchi::storage::swift

Currently we only test swift_endpoint_type, but we should test all
options to ensure all available options work.

Change-Id: Iadb9a0d0a9c4b3dab70f34a87435df7a5c692a1e
This commit is contained in:
Takashi Kajinami 2021-01-24 08:32:02 +09:00
parent 2439d4c0ca
commit 7c3ec98728
1 changed files with 21 additions and 3 deletions

View File

@ -26,14 +26,32 @@ describe 'gnocchi::storage::swift' do
end
end
context 'with swift_endpoint_type set' do
context 'with specific parameters' do
before do
params.merge!({
:swift_endpoint_type => 'internalURL'
:swift_user => 'swift2',
:swift_key => 'admin',
:swift_authurl => 'http://localhost:5000',
:swift_project_name => 'service',
:swift_user_domain_name => 'Default',
:swift_project_domain_name => 'Default',
:swift_region => 'regionOne',
:swift_auth_version => 2,
:swift_endpoint_type => 'publicURL',
})
end
it 'configures gnocchi-api with given endpoint type' do
is_expected.to contain_gnocchi_config('storage/swift_endpoint_type').with_value('internalURL')
is_expected.to contain_gnocchi_config('storage/driver').with_value('swift')
is_expected.to contain_gnocchi_config('storage/swift_user').with_value('swift2')
is_expected.to contain_gnocchi_config('storage/swift_key').with_value('admin')
is_expected.to contain_gnocchi_config('storage/swift_authurl').with_value('http://localhost:5000')
is_expected.to contain_gnocchi_config('storage/swift_project_name').with_value('service')
is_expected.to contain_gnocchi_config('storage/swift_user_domain_name').with_value('Default')
is_expected.to contain_gnocchi_config('storage/swift_project_domain_name').with_value('Default')
is_expected.to contain_gnocchi_config('storage/swift_region').with_value('regionOne')
is_expected.to contain_gnocchi_config('storage/swift_auth_version').with_value(2)
is_expected.to contain_gnocchi_config('storage/swift_endpoint_type').with_value('publicURL')
end
end
end