From f9fd67e25bc2eb2216d2ed3a220b68c9afa50df9 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Sun, 24 Jan 2021 08:32:02 +0900 Subject: [PATCH] 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 (cherry picked from commit 7c3ec9872806b7ad286e45199c0fde6f59facf1c) (cherry picked from commit 2d33aa890a9cb70c2c180b93ee2eecfcc12a318f) --- spec/classes/gnocchi_storage_swift_spec.rb | 24 +++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/spec/classes/gnocchi_storage_swift_spec.rb b/spec/classes/gnocchi_storage_swift_spec.rb index fd5cc035..c18accd5 100644 --- a/spec/classes/gnocchi_storage_swift_spec.rb +++ b/spec/classes/gnocchi_storage_swift_spec.rb @@ -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