Merge "Octavia: Add optional inclusion of driver_agent class" into stable/wallaby

This commit is contained in:
Zuul 2022-07-27 18:56:44 +00:00 committed by Gerrit Code Review
commit 3bede6032b
2 changed files with 56 additions and 14 deletions

View File

@ -45,7 +45,11 @@
# [*oslomsg_rpc_use_ssl*]
# Enable ssl oslo messaging services
# Defaults to hiera('oslo_messaging_rpc_use_ssl', '0')
#
# [*enable_driver_agent*]
# Enable the driver agent
# Defaults to false
#
class tripleo::profile::base::octavia (
$step = Integer(hiera('step')),
$oslomsg_rpc_proto = hiera('oslo_messaging_rpc_scheme', 'rabbit'),
@ -54,6 +58,7 @@ class tripleo::profile::base::octavia (
$oslomsg_rpc_port = hiera('oslo_messaging_rpc_port', '5672'),
$oslomsg_rpc_username = hiera('oslo_messaging_rpc_user_name', 'guest'),
$oslomsg_rpc_use_ssl = hiera('oslo_messaging_rpc_use_ssl', '0'),
$enable_driver_agent = false
) {
if $step >= 3 {
$oslomsg_rpc_use_ssl_real = sprintf('%s', bool2num(str2bool($oslomsg_rpc_use_ssl)))
@ -70,5 +75,9 @@ class tripleo::profile::base::octavia (
include octavia::config
include octavia::logging
include octavia::service_auth
if $enable_driver_agent {
include octavia::driver_agent
}
}
}

View File

@ -34,6 +34,9 @@ describe 'tripleo::profile::base::octavia' do
it 'should not do anything' do
is_expected.to_not contain_class('octavia')
is_expected.to_not contain_class('octavia::config')
is_expected.to_not contain_class('octavia::logging')
is_expected.to_not contain_class('octavia::service_auth')
is_expected.to_not contain_class('octavia::driver_agent')
end
end
@ -47,12 +50,18 @@ describe 'tripleo::profile::base::octavia' do
:default_transport_url => 'rabbit://guest:password@some.server.com:5672/?ssl=0'
)
is_expected.to contain_class('octavia::config')
is_expected.to contain_class('octavia::logging')
is_expected.to contain_class('octavia::service_auth')
is_expected.to_not contain_class('octavia::driver_agent')
end
end
context 'with multiple hosts' do
before do
params.merge!({ :oslomsg_rpc_hosts => ['some.server.com', 'someother.server.com'] })
params.merge!({
:step => 3,
:oslomsg_rpc_hosts => ['some.server.com', 'someother.server.com']
})
end
it 'should construct a multihost URL' do
@ -64,7 +73,10 @@ describe 'tripleo::profile::base::octavia' do
context 'with username provided' do
before do
params.merge!({ :oslomsg_rpc_username => 'bunny' })
params.merge!({
:step => 3,
:oslomsg_rpc_username => 'bunny'
})
end
it 'should construct URL with username' do
@ -76,11 +88,11 @@ describe 'tripleo::profile::base::octavia' do
context 'with username and password provided' do
before do
params.merge!(
{ :oslomsg_rpc_username => 'bunny',
:oslomsg_rpc_password => 'carrot'
}
)
params.merge!({
:step => 3,
:oslomsg_rpc_username => 'bunny',
:oslomsg_rpc_password => 'carrot'
})
end
it 'should construct URL with username and password' do
@ -92,12 +104,12 @@ describe 'tripleo::profile::base::octavia' do
context 'with multiple hosts and user info provided' do
before do
params.merge!(
{ :oslomsg_rpc_hosts => ['some.server.com', 'someother.server.com'],
:oslomsg_rpc_username => 'bunny',
:oslomsg_rpc_password => 'carrot'
}
)
params.merge!({
:step => 3,
:oslomsg_rpc_hosts => ['some.server.com', 'someother.server.com'],
:oslomsg_rpc_username => 'bunny',
:oslomsg_rpc_password => 'carrot'
})
end
it 'should distributed user info across hosts URL' do
@ -106,6 +118,27 @@ describe 'tripleo::profile::base::octavia' do
)
end
end
context 'with driver agent enabled' do
before do
params.merge!({
:step => 3,
:enable_driver_agent => true
})
end
it 'should provide basic initialization' do
is_expected.to contain_class('octavia').with(
:default_transport_url => 'rabbit://guest:password@some.server.com:5672/?ssl=0'
)
is_expected.to contain_class('octavia::config')
is_expected.to contain_class('octavia::db')
is_expected.to contain_class('octavia::logging')
is_expected.to contain_class('octavia::service_auth')
is_expected.to contain_class('octavia::driver_agent')
end
end
end
on_supported_os.each do |os, facts|