swift: Improve parameter support coverage

Change-Id: I017808988071f4cd52186bc1529d07958867a5fe
This commit is contained in:
Takashi Kajinami 2024-01-14 02:58:15 +09:00
parent f8d59f0e35
commit 9e48b8be88
3 changed files with 59 additions and 13 deletions

View File

@ -1,21 +1,46 @@
# == class: zaqar::messaging::swift
#
# [*uri*]
# Swift Connection URI. Required.
# (Required) Swift Connection URI.
#
# [*auth_url*]
# URL to the KeyStone service. Default $facts['os_service_default']
# (Optional) URL to the KeyStone service.
# Default $facts['os_service_default']
#
# [*project_domain_name*]
# (Optional) Project's domain name.
# Default $facts['os_service_default']
#
# [*user_domain_name*]
# (Optional) User's domain name.
# Default $facts['os_service_default']
#
# [*region_name*]
# (Optional) Region name.
# Default $facts['os_service_default']
#
# [*interface*]
# (Optional) The default interface for endpoint URL discovery.
# Default $facts['os_service_default']
#
class zaqar::messaging::swift(
$uri,
$auth_url = $facts['os_service_default'],
$auth_url = $facts['os_service_default'],
$project_domain_name = $facts['os_service_default'],
$user_domain_name = $facts['os_service_default'],
$region_name = $facts['os_service_default'],
$interface = $facts['os_service_default'],
) {
include zaqar::deps
zaqar_config {
'drivers:message_store:swift/uri': value => $uri, secret => true;
'drivers:message_store:swift/auth_url': value => $auth_url;
'drivers:message_store:swift/uri': value => $uri, secret => true;
'drivers:message_store:swift/auth_url': value => $auth_url;
'drivers:message_store:swift/project_domain_name': value => $project_domain_name;
'drivers:message_store:swift/user_domain_name': value => $user_domain_name;
'drivers:message_store:swift/region_name': value => $region_name;
'drivers:message_store:swift/interface': value => $interface;
}
}

View File

@ -0,0 +1,10 @@
---
features:
- |
The following parameters have been added to the ``zaqar::messaging::swift``
class.
- ``project_domain_name``
- ``user_domain_name``
- ``region_name``
- ``interface``

View File

@ -16,7 +16,7 @@ describe 'zaqar::messaging::swift' do
end
let :req_params do
{
:uri => 'swift://user:pass@/zaqar',
:uri => 'swift://user:pass@/zaqar',
}
end
@ -26,12 +26,15 @@ describe 'zaqar::messaging::swift' do
end
it 'should config swift messaging driver' do
is_expected.to contain_zaqar_config('drivers/message_store').with(
:value => 'swift'
)
is_expected.to contain_zaqar_config('drivers:message_store:swift/uri').with(
:value => 'swift://user:pass@/zaqar',
)
is_expected.to contain_zaqar_config('drivers/message_store').with_value('swift')
is_expected.to contain_zaqar_config('drivers:message_store:swift/uri').with_value(
'swift://user:pass@/zaqar',
).with_secret(true)
is_expected.to contain_zaqar_config('drivers:message_store:swift/auth_url').with_value('<SERVICE DEFAULT>')
is_expected.to contain_zaqar_config('drivers:message_store:swift/project_domain_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_zaqar_config('drivers:message_store:swift/user_domain_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_zaqar_config('drivers:message_store:swift/region_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_zaqar_config('drivers:message_store:swift/interface').with_value('<SERVICE DEFAULT>')
end
end
@ -39,12 +42,20 @@ describe 'zaqar::messaging::swift' do
describe 'with custom values' do
let :params do
req_params.merge!({
:auth_url => 'http://foo',
:auth_url => 'http://foo',
:project_domain_name => 'Domain1',
:user_domain_name => 'Domain2',
:region_name => 'regionOne',
:interface => 'publicURL',
})
end
it 'configures custom values' do
is_expected.to contain_zaqar_config('drivers:message_store:swift/auth_url').with_value('http://foo')
is_expected.to contain_zaqar_config('drivers:message_store:swift/project_domain_name').with_value('Domain1')
is_expected.to contain_zaqar_config('drivers:message_store:swift/user_domain_name').with_value('Domain2')
is_expected.to contain_zaqar_config('drivers:message_store:swift/region_name').with_value('regionOne')
is_expected.to contain_zaqar_config('drivers:message_store:swift/interface').with_value('publicURL')
end
end
end