Merge "Add unit tests for Octavia manifests"
This commit is contained in:
commit
babf6841c8
|
@ -18,12 +18,6 @@ require 'spec_helper'
|
||||||
|
|
||||||
describe 'tripleo::profile::base::octavia::api' do
|
describe 'tripleo::profile::base::octavia::api' do
|
||||||
|
|
||||||
let :params do
|
|
||||||
{ :step => 5,
|
|
||||||
:bootstrap_node => 'notbootstrap.example.com'
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
shared_examples_for 'tripleo::profile::base::octavia::api' do
|
shared_examples_for 'tripleo::profile::base::octavia::api' do
|
||||||
before :each do
|
before :each do
|
||||||
facts.merge!({ :step => params[:step] })
|
facts.merge!({ :step => params[:step] })
|
||||||
|
@ -44,110 +38,134 @@ eos
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with step less than 3 on bootstrap' do
|
context 'with step less than 3 on bootstrap' do
|
||||||
before do
|
let(:params) { {
|
||||||
params.merge!({
|
:step => 2,
|
||||||
:step => 2,
|
:bootstrap_node => 'node.example.com'
|
||||||
:bootstrap_node => 'node.example.com'
|
} }
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'should not do anything' do
|
it 'should not do anything' do
|
||||||
is_expected.to_not contain_class('octavia::api')
|
is_expected.to_not contain_class('octavia::api')
|
||||||
|
is_expected.to_not contain_class('octavia::controller')
|
||||||
is_expected.to_not contain_class('octavia::healthcheck')
|
is_expected.to_not contain_class('octavia::healthcheck')
|
||||||
|
is_expected.to_not contain_class('tripleo::profile::base::apache')
|
||||||
|
is_expected.to_not contain_class('octavia::wsgi::apache')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with step less than 3 on non-bootstrap' do
|
context 'with step less than 3 on non-bootstrap' do
|
||||||
before do
|
let(:params) { {
|
||||||
params.merge!({ :step => 2 })
|
:step => 2,
|
||||||
end
|
:bootstrap_node => 'other.example.com'
|
||||||
|
} }
|
||||||
|
|
||||||
it 'should not do anything' do
|
it 'should not do anything' do
|
||||||
is_expected.to_not contain_class('octavia::api')
|
is_expected.to_not contain_class('octavia::api')
|
||||||
|
is_expected.to_not contain_class('octavia::controller')
|
||||||
is_expected.to_not contain_class('octavia::healthcheck')
|
is_expected.to_not contain_class('octavia::healthcheck')
|
||||||
|
is_expected.to_not contain_class('tripleo::profile::base::apache')
|
||||||
|
is_expected.to_not contain_class('octavia::wsgi::apache')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with step 3 on bootstrap node' do
|
context 'with step 3 on bootstrap node' do
|
||||||
before do
|
let(:params) { {
|
||||||
params.merge!({
|
:step => 3,
|
||||||
:step => 3,
|
:bootstrap_node => 'node.example.com'
|
||||||
:bootstrap_node => 'node.example.com'
|
} }
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'should should start configurating database' do
|
it 'should should start configurating database' do
|
||||||
is_expected.to_not contain_class('octavia::api')
|
is_expected.to_not contain_class('octavia::api')
|
||||||
|
is_expected.to_not contain_class('octavia::controller')
|
||||||
is_expected.to_not contain_class('octavia::healthcheck')
|
is_expected.to_not contain_class('octavia::healthcheck')
|
||||||
|
is_expected.to_not contain_class('tripleo::profile::base::apache')
|
||||||
|
is_expected.to_not contain_class('octavia::wsgi::apache')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with step 3 on non-bootstrap node' do
|
context 'with step 3 on non-bootstrap node' do
|
||||||
before do
|
let(:params) { {
|
||||||
params.merge!({ :step => 3 })
|
:step => 3,
|
||||||
end
|
:bootstrap_node => 'other.example.com'
|
||||||
|
} }
|
||||||
|
|
||||||
it 'should do nothing' do
|
it 'should do nothing' do
|
||||||
is_expected.to_not contain_class('octavia::api')
|
is_expected.to_not contain_class('octavia::api')
|
||||||
|
is_expected.to_not contain_class('octavia::controller')
|
||||||
is_expected.to_not contain_class('octavia::healthcheck')
|
is_expected.to_not contain_class('octavia::healthcheck')
|
||||||
|
is_expected.to_not contain_class('tripleo::profile::base::apache')
|
||||||
|
is_expected.to_not contain_class('octavia::wsgi::apache')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with step 4 on bootstrap node' do
|
context 'with step 4 on bootstrap node' do
|
||||||
before do
|
let(:params) { {
|
||||||
params.merge!({
|
:step => 4,
|
||||||
:step => 4,
|
:bootstrap_node => 'node.example.com'
|
||||||
:bootstrap_node => 'node.example.com'
|
} }
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'should should sync database' do
|
it 'should apply configurations with syncing database' do
|
||||||
is_expected.to contain_class('octavia::api').with(:sync_db => true)
|
is_expected.to contain_class('octavia::api').with(:sync_db => true)
|
||||||
|
is_expected.to contain_class('octavia::controller')
|
||||||
is_expected.to contain_class('octavia::healthcheck')
|
is_expected.to contain_class('octavia::healthcheck')
|
||||||
|
is_expected.to contain_class('tripleo::profile::base::apache')
|
||||||
|
is_expected.to contain_class('octavia::wsgi::apache')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with step 4 on non-bootstrap node' do
|
context 'with step 4 on non-bootstrap node' do
|
||||||
before do
|
let(:params) { {
|
||||||
params.merge!({ :step => 4 })
|
:step => 4,
|
||||||
end
|
:bootstrap_node => 'other.example.com'
|
||||||
|
} }
|
||||||
|
|
||||||
it 'should do nothing' do
|
it 'should do nothing' do
|
||||||
is_expected.to_not contain_class('octavia::api')
|
is_expected.to_not contain_class('octavia::api')
|
||||||
|
is_expected.to_not contain_class('octavia::controller')
|
||||||
is_expected.to_not contain_class('octavia::healthcheck')
|
is_expected.to_not contain_class('octavia::healthcheck')
|
||||||
|
is_expected.to_not contain_class('tripleo::profile::base::apache')
|
||||||
|
is_expected.to_not contain_class('octavia::wsgi::apache')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with step 5 on non-bootstrap node' do
|
context 'with step 5 on non-bootstrap node' do
|
||||||
before do
|
let(:params) { {
|
||||||
params.merge!({ :step => 5 })
|
:step => 5,
|
||||||
end
|
:bootstrap_node => 'other.example.com'
|
||||||
|
} }
|
||||||
|
|
||||||
it 'should do nothing' do
|
it 'should apply configurations without syncing database' do
|
||||||
is_expected.to contain_class('octavia::api').with(:sync_db => false)
|
is_expected.to contain_class('octavia::api').with(:sync_db => false)
|
||||||
|
is_expected.to contain_class('octavia::controller')
|
||||||
is_expected.to contain_class('octavia::healthcheck')
|
is_expected.to contain_class('octavia::healthcheck')
|
||||||
|
is_expected.to contain_class('tripleo::profile::base::apache')
|
||||||
|
is_expected.to contain_class('octavia::wsgi::apache')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'Configure internal TLS' do
|
context 'Configure internal TLS' do
|
||||||
before do
|
let(:params) { {
|
||||||
params.merge!({
|
:step => 5,
|
||||||
:step => 5,
|
:bootstrap_node => 'other.example.com',
|
||||||
:bootstrap_node => 'node.example.com',
|
:enable_internal_tls => true,
|
||||||
:enable_internal_tls => true,
|
:octavia_network => 'octavia-net',
|
||||||
:octavia_network => 'octavia-net',
|
:certificates_specs => {
|
||||||
:certificates_specs => {
|
'httpd-octavia-net' => {
|
||||||
'httpd-octavia-net' => {
|
'hostname' => 'somehost',
|
||||||
'hostname' => 'somehost',
|
'service_certificate' => '/foo.pem',
|
||||||
'service_certificate' => '/foo.pem',
|
'service_key' => '/foo.key',
|
||||||
'service_key' => '/foo.key',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
})
|
},
|
||||||
end
|
} }
|
||||||
|
|
||||||
it {
|
it {
|
||||||
is_expected.to contain_class('octavia::api')
|
is_expected.to contain_class('octavia::api')
|
||||||
|
is_expected.to contain_class('octavia::controller')
|
||||||
is_expected.to contain_class('octavia::healthcheck')
|
is_expected.to contain_class('octavia::healthcheck')
|
||||||
|
is_expected.to contain_class('tripleo::profile::base::apache')
|
||||||
|
is_expected.to contain_class('octavia::wsgi::apache').with(
|
||||||
|
:ssl_cert => '/foo.pem',
|
||||||
|
:ssl_key => '/foo.key',
|
||||||
|
)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,83 @@
|
||||||
|
#
|
||||||
|
# Copyright (C) 2021 Red Hat, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe 'tripleo::profile::base::octavia::health_manager' do
|
||||||
|
|
||||||
|
let :params do
|
||||||
|
{ :step => 5 }
|
||||||
|
end
|
||||||
|
|
||||||
|
shared_examples_for 'tripleo::profile::base::octavia::health_manager' do
|
||||||
|
|
||||||
|
before :each do
|
||||||
|
facts.merge!({ :step => params[:step] })
|
||||||
|
end
|
||||||
|
|
||||||
|
let(:pre_condition) do
|
||||||
|
<<-eos
|
||||||
|
class { 'tripleo::profile::base::octavia' :
|
||||||
|
step => #{params[:step]},
|
||||||
|
oslomsg_rpc_username => 'bugs',
|
||||||
|
oslomsg_rpc_password => 'rabbits_R_c00l',
|
||||||
|
oslomsg_rpc_hosts => ['hole.field.com']
|
||||||
|
}
|
||||||
|
eos
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with step less than 5' do
|
||||||
|
before do
|
||||||
|
params.merge!({ :step => 4 })
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should not do anything' do
|
||||||
|
is_expected.to_not contain_class('octavia::controller')
|
||||||
|
is_expected.to_not contain_class('octavia::nova')
|
||||||
|
is_expected.to_not contain_class('octavia::health_manager')
|
||||||
|
is_expected.to_not contain_class('octavia::certificates')
|
||||||
|
is_expected.to_not contain_class('octavia::neutron')
|
||||||
|
is_expected.to_not contain_class('octavia::glance')
|
||||||
|
is_expected.to_not contain_class('octavia::cinder')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with step 5' do
|
||||||
|
before do
|
||||||
|
params.merge!({ :step => 5 })
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should do the full configuration' do
|
||||||
|
is_expected.to contain_class('octavia::controller')
|
||||||
|
is_expected.to contain_class('octavia::nova')
|
||||||
|
is_expected.to contain_class('octavia::health_manager')
|
||||||
|
is_expected.to contain_class('octavia::certificates')
|
||||||
|
is_expected.to contain_class('octavia::neutron')
|
||||||
|
is_expected.to contain_class('octavia::glance')
|
||||||
|
is_expected.to contain_class('octavia::cinder')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
on_supported_os.each do |os, facts|
|
||||||
|
context "on #{os}" do
|
||||||
|
let(:facts) do
|
||||||
|
facts.merge({})
|
||||||
|
end
|
||||||
|
it_behaves_like 'tripleo::profile::base::octavia::health_manager'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,83 @@
|
||||||
|
#
|
||||||
|
# Copyright (C) 2021 Red Hat, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe 'tripleo::profile::base::octavia::housekeeping' do
|
||||||
|
|
||||||
|
let :params do
|
||||||
|
{ :step => 5 }
|
||||||
|
end
|
||||||
|
|
||||||
|
shared_examples_for 'tripleo::profile::base::octavia::housekeeping' do
|
||||||
|
|
||||||
|
before :each do
|
||||||
|
facts.merge!({ :step => params[:step] })
|
||||||
|
end
|
||||||
|
|
||||||
|
let(:pre_condition) do
|
||||||
|
<<-eos
|
||||||
|
class { 'tripleo::profile::base::octavia' :
|
||||||
|
step => #{params[:step]},
|
||||||
|
oslomsg_rpc_username => 'bugs',
|
||||||
|
oslomsg_rpc_password => 'rabbits_R_c00l',
|
||||||
|
oslomsg_rpc_hosts => ['hole.field.com']
|
||||||
|
}
|
||||||
|
eos
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with step less than 5' do
|
||||||
|
before do
|
||||||
|
params.merge!({ :step => 4 })
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should not do anything' do
|
||||||
|
is_expected.to_not contain_class('octavia::controller')
|
||||||
|
is_expected.to_not contain_class('octavia::nova')
|
||||||
|
is_expected.to_not contain_class('octavia::housekeeping')
|
||||||
|
is_expected.to_not contain_class('octavia::certificates')
|
||||||
|
is_expected.to_not contain_class('octavia::neutron')
|
||||||
|
is_expected.to_not contain_class('octavia::glance')
|
||||||
|
is_expected.to_not contain_class('octavia::cinder')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with step 5' do
|
||||||
|
before do
|
||||||
|
params.merge!({ :step => 5 })
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should do the full configuration' do
|
||||||
|
is_expected.to contain_class('octavia::controller')
|
||||||
|
is_expected.to contain_class('octavia::nova')
|
||||||
|
is_expected.to contain_class('octavia::housekeeping')
|
||||||
|
is_expected.to contain_class('octavia::certificates')
|
||||||
|
is_expected.to contain_class('octavia::neutron')
|
||||||
|
is_expected.to contain_class('octavia::glance')
|
||||||
|
is_expected.to contain_class('octavia::cinder')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
on_supported_os.each do |os, facts|
|
||||||
|
context "on #{os}" do
|
||||||
|
let(:facts) do
|
||||||
|
facts.merge({})
|
||||||
|
end
|
||||||
|
it_behaves_like 'tripleo::profile::base::octavia::housekeeping'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,83 @@
|
||||||
|
#
|
||||||
|
# Copyright (C) 2021 Red Hat, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe 'tripleo::profile::base::octavia::worker' do
|
||||||
|
|
||||||
|
let :params do
|
||||||
|
{ :step => 5 }
|
||||||
|
end
|
||||||
|
|
||||||
|
shared_examples_for 'tripleo::profile::base::octavia::worker' do
|
||||||
|
|
||||||
|
before :each do
|
||||||
|
facts.merge!({ :step => params[:step] })
|
||||||
|
end
|
||||||
|
|
||||||
|
let(:pre_condition) do
|
||||||
|
<<-eos
|
||||||
|
class { 'tripleo::profile::base::octavia' :
|
||||||
|
step => #{params[:step]},
|
||||||
|
oslomsg_rpc_username => 'bugs',
|
||||||
|
oslomsg_rpc_password => 'rabbits_R_c00l',
|
||||||
|
oslomsg_rpc_hosts => ['hole.field.com']
|
||||||
|
}
|
||||||
|
eos
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with step less than 5' do
|
||||||
|
before do
|
||||||
|
params.merge!({ :step => 4 })
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should not do anything' do
|
||||||
|
is_expected.to_not contain_class('octavia::controller')
|
||||||
|
is_expected.to_not contain_class('octavia::nova')
|
||||||
|
is_expected.to_not contain_class('octavia::worker')
|
||||||
|
is_expected.to_not contain_class('octavia::certificates')
|
||||||
|
is_expected.to_not contain_class('octavia::neutron')
|
||||||
|
is_expected.to_not contain_class('octavia::glance')
|
||||||
|
is_expected.to_not contain_class('octavia::cinder')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with step 5' do
|
||||||
|
before do
|
||||||
|
params.merge!({ :step => 5 })
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should do the full configuration' do
|
||||||
|
is_expected.to contain_class('octavia::controller')
|
||||||
|
is_expected.to contain_class('octavia::nova')
|
||||||
|
is_expected.to contain_class('octavia::worker')
|
||||||
|
is_expected.to contain_class('octavia::certificates')
|
||||||
|
is_expected.to contain_class('octavia::neutron')
|
||||||
|
is_expected.to contain_class('octavia::glance')
|
||||||
|
is_expected.to contain_class('octavia::cinder')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
on_supported_os.each do |os, facts|
|
||||||
|
context "on #{os}" do
|
||||||
|
let(:facts) do
|
||||||
|
facts.merge({})
|
||||||
|
end
|
||||||
|
it_behaves_like 'tripleo::profile::base::octavia::worker'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -144,7 +144,9 @@ placement::keystone::authtoken::password: 'password'
|
||||||
memcached_node_names:
|
memcached_node_names:
|
||||||
- 'controller-1'
|
- 'controller-1'
|
||||||
# octavia related items
|
# octavia related items
|
||||||
|
octavia_api_short_bootstrap_node_name: node
|
||||||
octavia::keystone::authtoken::password: 'password'
|
octavia::keystone::authtoken::password: 'password'
|
||||||
|
octavia::health_manager::heartbeat_key: 'key'
|
||||||
# horizon related
|
# horizon related
|
||||||
horizon_short_bootstrap_node_name: node
|
horizon_short_bootstrap_node_name: node
|
||||||
horizon::secret_key: 'secrete'
|
horizon::secret_key: 'secrete'
|
||||||
|
|
Loading…
Reference in New Issue