diff options
Diffstat (limited to 'spec')
40 files changed, 763 insertions, 180 deletions
diff --git a/spec/classes/tripleo_certmonger_rabbitmq.rb b/spec/classes/tripleo_certmonger_rabbitmq.rb new file mode 100644 index 0000000..5c011ce --- /dev/null +++ b/spec/classes/tripleo_certmonger_rabbitmq.rb @@ -0,0 +1,64 @@ +# +# Copyright (C) 2017 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. +# +# Unit tests for tripleo +# + +require 'spec_helper' + +describe 'tripleo::certmonger::rabbitmq' do + + shared_examples_for 'tripleo::certmonger::rabbitmq' do + let :params do + { + :hostname => 'localhost', + :service_certificate => '/etc/pki/cert.crt', + :service_key => '/etc/pki/key.pem', + } + end + + it 'should include the base for using certmonger' do + is_expected.to contain_class('certmonger') + end + + it 'should include the rabbitmq parameters' do + is_expected.to contain_class('rabbitmq::params') + end + + it 'should request a certificate' do + is_expected.to contain_certmonger_certificate('rabbitmq').with( + :ensure => 'present', + :certfile => '/etc/pki/cert.crt', + :keyfile => '/etc/pki/key.pem', + :hostname => 'localhost', + :dnsname => 'localhost', + :ca => 'local', + :wait => true, + ) + is_expected.to contain_file('/etc/pki/cert.crt') + is_expected.to contain_file('/etc/pki/key.pem') + end + end + + on_supported_os.each do |os, facts| + context "on #{os}" do + let(:facts) do + facts.merge({}) + end + + it_behaves_like 'tripleo::certmonger::rabbitmq' + end + end +end diff --git a/spec/classes/tripleo_midonet_agent_spec.rb b/spec/classes/tripleo_midonet_agent_spec.rb deleted file mode 100644 index 73d90b6..0000000 --- a/spec/classes/tripleo_midonet_agent_spec.rb +++ /dev/null @@ -1,58 +0,0 @@ -# -# Copyright (C) 2015 Midokura SARL -# -# 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. -# -# Unit tests for the midonet agent - -require 'spec_helper' - -describe 'tripleo::network::midonet::agent' do - - shared_examples_for 'tripleo::network::midonet::agent' do - - let :params do - { - :zookeeper_servers => ['192.168.2.2', '192.168.2.3'], - :cassandra_seeds => ['192.168.2.2', '192.168.2.3'] - } - end - - it 'should stop openvswitch' do - is_expected.to contain_service('openvswitch').with( - :ensure => 'stopped', - :enable => false - ) - end - - it 'should run the agent with a list of maps' do - is_expected.to contain_class('midonet::midonet_agent').with( - :zk_servers => [{'ip' => '192.168.2.2', - 'port' => 2181}, - {'ip' => '192.168.2.3', - 'port' => 2181}], - :cassandra_seeds => ['192.168.2.2','192.168.2.3'] - ) - end - end - - on_supported_os.each do |os, facts| - context "on #{os}" do - let(:facts) do - facts.merge({}) - end - - it_behaves_like 'tripleo::network::midonet::agent' - end - end -end diff --git a/spec/classes/tripleo_profile_base_aodh_api_spec.rb b/spec/classes/tripleo_profile_base_aodh_api_spec.rb index 22f26cf..f2a26bf 100644 --- a/spec/classes/tripleo_profile_base_aodh_api_spec.rb +++ b/spec/classes/tripleo_profile_base_aodh_api_spec.rb @@ -19,7 +19,7 @@ require 'spec_helper' describe 'tripleo::profile::base::aodh::api' do shared_examples_for 'tripleo::profile::base::aodh::api' do let(:pre_condition) do - "class { '::tripleo::profile::base::aodh': step => #{params[:step]}, rabbit_hosts => ['localhost.localdomain'] }" + "class { '::tripleo::profile::base::aodh': step => #{params[:step]}, oslomsg_rpc_hosts => ['localhost.localdomain'] }" end context 'with step less than 4' do diff --git a/spec/classes/tripleo_profile_base_aodh_evaluator_spec.rb b/spec/classes/tripleo_profile_base_aodh_evaluator_spec.rb index 495794d..ce8869e 100644 --- a/spec/classes/tripleo_profile_base_aodh_evaluator_spec.rb +++ b/spec/classes/tripleo_profile_base_aodh_evaluator_spec.rb @@ -19,7 +19,7 @@ require 'spec_helper' describe 'tripleo::profile::base::aodh::evaluator' do shared_examples_for 'tripleo::profile::base::aodh::evaluator' do let(:pre_condition) do - "class { '::tripleo::profile::base::aodh': step => #{params[:step]}, rabbit_hosts => ['localhost.localdomain'] }" + "class { '::tripleo::profile::base::aodh': step => #{params[:step]}, oslomsg_rpc_hosts => ['localhost.localdomain'] }" end context 'with step less than 4' do diff --git a/spec/classes/tripleo_profile_base_aodh_listener_spec.rb b/spec/classes/tripleo_profile_base_aodh_listener_spec.rb index 022ee5c..47f363e 100644 --- a/spec/classes/tripleo_profile_base_aodh_listener_spec.rb +++ b/spec/classes/tripleo_profile_base_aodh_listener_spec.rb @@ -19,7 +19,7 @@ require 'spec_helper' describe 'tripleo::profile::base::aodh::listener' do shared_examples_for 'tripleo::profile::base::aodh::listener' do let(:pre_condition) do - "class { '::tripleo::profile::base::aodh': step => #{params[:step]}, rabbit_hosts => ['localhost.localdomain'] }" + "class { '::tripleo::profile::base::aodh': step => #{params[:step]}, oslomsg_rpc_hosts => ['localhost.localdomain'] }" end context 'with step less than 4' do diff --git a/spec/classes/tripleo_profile_base_aodh_notifier_spec.rb b/spec/classes/tripleo_profile_base_aodh_notifier_spec.rb index f2116ca..6c16615 100644 --- a/spec/classes/tripleo_profile_base_aodh_notifier_spec.rb +++ b/spec/classes/tripleo_profile_base_aodh_notifier_spec.rb @@ -19,7 +19,7 @@ require 'spec_helper' describe 'tripleo::profile::base::aodh::notifier' do shared_examples_for 'tripleo::profile::base::aodh::notifier' do let(:pre_condition) do - "class { '::tripleo::profile::base::aodh': step => #{params[:step]}, rabbit_hosts => ['localhost.localdomain'] }" + "class { '::tripleo::profile::base::aodh': step => #{params[:step]}, oslomsg_rpc_hosts => ['localhost.localdomain'] }" end context 'with step less than 4' do diff --git a/spec/classes/tripleo_profile_base_aodh_spec.rb b/spec/classes/tripleo_profile_base_aodh_spec.rb index 3befa23..7ef49ec 100644 --- a/spec/classes/tripleo_profile_base_aodh_spec.rb +++ b/spec/classes/tripleo_profile_base_aodh_spec.rb @@ -34,12 +34,14 @@ describe 'tripleo::profile::base::aodh' do let(:params) { { :step => 3, :bootstrap_node => 'node.example.com', - :rabbit_hosts => ['localhost1.localdomain', 'localhost2.localdomain'] + :oslomsg_rpc_hosts => [ '127.0.0.1' ], + :oslomsg_rpc_username => 'aodh', + :oslomsg_rpc_password => 'foo', } } it 'should trigger complete configuration' do is_expected.to contain_class('aodh').with( - :rabbit_hosts => params[:rabbit_hosts].map { |h| h + ":5672" } + :default_transport_url => 'rabbit://aodh:foo@127.0.0.1:5672/?ssl=0' ) is_expected.to contain_class('aodh::auth') is_expected.to contain_class('aodh::config') @@ -67,12 +69,14 @@ describe 'tripleo::profile::base::aodh' do let(:params) { { :step => 4, :bootstrap_node => 'somethingelse.example.com', - :rabbit_hosts => ['localhost1.localdomain', 'localhost2.localdomain'] + :oslomsg_rpc_hosts => [ '127.0.0.1' ], + :oslomsg_rpc_username => 'aodh', + :oslomsg_rpc_password => 'foo', } } it 'should trigger aodh configuration without mysql grant' do is_expected.to contain_class('aodh').with( - :rabbit_hosts => params[:rabbit_hosts].map { |h| h + ":5672" } + :default_transport_url => 'rabbit://aodh:foo@127.0.0.1:5672/?ssl=0' ) is_expected.to contain_class('aodh::auth') is_expected.to contain_class('aodh::config') diff --git a/spec/classes/tripleo_profile_base_ceilometer_agent_polling_spec.rb b/spec/classes/tripleo_profile_base_ceilometer_agent_polling_spec.rb new file mode 100644 index 0000000..38c94c6 --- /dev/null +++ b/spec/classes/tripleo_profile_base_ceilometer_agent_polling_spec.rb @@ -0,0 +1,72 @@ +# +# Copyright (C) 2016 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::ceilometer::agent::polling' do + shared_examples_for 'tripleo::profile::base::ceilometer::agent::polling' do + before :each do + facts.merge!({ :step => params[:step] }) + end + + let(:pre_condition) do + "class { '::tripleo::profile::base::ceilometer': step => #{params[:step]}, oslomsg_rpc_hosts => ['localhost.localdomain'] }" + end + + context 'with step less than 4' do + let(:params) { { :step => 3 } } + + it 'should do nothing' do + is_expected.to contain_class('tripleo::profile::base::ceilometer::agent::polling') + is_expected.to_not contain_class('ceilometer::agent::polling') + end + end + + context 'with step 4 on polling agent' do + + let(:pre_condition) do + "class { '::ceilometer::agent::auth': auth_password => 'password' }" + end + + let(:params) { { + :step => 4, + :ceilometer_redis_password => 'password', + :redis_vip => '127.0.0.1', + :central_namespace => true + } } + + it 'should trigger complete configuration' do + is_expected.to contain_class('ceilometer::agent::polling').with( + :central_namespace => true, + :compute_namespace => false, + :ipmi_namespace => false, + :coordination_url => 'redis://:password@127.0.0.1:6379/', + ) + end + end + end + + + on_supported_os.each do |os, facts| + context "on #{os}" do + let(:facts) do + facts.merge({ :hostname => 'node.example.com' }) + end + + it_behaves_like 'tripleo::profile::base::ceilometer::agent::polling' + end + end +end diff --git a/spec/classes/tripleo_profile_base_ceilometer_api_spec.rb b/spec/classes/tripleo_profile_base_ceilometer_api_spec.rb index acc9b51..936df4f 100644 --- a/spec/classes/tripleo_profile_base_ceilometer_api_spec.rb +++ b/spec/classes/tripleo_profile_base_ceilometer_api_spec.rb @@ -19,7 +19,7 @@ require 'spec_helper' describe 'tripleo::profile::base::ceilometer::api' do shared_examples_for 'tripleo::profile::base::ceilometer::api' do let(:pre_condition) do - "class { '::tripleo::profile::base::ceilometer': step => #{params[:step]}, rabbit_hosts => ['localhost.localdomain'] }" + "class { '::tripleo::profile::base::ceilometer': step => #{params[:step]}, oslomsg_rpc_hosts => ['localhost.localdomain'] }" end context 'with step less than 4' do diff --git a/spec/classes/tripleo_profile_base_ceilometer_collector_spec.rb b/spec/classes/tripleo_profile_base_ceilometer_collector_spec.rb index 2e4b50a..23b198a 100644 --- a/spec/classes/tripleo_profile_base_ceilometer_collector_spec.rb +++ b/spec/classes/tripleo_profile_base_ceilometer_collector_spec.rb @@ -19,7 +19,7 @@ require 'spec_helper' describe 'tripleo::profile::base::ceilometer::collector' do shared_examples_for 'tripleo::profile::base::ceilometer::collector' do let(:pre_condition) do - "class { '::tripleo::profile::base::ceilometer': step => #{params[:step]}, rabbit_hosts => ['localhost.localdomain'] }" + "class { '::tripleo::profile::base::ceilometer': step => #{params[:step]}, oslomsg_rpc_hosts => ['localhost.localdomain'] }" end context 'with step 3 on bootstrap node with mongodb' do diff --git a/spec/classes/tripleo_profile_base_ceilometer_expirer_spec.rb b/spec/classes/tripleo_profile_base_ceilometer_expirer_spec.rb index c13f3c8..b1567d0 100644 --- a/spec/classes/tripleo_profile_base_ceilometer_expirer_spec.rb +++ b/spec/classes/tripleo_profile_base_ceilometer_expirer_spec.rb @@ -19,7 +19,7 @@ require 'spec_helper' describe 'tripleo::profile::base::ceilometer::expirer' do shared_examples_for 'tripleo::profile::base::ceilometer::expirer' do let(:pre_condition) do - "class { '::tripleo::profile::base::ceilometer': step => #{params[:step]}, rabbit_hosts => ['localhost.localdomain'] }" + "class { '::tripleo::profile::base::ceilometer': step => #{params[:step]}, oslomsg_rpc_hosts => ['localhost.localdomain'] }" end context 'with step less than 4' do diff --git a/spec/classes/tripleo_profile_base_ceilometer_spec.rb b/spec/classes/tripleo_profile_base_ceilometer_spec.rb index 075aff8..9173203 100644 --- a/spec/classes/tripleo_profile_base_ceilometer_spec.rb +++ b/spec/classes/tripleo_profile_base_ceilometer_spec.rb @@ -30,12 +30,14 @@ describe 'tripleo::profile::base::ceilometer' do context 'with step 3' do let(:params) { { :step => 3, - :rabbit_hosts => ['localhost1.localdomain', 'localhost2.localdomain'] + :oslomsg_rpc_hosts => [ '127.0.0.1' ], + :oslomsg_rpc_username => 'ceilometer', + :oslomsg_rpc_password => 'foo', } } it 'should trigger complete configuration' do is_expected.to contain_class('ceilometer').with( - :rabbit_hosts => params[:rabbit_hosts].map{ |h| h + ':5672' } + :default_transport_url => 'rabbit://ceilometer:foo@127.0.0.1:5672/?ssl=0' ) is_expected.to contain_class('ceilometer::config') end diff --git a/spec/classes/tripleo_profile_base_cinder_api_spec.rb b/spec/classes/tripleo_profile_base_cinder_api_spec.rb index 6a36632..03e2fd0 100644 --- a/spec/classes/tripleo_profile_base_cinder_api_spec.rb +++ b/spec/classes/tripleo_profile_base_cinder_api_spec.rb @@ -19,7 +19,7 @@ require 'spec_helper' describe 'tripleo::profile::base::cinder::api' do shared_examples_for 'tripleo::profile::base::cinder::api' do let(:pre_condition) do - "class { '::tripleo::profile::base::cinder': step => #{params[:step]}, rabbit_hosts => ['127.0.0.1'] }" + "class { '::tripleo::profile::base::cinder': step => #{params[:step]}, oslomsg_rpc_hosts => ['127.0.0.1'] }" end context 'with step less than 3' do diff --git a/spec/classes/tripleo_profile_base_cinder_backup_ceph_spec.rb b/spec/classes/tripleo_profile_base_cinder_backup_ceph_spec.rb index 46c3d15..2f90692 100644 --- a/spec/classes/tripleo_profile_base_cinder_backup_ceph_spec.rb +++ b/spec/classes/tripleo_profile_base_cinder_backup_ceph_spec.rb @@ -20,7 +20,7 @@ describe 'tripleo::profile::base::cinder::backup::ceph' do shared_examples_for 'tripleo::profile::base::cinder::backup::ceph' do let(:pre_condition) do <<-EOF - class { '::tripleo::profile::base::cinder': step => #{params[:step]}, rabbit_hosts => ['127.0.0.1'] } + class { '::tripleo::profile::base::cinder': step => #{params[:step]}, oslomsg_rpc_hosts => ['127.0.0.1'] } class { '::tripleo::profile::base::cinder::backup': step => #{params[:step]} } EOF end diff --git a/spec/classes/tripleo_profile_base_cinder_backup_spec.rb b/spec/classes/tripleo_profile_base_cinder_backup_spec.rb index 0e15c9a..ad5a277 100644 --- a/spec/classes/tripleo_profile_base_cinder_backup_spec.rb +++ b/spec/classes/tripleo_profile_base_cinder_backup_spec.rb @@ -19,7 +19,7 @@ require 'spec_helper' describe 'tripleo::profile::base::cinder::backup' do shared_examples_for 'tripleo::profile::base::cinder::backup' do let(:pre_condition) do - "class { '::tripleo::profile::base::cinder': step => #{params[:step]}, rabbit_hosts => ['127.0.0.1'] }" + "class { '::tripleo::profile::base::cinder': step => #{params[:step]}, oslomsg_rpc_hosts => ['127.0.0.1'] }" end context 'with step less than 4' do diff --git a/spec/classes/tripleo_profile_base_cinder_backup_swift_spec.rb b/spec/classes/tripleo_profile_base_cinder_backup_swift_spec.rb index 2c9d71f..230d766 100644 --- a/spec/classes/tripleo_profile_base_cinder_backup_swift_spec.rb +++ b/spec/classes/tripleo_profile_base_cinder_backup_swift_spec.rb @@ -20,7 +20,7 @@ describe 'tripleo::profile::base::cinder::backup::swift' do shared_examples_for 'tripleo::profile::base::cinder::backup::swift' do let(:pre_condition) do <<-EOF - class { '::tripleo::profile::base::cinder': step => #{params[:step]}, rabbit_hosts => ['127.0.0.1'] } + class { '::tripleo::profile::base::cinder': step => #{params[:step]}, oslomsg_rpc_hosts => ['127.0.0.1'] } class { '::tripleo::profile::base::cinder::backup': step => #{params[:step]} } EOF end diff --git a/spec/classes/tripleo_profile_base_cinder_scaleio_spec.rb b/spec/classes/tripleo_profile_base_cinder_scaleio_spec.rb new file mode 100644 index 0000000..0f12b0a --- /dev/null +++ b/spec/classes/tripleo_profile_base_cinder_scaleio_spec.rb @@ -0,0 +1,58 @@ +# +# Copyright (C) 2016 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::cinder::volume::scaleio' do + shared_examples_for 'tripleo::profile::base::cinder::volume::scaleio' do + before :each do + facts.merge!({ :step => params[:step] }) + end + + context 'with step less than 4' do + let(:params) { { :step => 3 } } + + it 'should do nothing' do + is_expected.to contain_class('tripleo::profile::base::cinder::volume::scaleio') + is_expected.to contain_class('tripleo::profile::base::cinder::volume') + is_expected.to contain_class('tripleo::profile::base::cinder') + is_expected.to_not contain_cinder__backend__scaleio('tripleo_scaleio') + end + end + + context 'with step 4' do + let(:params) { { + :step => 4, + } } + + it 'should trigger complete configuration' do + # TODO(aschultz): check hiera parameters + is_expected.to contain_cinder__backend__scaleio('tripleo_scaleio') + end + end + end + + + on_supported_os.each do |os, facts| + context "on #{os}" do + let(:facts) do + facts.merge({ :hostname => 'node.example.com' }) + end + + it_behaves_like 'tripleo::profile::base::cinder::volume::scaleio' + end + end +end diff --git a/spec/classes/tripleo_profile_base_cinder_scheduler_spec.rb b/spec/classes/tripleo_profile_base_cinder_scheduler_spec.rb index cd044ee..0333b1f 100644 --- a/spec/classes/tripleo_profile_base_cinder_scheduler_spec.rb +++ b/spec/classes/tripleo_profile_base_cinder_scheduler_spec.rb @@ -19,7 +19,7 @@ require 'spec_helper' describe 'tripleo::profile::base::cinder::scheduler' do shared_examples_for 'tripleo::profile::base::cinder::scheduler' do let(:pre_condition) do - "class { '::tripleo::profile::base::cinder': step => #{params[:step]}, rabbit_hosts => ['127.0.0.1'] }" + "class { '::tripleo::profile::base::cinder': step => #{params[:step]}, oslomsg_rpc_hosts => ['127.0.0.1'] }" end context 'with step less than 4' do diff --git a/spec/classes/tripleo_profile_base_cinder_spec.rb b/spec/classes/tripleo_profile_base_cinder_spec.rb index 81fa047..d22357d 100644 --- a/spec/classes/tripleo_profile_base_cinder_spec.rb +++ b/spec/classes/tripleo_profile_base_cinder_spec.rb @@ -31,15 +31,17 @@ describe 'tripleo::profile::base::cinder' do context 'with step 3 on bootstrap node' do let(:params) { { - :step => 3, - :bootstrap_node => 'node.example.com', - :rabbit_hosts => ['127.0.0.1', '127.0.0.2'], - :rabbit_port => '1234' + :step => 3, + :bootstrap_node => 'node.example.com', + :oslomsg_rpc_hosts => [ '127.0.0.1' ], + :oslomsg_rpc_username => 'cinder', + :oslomsg_rpc_password => 'foo', + :oslomsg_rpc_port => '1234' } } it 'should trigger complete configuration' do is_expected.to contain_class('cinder').with( - :rabbit_hosts => params[:rabbit_hosts].map{ |h| "#{h}:#{params[:rabbit_port]}" } + :default_transport_url => 'rabbit://cinder:foo@127.0.0.1:1234/?ssl=0' ) is_expected.to contain_class('cinder::config') is_expected.to contain_class('cinder::glance') @@ -63,15 +65,17 @@ describe 'tripleo::profile::base::cinder' do context 'with step 4 on other node' do let(:params) { { - :step => 4, - :bootstrap_node => 'somethingelse.example.com', - :rabbit_hosts => ['127.0.0.1', '127.0.0.2'], - :rabbit_port => '5672' + :step => 4, + :bootstrap_node => 'somethingelse.example.com', + :oslomsg_rpc_hosts => [ '127.0.0.1' ], + :oslomsg_rpc_username => 'cinder', + :oslomsg_rpc_password => 'foo', + :oslomsg_rpc_port => '5672', } } it 'should trigger cinder configuration without mysql grant' do is_expected.to contain_class('cinder').with( - :rabbit_hosts => params[:rabbit_hosts].map{ |h| "#{h}:#{params[:rabbit_port]}" } + :default_transport_url => 'rabbit://cinder:foo@127.0.0.1:5672/?ssl=0' ) is_expected.to contain_class('cinder::config') is_expected.to contain_class('cinder::glance') @@ -81,14 +85,16 @@ describe 'tripleo::profile::base::cinder' do context 'with step 5' do let(:params) { { - :step => 5, - :bootstrap_node => 'node.example.com', - :rabbit_hosts => ['127.0.0.1', '127.0.0.2'] + :step => 5, + :bootstrap_node => 'node.example.com', + :oslomsg_rpc_hosts => [ '127.0.0.1' ], + :oslomsg_rpc_username => 'cinder', + :oslomsg_rpc_password => 'foo', } } it 'should trigger complete configuration' do is_expected.to contain_class('cinder').with( - :rabbit_hosts => params[:rabbit_hosts].map{ |h| "#{h}:5672" } + :default_transport_url => 'rabbit://cinder:foo@127.0.0.1:5672/?ssl=0' ) is_expected.to contain_class('cinder::config') is_expected.to contain_class('cinder::glance') @@ -98,15 +104,17 @@ describe 'tripleo::profile::base::cinder' do context 'with step 5 without db_purge' do let(:params) { { - :step => 5, - :bootstrap_node => 'node.example.com', - :rabbit_hosts => ['127.0.0.1', '127.0.0.2'], + :step => 5, + :bootstrap_node => 'node.example.com', + :oslomsg_rpc_hosts => [ '127.0.0.1' ], + :oslomsg_rpc_username => 'cinder', + :oslomsg_rpc_password => 'foo', :cinder_enable_db_purge => false } } it 'should trigger complete configuration' do is_expected.to contain_class('cinder').with( - :rabbit_hosts => params[:rabbit_hosts].map{ |h| "#{h}:5672" } + :default_transport_url => 'rabbit://cinder:foo@127.0.0.1:5672/?ssl=0' ) is_expected.to contain_class('cinder::config') is_expected.to contain_class('cinder::glance') diff --git a/spec/classes/tripleo_profile_base_cinder_volume_eqlx_spec.rb b/spec/classes/tripleo_profile_base_cinder_volume_dellps_spec.rb index 1a188aa..313b87c 100644 --- a/spec/classes/tripleo_profile_base_cinder_volume_eqlx_spec.rb +++ b/spec/classes/tripleo_profile_base_cinder_volume_dellps_spec.rb @@ -16,8 +16,8 @@ require 'spec_helper' -describe 'tripleo::profile::base::cinder::volume::eqlx' do - shared_examples_for 'tripleo::profile::base::cinder::volume::eqlx' do +describe 'tripleo::profile::base::cinder::volume::dellps' do + shared_examples_for 'tripleo::profile::base::cinder::volume::dellps' do before :each do facts.merge!({ :step => params[:step] }) end @@ -26,10 +26,10 @@ describe 'tripleo::profile::base::cinder::volume::eqlx' do let(:params) { { :step => 3 } } it 'should do nothing' do - is_expected.to contain_class('tripleo::profile::base::cinder::volume::eqlx') + is_expected.to contain_class('tripleo::profile::base::cinder::volume::dellps') is_expected.to contain_class('tripleo::profile::base::cinder::volume') is_expected.to contain_class('tripleo::profile::base::cinder') - is_expected.to_not contain_cinder__backend__eqlx('tripleo_eqlx') + is_expected.to_not contain_cinder__backend__eqlx('tripleo_dellps') end end @@ -40,7 +40,7 @@ describe 'tripleo::profile::base::cinder::volume::eqlx' do it 'should trigger complete configuration' do # TODO(aschultz): check hiera parameters - is_expected.to contain_cinder__backend__eqlx('tripleo_eqlx') + is_expected.to contain_cinder__backend__eqlx('tripleo_dellps') end end end @@ -52,7 +52,7 @@ describe 'tripleo::profile::base::cinder::volume::eqlx' do facts.merge({ :hostname => 'node.example.com' }) end - it_behaves_like 'tripleo::profile::base::cinder::volume::eqlx' + it_behaves_like 'tripleo::profile::base::cinder::volume::dellps' end end end diff --git a/spec/classes/tripleo_profile_base_cinder_volume_spec.rb b/spec/classes/tripleo_profile_base_cinder_volume_spec.rb index e0ec9de..1542a49 100644 --- a/spec/classes/tripleo_profile_base_cinder_volume_spec.rb +++ b/spec/classes/tripleo_profile_base_cinder_volume_spec.rb @@ -1,3 +1,4 @@ +# coding: utf-8 # # Copyright (C) 2016 Red Hat, Inc. # @@ -27,7 +28,7 @@ describe 'tripleo::profile::base::cinder::volume' do end let(:pre_condition) do - "class { '::tripleo::profile::base::cinder': step => #{params[:step]}, rabbit_hosts => ['127.0.0.1'] }" + "class { '::tripleo::profile::base::cinder': step => #{params[:step]}, oslomsg_rpc_hosts => ['127.0.0.1'] }" end context 'with step less than 4' do @@ -74,21 +75,21 @@ describe 'tripleo::profile::base::cinder::volume' do end end - context 'with only eqlx' do + context 'with only dellps' do before :each do params.merge!({ - :cinder_enable_eqlx_backend => true, + :cinder_enable_dellps_backend => true, :cinder_enable_iscsi_backend => false, }) end - it 'should configure only eqlx' do - is_expected.to contain_class('tripleo::profile::base::cinder::volume::eqlx') + it 'should configure only dellps' do + is_expected.to contain_class('tripleo::profile::base::cinder::volume::dellps') is_expected.to_not contain_class('tripleo::profile::base::cinder::volume::iscsi') is_expected.to contain_class('tripleo::profile::base::cinder::volume') is_expected.to contain_class('tripleo::profile::base::cinder') is_expected.to contain_class('cinder::volume') is_expected.to contain_class('cinder::backends').with( - :enabled_backends => ['tripleo_eqlx'] + :enabled_backends => ['tripleo_dellps'] ) end end @@ -160,7 +161,7 @@ describe 'tripleo::profile::base::cinder::volume' do it 'should configure only user backend' do is_expected.to_not contain_class('tripleo::profile::base::cinder::volume::iscsi') is_expected.to_not contain_class('tripleo::profile::base::cinder::volume::dellsc') - is_expected.to_not contain_class('tripleo::profile::base::cinder::volume::eqlx') + is_expected.to_not contain_class('tripleo::profile::base::cinder::volume::dellps') is_expected.to_not contain_class('tripleo::profile::base::cinder::volume::netapp') is_expected.to_not contain_class('tripleo::profile::base::cinder::volume::nfs') is_expected.to_not contain_class('tripleo::profile::base::cinder::volume::rbd') @@ -178,7 +179,7 @@ describe 'tripleo::profile::base::cinder::volume' do params.merge!({ :cinder_enable_iscsi_backend => true, :cinder_enable_dellsc_backend => true, - :cinder_enable_eqlx_backend => true, + :cinder_enable_dellps_backend => true, :cinder_enable_netapp_backend => true, :cinder_enable_nfs_backend => true, :cinder_enable_rbd_backend => true, @@ -187,7 +188,7 @@ describe 'tripleo::profile::base::cinder::volume' do it 'should configure all backends' do is_expected.to contain_class('tripleo::profile::base::cinder::volume::iscsi') is_expected.to contain_class('tripleo::profile::base::cinder::volume::dellsc') - is_expected.to contain_class('tripleo::profile::base::cinder::volume::eqlx') + is_expected.to contain_class('tripleo::profile::base::cinder::volume::dellps') is_expected.to contain_class('tripleo::profile::base::cinder::volume::netapp') is_expected.to contain_class('tripleo::profile::base::cinder::volume::nfs') is_expected.to contain_class('tripleo::profile::base::cinder::volume::rbd') @@ -195,7 +196,7 @@ describe 'tripleo::profile::base::cinder::volume' do is_expected.to contain_class('tripleo::profile::base::cinder') is_expected.to contain_class('cinder::volume') is_expected.to contain_class('cinder::backends').with( - :enabled_backends => ['tripleo_iscsi', 'tripleo_ceph', 'tripleo_eqlx', + :enabled_backends => ['tripleo_iscsi', 'tripleo_ceph', 'tripleo_dellps', 'tripleo_dellsc', 'tripleo_netapp','tripleo_nfs'] ) end diff --git a/spec/classes/tripleo_profile_base_docker_spec.rb b/spec/classes/tripleo_profile_base_docker_spec.rb new file mode 100644 index 0000000..587cc29 --- /dev/null +++ b/spec/classes/tripleo_profile_base_docker_spec.rb @@ -0,0 +1,68 @@ +# Copyright 2016 Red Hat, Inc. +# All Rights Reserved. +# +# 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::docker' do + shared_examples_for 'tripleo::profile::base::docker' do + context 'with step 1 and defaults' do + let(:params) { { + :step => 1, + } } + + it { is_expected.to contain_class('tripleo::profile::base::docker') } + it { is_expected.to contain_package('docker') } + it { is_expected.to contain_service('docker') } + it { + is_expected.to contain_augeas('docker-sysconfig').with_changes(['rm INSECURE_REGISTRY']) + } + end + + context 'with step 1 and insecure_registry configured' do + let(:params) { { + :docker_namespace => 'foo:8787', + :insecure_registry => true, + :step => 1, + } } + + it { is_expected.to contain_class('tripleo::profile::base::docker') } + it { is_expected.to contain_package('docker') } + it { is_expected.to contain_service('docker') } + it { + is_expected.to contain_augeas('docker-sysconfig').with_changes(["set INSECURE_REGISTRY '\"--insecure-registry foo:8787\"'"]) + } + end + + context 'with step 1 and insecure_registry configured but no docker_namespace' do + let(:params) { { + :insecure_registry => true, + :step => 1, + } } + + it_raises 'a Puppet::Error', /You must provide a \$docker_namespace in order to configure insecure registry/ + end + end + + on_supported_os.each do |os, facts| + context "on #{os}" do + let(:facts) do + facts.merge({ :hostname => 'node.example.com' }) + end + + it_behaves_like 'tripleo::profile::base::docker' + end + end +end diff --git a/spec/classes/tripleo_profile_base_neutron_spec.rb b/spec/classes/tripleo_profile_base_neutron_spec.rb new file mode 100644 index 0000000..504be5b --- /dev/null +++ b/spec/classes/tripleo_profile_base_neutron_spec.rb @@ -0,0 +1,76 @@ +# +# Copyright (C) 2016 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::neutron' do + let :params do + { :step => 5, + :oslomsg_notify_password => 'foobar', + :oslomsg_rpc_password => 'foobar' + } + end + + shared_examples_for 'tripleo::profile::base::neutron' do + before :each do + facts.merge!({ :step => params[:step] }) + end + + context 'when no dhcp agents per network set' do + before do + params.merge!({ + :dhcp_nodes => ['netcont1.localdomain', 'netcont2.localdomain', 'netcont3.localdomain'] + }) + end + it 'should equal the number of dhcp agents' do + is_expected.to contain_class('neutron').with(:dhcp_agents_per_network => 3) + end + end + + context 'when dhcp agents per network is set' do + before do + params.merge!({ + :dhcp_agents_per_network => 2 + }) + end + it 'should set the the value' do + is_expected.to contain_class('neutron').with(:dhcp_agents_per_network => 2) + end + end + + context 'when dhcp agents per network is greater than number of agents' do + before do + params.merge!({ + :dhcp_nodes => ['netcont1.localdomain', 'netcont2.localdomain'], + :dhcp_agents_per_network => 5 + }) + end + it 'should set value and complain about not enough agents' do + is_expected.to contain_class('neutron').with(:dhcp_agents_per_network => 5) + end + end + end + + on_supported_os.each do |os, facts| + context "on #{os}" do + let(:facts) do + facts.merge({ :hostname => 'node.example.com' }) + end + + it_behaves_like 'tripleo::profile::base::neutron' + end + end +end diff --git a/spec/classes/tripleo_profile_base_nova_api_spec.rb b/spec/classes/tripleo_profile_base_nova_api_spec.rb index f930342..3a2a685 100644 --- a/spec/classes/tripleo_profile_base_nova_api_spec.rb +++ b/spec/classes/tripleo_profile_base_nova_api_spec.rb @@ -22,9 +22,12 @@ describe 'tripleo::profile::base::nova::api' do <<-eos class { '::tripleo::profile::base::nova': step => #{params[:step]}, - messaging_hosts => [ 'localhost' ], - messaging_username => 'nova', - messaging_password => 'foo' + oslomsg_rpc_hosts => [ 'localhost' ], + oslomsg_rpc_username => 'nova', + oslomsg_rpc_password => 'foo' + } + class { '::tripleo::profile::base::nova::authtoken': + step => #{params[:step]}, } eos end @@ -56,25 +59,25 @@ eos is_expected.to contain_class('nova::cell_v2::simple_setup') is_expected.to contain_class('nova::keystone::authtoken') is_expected.to contain_class('nova::api') - is_expected.to contain_class('nova::wsgi::apache_api') + is_expected.to_not contain_class('nova::wsgi::apache_api') is_expected.to contain_class('nova::network::neutron') } end - context 'with step 3 not on bootstrap node' do + context 'with step 3 on bootstrap node' do let(:params) { { - :step => 3, - :bootstrap_node => 'other.example.com', + :step => 3, + :bootstrap_node => 'node.example.com', } } it { is_expected.to contain_class('tripleo::profile::base::nova::api') is_expected.to contain_class('tripleo::profile::base::nova') - is_expected.to_not contain_class('nova::db::sync_cell_v2') - is_expected.to_not contain_class('nova::keystone::authtoken') - is_expected.to_not contain_class('nova::api') + is_expected.to contain_class('nova::cell_v2::simple_setup') + is_expected.to contain_class('nova::keystone::authtoken') + is_expected.to contain_class('nova::api') is_expected.to_not contain_class('nova::wsgi::apache_api') - is_expected.to_not contain_class('nova::network::neutron') + is_expected.to contain_class('nova::network::neutron') } end @@ -88,6 +91,24 @@ eos is_expected.to_not contain_class('nova::db::sync_cell_v2') is_expected.to contain_class('nova::keystone::authtoken') is_expected.to contain_class('nova::api') + is_expected.to_not contain_class('nova::wsgi::apache_api') + is_expected.to contain_class('nova::network::neutron') + } + end + + context 'with step 4 not on bootstrap node' do + let(:params) { { + :step => 4, + :bootstrap_node => 'other.example.com', + :nova_api_wsgi_enabled => true, + } } + + it { + is_expected.to contain_class('tripleo::profile::base::nova::api') + is_expected.to contain_class('tripleo::profile::base::nova') + is_expected.to_not contain_class('nova::db::sync_cell_v2') + is_expected.to contain_class('nova::keystone::authtoken') + is_expected.to contain_class('nova::api') is_expected.to contain_class('nova::wsgi::apache_api') is_expected.to contain_class('nova::network::neutron') } diff --git a/spec/classes/tripleo_profile_base_nova_authtoken_spec.rb b/spec/classes/tripleo_profile_base_nova_authtoken_spec.rb new file mode 100644 index 0000000..f910729 --- /dev/null +++ b/spec/classes/tripleo_profile_base_nova_authtoken_spec.rb @@ -0,0 +1,69 @@ +# +# Copyright (C) 2017 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::nova::authtoken' do + shared_examples_for 'tripleo::profile::base::nova::authtoken' do + context 'with step less than 3' do + let(:params) { { + :step => 1, + } } + + it { + is_expected.to contain_class('tripleo::profile::base::nova::authtoken') + is_expected.to_not contain_class('nova::keystone::authtoken') + } + end + + context 'with step 3' do + let(:params) { { + :step => 3, + } } + + it { + is_expected.to contain_class('tripleo::profile::base::nova::authtoken') + is_expected.to contain_class('nova::keystone::authtoken').with( + :memcached_servers => ['127.0.0.1:11211']) + } + end + + context 'with step 3 with ipv6' do + let(:params) { { + :step => 3, + :use_ipv6 => true, + } } + + it { + is_expected.to contain_class('tripleo::profile::base::nova::authtoken') + is_expected.to contain_class('nova::keystone::authtoken').with( + :memcached_servers => ['[::1]:11211']) + } + end + + end + + + on_supported_os.each do |os, facts| + context "on #{os}" do + let(:facts) do + facts.merge({ :hostname => 'node.example.com' }) + end + + it_behaves_like 'tripleo::profile::base::nova::authtoken' + end + end +end diff --git a/spec/classes/tripleo_profile_base_nova_compute_ironic_spec.rb b/spec/classes/tripleo_profile_base_nova_compute_ironic_spec.rb index 2155695..e916b41 100644 --- a/spec/classes/tripleo_profile_base_nova_compute_ironic_spec.rb +++ b/spec/classes/tripleo_profile_base_nova_compute_ironic_spec.rb @@ -35,7 +35,7 @@ describe 'tripleo::profile::base::nova::compute::ironic' do <<-eos class { '::tripleo::profile::base::nova': step => #{params[:step]}, - messaging_hosts => [ '127.0.0.1' ], + oslomsg_rpc_hosts => [ '127.0.0.1' ], } class { '::tripleo::profile::base::nova::compute': step => #{params[:step]}, diff --git a/spec/classes/tripleo_profile_base_nova_compute_libvirt_spec.rb b/spec/classes/tripleo_profile_base_nova_compute_libvirt_spec.rb index 0b33123..32482a9 100644 --- a/spec/classes/tripleo_profile_base_nova_compute_libvirt_spec.rb +++ b/spec/classes/tripleo_profile_base_nova_compute_libvirt_spec.rb @@ -36,7 +36,7 @@ describe 'tripleo::profile::base::nova::compute::libvirt' do <<-eos class { '::tripleo::profile::base::nova': step => #{params[:step]}, - messaging_hosts => [ '127.0.0.1' ], + oslomsg_rpc_hosts => [ '127.0.0.1' ], } class { '::tripleo::profile::base::nova::compute': step => #{params[:step]}, diff --git a/spec/classes/tripleo_profile_base_nova_compute_spec.rb b/spec/classes/tripleo_profile_base_nova_compute_spec.rb index a0b2387..d052682 100644 --- a/spec/classes/tripleo_profile_base_nova_compute_spec.rb +++ b/spec/classes/tripleo_profile_base_nova_compute_spec.rb @@ -19,7 +19,7 @@ require 'spec_helper' describe 'tripleo::profile::base::nova::compute' do shared_examples_for 'tripleo::profile::base::nova::compute' do - context 'with step less than 4' do + context 'with step less than 5' do let(:params) { { :step => 1, } } it { @@ -32,12 +32,12 @@ describe 'tripleo::profile::base::nova::compute' do } end - context 'with step 4' do + context 'with step 5' do let(:pre_condition) do <<-eos class { '::tripleo::profile::base::nova': step => #{params[:step]}, - messaging_hosts => [ '127.0.0.1' ], + oslomsg_rpc_hosts => [ '127.0.0.1' ], } eos end diff --git a/spec/classes/tripleo_profile_base_nova_conductor_spec.rb b/spec/classes/tripleo_profile_base_nova_conductor_spec.rb index 8cdf8b0..dbb1ef0 100644 --- a/spec/classes/tripleo_profile_base_nova_conductor_spec.rb +++ b/spec/classes/tripleo_profile_base_nova_conductor_spec.rb @@ -22,7 +22,7 @@ describe 'tripleo::profile::base::nova::conductor' do <<-eos class { '::tripleo::profile::base::nova': step => #{params[:step]}, - messaging_hosts => [ '127.0.0.1' ], + oslomsg_rpc_hosts => [ '127.0.0.1' ], } eos end diff --git a/spec/classes/tripleo_profile_base_nova_consoleauth_spec.rb b/spec/classes/tripleo_profile_base_nova_consoleauth_spec.rb index e8a2dff..29b9550 100644 --- a/spec/classes/tripleo_profile_base_nova_consoleauth_spec.rb +++ b/spec/classes/tripleo_profile_base_nova_consoleauth_spec.rb @@ -34,7 +34,7 @@ describe 'tripleo::profile::base::nova::consoleauth' do <<-eos class { '::tripleo::profile::base::nova': step => #{params[:step]}, - messaging_hosts => [ '127.0.0.1' ], + oslomsg_rpc_hosts => [ '127.0.0.1' ], } eos end diff --git a/spec/classes/tripleo_profile_base_nova_libvirt_spec.rb b/spec/classes/tripleo_profile_base_nova_libvirt_spec.rb index d263a74..36a6110 100644 --- a/spec/classes/tripleo_profile_base_nova_libvirt_spec.rb +++ b/spec/classes/tripleo_profile_base_nova_libvirt_spec.rb @@ -37,7 +37,7 @@ describe 'tripleo::profile::base::nova::libvirt' do <<-eos class { '::tripleo::profile::base::nova': step => #{params[:step]}, - messaging_hosts => [ '127.0.0.1' ], + oslomsg_rpc_hosts => [ '127.0.0.1' ], } eos end diff --git a/spec/classes/tripleo_profile_base_nova_placement_spec.rb b/spec/classes/tripleo_profile_base_nova_placement_spec.rb new file mode 100644 index 0000000..2a18320 --- /dev/null +++ b/spec/classes/tripleo_profile_base_nova_placement_spec.rb @@ -0,0 +1,124 @@ +# +# Copyright (C) 2017 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::nova::placement' do + shared_examples_for 'tripleo::profile::base::nova::placement' do + let(:pre_condition) do + <<-eos + class { '::tripleo::profile::base::nova': + step => #{params[:step]}, + oslomsg_rpc_hosts => [ 'localhost' ], + oslomsg_rpc_username => 'nova', + oslomsg_rpc_password => 'foo' + } + class { '::tripleo::profile::base::nova::authtoken': + step => #{params[:step]}, + } +eos + end + + context 'with step less than 3' do + let(:params) { { + :step => 1, + } } + + it { + is_expected.to contain_class('tripleo::profile::base::nova::placement') + is_expected.to contain_class('tripleo::profile::base::nova') + is_expected.to_not contain_class('nova::keystone::authtoken') + is_expected.to_not contain_class('nova::wsgi::apache_placement') + } + end + + context 'with step less than 3 and internal tls and generate certs' do + let(:params) { { + :step => 1, + :enable_internal_tls => true, + :generate_service_certificates => true, + :nova_placement_network => 'bar', + :certificates_specs => { + 'httpd-bar' => { + 'hostname' => 'foo', + 'service_certificate' => '/foo.pem', + 'service_key' => '/foo.key', + }, + } + } } + + it { + is_expected.to contain_class('tripleo::profile::base::nova::placement') + is_expected.to contain_class('tripleo::profile::base::nova') + is_expected.to contain_tripleo__certmonger__httpd('httpd-bar') + is_expected.to_not contain_class('nova::keystone::authtoken') + is_expected.to_not contain_class('nova::wsgi::apache_placement') + } + end + + + context 'with step 3' do + let(:params) { { + :step => 3, + } } + + it { + is_expected.to contain_class('tripleo::profile::base::nova::placement') + is_expected.to contain_class('tripleo::profile::base::nova') + is_expected.to contain_class('nova::keystone::authtoken') + is_expected.to contain_class('nova::wsgi::apache_placement') + } + end + + context 'with step 3 with enable_internal_tls and skip generate certs' do + let(:params) { { + :step => 3, + :enable_internal_tls => true, + :generate_service_certificates => false, + :nova_placement_network => 'bar', + :certificates_specs => { + 'httpd-bar' => { + 'hostname' => 'foo', + 'service_certificate' => '/foo.pem', + 'service_key' => '/foo.key', + }, + } + + } } + + it { + is_expected.to contain_class('tripleo::profile::base::nova::placement') + is_expected.to contain_class('tripleo::profile::base::nova') + is_expected.to_not contain_tripleo__certmonger__httpd('foo') + is_expected.to contain_class('nova::keystone::authtoken') + is_expected.to contain_class('nova::wsgi::apache_placement').with( + :ssl_cert => '/foo.pem', + :ssl_key => '/foo.key') + } + end + end + + + on_supported_os.each do |os, facts| + context "on #{os}" do + let(:facts) do + facts.merge({ :hostname => 'node.example.com' }) + end + + it_behaves_like 'tripleo::profile::base::nova::placement' + end + end +end diff --git a/spec/classes/tripleo_profile_base_nova_scheduler_spec.rb b/spec/classes/tripleo_profile_base_nova_scheduler_spec.rb index 87783c1..eb2372f 100644 --- a/spec/classes/tripleo_profile_base_nova_scheduler_spec.rb +++ b/spec/classes/tripleo_profile_base_nova_scheduler_spec.rb @@ -35,7 +35,7 @@ describe 'tripleo::profile::base::nova::scheduler' do <<-eos class { '::tripleo::profile::base::nova': step => #{params[:step]}, - messaging_hosts => [ '127.0.0.1' ], + oslomsg_rpc_hosts => [ '127.0.0.1' ], } eos end diff --git a/spec/classes/tripleo_profile_base_nova_spec.rb b/spec/classes/tripleo_profile_base_nova_spec.rb index 8ba78af..b5677cc 100644 --- a/spec/classes/tripleo_profile_base_nova_spec.rb +++ b/spec/classes/tripleo_profile_base_nova_spec.rb @@ -22,8 +22,8 @@ describe 'tripleo::profile::base::nova' do context 'with step less than 3' do let(:params) { { :step => 1, - :messaging_hosts => [ 'localhost' ], - :messaging_password => 'foo' + :oslomsg_rpc_hosts => [ 'localhost' ], + :oslomsg_rpc_password => 'foo' } } it { @@ -38,9 +38,9 @@ describe 'tripleo::profile::base::nova' do let(:params) { { :step => 3, :bootstrap_node => 'node.example.com', - :messaging_hosts => [ 'localhost' ], - :messaging_username => 'nova', - :messaging_password => 'foo', + :oslomsg_rpc_hosts => [ 'localhost' ], + :oslomsg_rpc_username => 'nova', + :oslomsg_rpc_password => 'foo', } } it { @@ -49,6 +49,7 @@ describe 'tripleo::profile::base::nova' do :default_transport_url => 'rabbit://nova:foo@localhost:5672/?ssl=0' ) is_expected.to contain_class('nova::config') + is_expected.to contain_class('nova::placement') is_expected.to contain_class('nova::cache').with( :enabled => true, :backend => 'oslo_cache.memcache_pool', @@ -61,8 +62,8 @@ describe 'tripleo::profile::base::nova' do let(:params) { { :step => 3, :bootstrap_node => 'other.example.com', - :messaging_hosts => [ 'localhost' ], - :messaging_password => 'foo' + :oslomsg_rpc_hosts => [ 'localhost' ], + :oslomsg_rpc_password => 'foo' } } it { @@ -70,6 +71,7 @@ describe 'tripleo::profile::base::nova' do is_expected.to_not contain_class('nova') is_expected.to_not contain_class('nova::config') is_expected.to_not contain_class('nova::cache') + is_expected.to_not contain_class('nova::placement') } end @@ -77,8 +79,8 @@ describe 'tripleo::profile::base::nova' do let(:params) { { :step => 4, :bootstrap_node => 'other.example.com', - :messaging_hosts => [ 'localhost' ], - :messaging_password => 'foo', + :oslomsg_rpc_hosts => [ 'localhost' ], + :oslomsg_rpc_password => 'foo', } } it { @@ -86,6 +88,7 @@ describe 'tripleo::profile::base::nova' do is_expected.to contain_class('nova') is_expected.to contain_class('nova::config') is_expected.to contain_class('nova::cache') + is_expected.to contain_class('nova::placement') is_expected.to_not contain_class('nova::migration::libvirt') } end @@ -100,14 +103,15 @@ describe 'tripleo::profile::base::nova' do :manage_migration => true, :nova_compute_enabled => true, :bootstrap_node => 'node.example.com', - :messaging_hosts => [ 'localhost' ], - :messaging_password => 'foo', + :oslomsg_rpc_hosts => [ 'localhost' ], + :oslomsg_rpc_password => 'foo', } } it { is_expected.to contain_class('tripleo::profile::base::nova') is_expected.to contain_class('nova') is_expected.to contain_class('nova::config') + is_expected.to contain_class('nova::placement') is_expected.to contain_class('nova::cache') is_expected.to contain_class('nova::migration::libvirt').with( :configure_libvirt => params[:libvirt_enabled], diff --git a/spec/classes/tripleo_profile_base_nova_vncproxy_spec.rb b/spec/classes/tripleo_profile_base_nova_vncproxy_spec.rb index f077875..902b27c 100644 --- a/spec/classes/tripleo_profile_base_nova_vncproxy_spec.rb +++ b/spec/classes/tripleo_profile_base_nova_vncproxy_spec.rb @@ -34,7 +34,7 @@ describe 'tripleo::profile::base::nova::vncproxy' do <<-eos class { '::tripleo::profile::base::nova': step => #{params[:step]}, - messaging_hosts => [ '127.0.0.1' ], + oslomsg_rpc_hosts => [ '127.0.0.1' ], } eos end diff --git a/spec/classes/tripleo_profile_base_octavia_api_spec.rb b/spec/classes/tripleo_profile_base_octavia_api_spec.rb index d916a32..abc0111 100644 --- a/spec/classes/tripleo_profile_base_octavia_api_spec.rb +++ b/spec/classes/tripleo_profile_base_octavia_api_spec.rb @@ -33,13 +33,16 @@ describe 'tripleo::profile::base::octavia::api' do <<-eos class { 'tripleo::profile::base::octavia' : step => #{params[:step]}, - rabbit_user => 'bugs', - rabbit_password => 'rabbits_R_c00l', - rabbit_hosts => ['hole.field.com'] + oslomsg_rpc_username => 'bugs', + oslomsg_rpc_password => 'rabbits_R_c00l', + oslomsg_rpc_hosts => ['hole.field.com'] } class { 'octavia::db::mysql': password => 'some_password' } + class { 'octavia::keystone::authtoken': + password => 'some_password' + } eos end diff --git a/spec/classes/tripleo_profile_base_octavia_spec.rb b/spec/classes/tripleo_profile_base_octavia_spec.rb index 89820ef..0070621 100644 --- a/spec/classes/tripleo_profile_base_octavia_spec.rb +++ b/spec/classes/tripleo_profile_base_octavia_spec.rb @@ -19,7 +19,7 @@ require 'spec_helper' describe 'tripleo::profile::base::octavia' do let :params do - { :rabbit_hosts => ['some.server.com'], + { :oslomsg_rpc_hosts => ['some.server.com'], :step => 5 } end @@ -44,7 +44,7 @@ describe 'tripleo::profile::base::octavia' do it 'should provide basic initialization' do is_expected.to contain_class('octavia').with( - :default_transport_url => 'rabbit://some.server.com:5672/' + :default_transport_url => 'rabbit://guest:password@some.server.com:5672/?ssl=0' ) is_expected.to contain_class('octavia::config') end @@ -52,24 +52,24 @@ describe 'tripleo::profile::base::octavia' do context 'with multiple hosts' do before do - params.merge!({ :rabbit_hosts => ['some.server.com', 'someother.server.com'] }) + params.merge!({ :oslomsg_rpc_hosts => ['some.server.com', 'someother.server.com'] }) end it 'should construct a multihost URL' do is_expected.to contain_class('octavia').with( - :default_transport_url => 'rabbit://some.server.com:5672,someother.server.com:5672/' + :default_transport_url => 'rabbit://guest:password@some.server.com:5672,guest:password@someother.server.com:5672/?ssl=0' ) end end context 'with username provided' do before do - params.merge!({ :rabbit_user => 'bunny' }) + params.merge!({ :oslomsg_rpc_username => 'bunny' }) end it 'should construct URL with username' do is_expected.to contain_class('octavia').with( - :default_transport_url => 'rabbit://bunny@some.server.com:5672/' + :default_transport_url => 'rabbit://bunny:password@some.server.com:5672/?ssl=0' ) end end @@ -77,15 +77,15 @@ describe 'tripleo::profile::base::octavia' do context 'with username and password provided' do before do params.merge!( - { :rabbit_user => 'bunny', - :rabbit_password => 'carrot' + { :oslomsg_rpc_username => 'bunny', + :oslomsg_rpc_password => 'carrot' } ) end it 'should construct URL with username and password' do is_expected.to contain_class('octavia').with( - :default_transport_url => 'rabbit://bunny:carrot@some.server.com:5672/' + :default_transport_url => 'rabbit://bunny:carrot@some.server.com:5672/?ssl=0' ) end end @@ -93,16 +93,16 @@ describe 'tripleo::profile::base::octavia' do context 'with multiple hosts and user info provided' do before do params.merge!( - { :rabbit_hosts => ['some.server.com', 'someother.server.com'], - :rabbit_user => 'bunny', - :rabbit_password => 'carrot' + { :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 is_expected.to contain_class('octavia').with( - :default_transport_url => 'rabbit://bunny:carrot@some.server.com:5672,bunny:carrot@someother.server.com:5672/' + :default_transport_url => 'rabbit://bunny:carrot@some.server.com:5672,bunny:carrot@someother.server.com:5672/?ssl=0' ) end end diff --git a/spec/classes/tripleo_profile_base_time_ntp_spec.rb b/spec/classes/tripleo_profile_base_time_ntp_spec.rb new file mode 100644 index 0000000..ec4b55f --- /dev/null +++ b/spec/classes/tripleo_profile_base_time_ntp_spec.rb @@ -0,0 +1,39 @@ +# +# Copyright (C) 2017 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::time::ntp' do + shared_examples_for 'tripleo::profile::base::time::ntp' do + + context 'with defaults' do + it { is_expected.to contain_class('tripleo::profile::base::time::ntp') } + it { is_expected.to contain_service('chronyd').with( + :ensure => 'stopped', + :enable => false) } + it { is_expected.to contain_class('ntp') } + end + end + + on_supported_os.each do |os, facts| + context "on #{os}" do + let (:facts) { + facts + } + it_behaves_like 'tripleo::profile::base::time::ntp' + end + end +end diff --git a/spec/classes/tripleo_ui_spec.rb b/spec/classes/tripleo_ui_spec.rb index 588a944..f3a4f25 100644 --- a/spec/classes/tripleo_ui_spec.rb +++ b/spec/classes/tripleo_ui_spec.rb @@ -24,9 +24,20 @@ describe 'tripleo::ui' do context 'with required parameters' do let(:params) { { - :servername => facts[:hostname], - :bind_host => '127.0.0.1', - :keystone_url => 'http://127.0.0.1:5000/' + :servername => facts[:hostname], + :bind_host => '127.0.0.1', + :endpoint_proxy_keystone => 'http://127.0.0.1:5000', + :endpoint_proxy_zaqar => 'ws://127.0.0.1:9000/zaqar', + :endpoint_proxy_heat => 'http://127.0.0.1:8004', + :endpoint_proxy_ironic => 'http://127.0.0.1:6385', + :endpoint_proxy_mistral => 'http://127.0.0.1:8989', + :endpoint_proxy_swift => 'http://127.0.0.1:8080', + :endpoint_config_keystone => 'https://127.0.0.1:443/keystone/v2.0', + :endpoint_config_zaqar => 'wss://127.0.0.1:443/zaqar', + :endpoint_config_heat => 'https://127.0.0.1:443/heat/v1/%(tenant_id)s', + :endpoint_config_ironic => 'https://127.0.0.1:443/ironic', + :endpoint_config_mistral => 'https://127.0.0.1:443/mistral/v2', + :endpoint_config_swift => 'https://127.0.0.1:443/swift/v1/AUTH_%(tenant_id)s' } } it 'should configure tripleo ui' do @@ -42,23 +53,34 @@ describe 'tripleo::ui' do ) is_expected.to contain_file('/etc/httpd/conf.d/openstack-tripleo-ui.conf').with_content(/cleaned by Puppet/) is_expected.to contain_file('/var/www/openstack-tripleo-ui/dist/tripleo_ui_config.js') - .with_content(/"keystone": "http:\/\/127.0.0.1:5000\/"/) - .with_content(/"zaqar_default_queue": "tripleo"/) + .with_content(/'keystone': 'https:\/\/127.0.0.1:443\/keystone\/v2.0'/) + .with_content(/'heat': 'https:\/\/127.0.0.1:443\/heat\/v1\/%\(tenant_id\)s'/) + .with_content(/'zaqar-websocket': 'wss:\/\/127.0.0.1:443\/zaqar'/) + .with_content(/'ironic': 'https:\/\/127.0.0.1:443\/ironic'/) + .with_content(/'mistral': 'https:\/\/127.0.0.1:443\/mistral\/v2'/) + .with_content(/'swift': 'https:\/\/127.0.0.1:443\/swift\/v1\/AUTH_%\(tenant_id\)s'/) + .with_content(/'zaqar_default_queue': 'tripleo'/) end end context 'with all parameters' do let(:params) { { - :servername => 'custom.example.com', - :bind_host => '127.0.0.2', - :ui_port => 3001, - :keystone_url => 'http://127.0.0.1:1111/', - :heat_url => 'http://127.0.0.1:2222/', - :ironic_url => 'http://127.0.0.1:3333/', - :mistral_url => 'http://127.0.0.1:4444/', - :swift_url => 'http://127.0.0.1:5555/', - :zaqar_websocket_url => 'http://127.0.0.1:6666/', - :zaqar_default_queue => 'myqueue' + :servername => 'custom.example.com', + :bind_host => '127.0.0.2', + :ui_port => 3001, + :endpoint_proxy_keystone => 'http://127.0.0.1:5000', + :endpoint_proxy_zaqar => 'ws://127.0.0.1:9000/zaqar', + :endpoint_proxy_heat => 'http://127.0.0.1:8004', + :endpoint_proxy_ironic => 'http://127.0.0.1:6385', + :endpoint_proxy_mistral => 'http://127.0.0.1:8989', + :endpoint_proxy_swift => 'http://127.0.0.1:8080', + :endpoint_config_keystone => 'https://127.0.0.1:443/keystone/v2.0', + :endpoint_config_zaqar => 'wss://127.0.0.1:443/zaqar', + :endpoint_config_heat => 'https://127.0.0.1:443/heat/v1/%(tenant_id)s', + :endpoint_config_ironic => 'https://127.0.0.1:443/ironic', + :endpoint_config_mistral => 'https://127.0.0.1:443/mistral/v2', + :endpoint_config_swift => 'https://127.0.0.1:443/swift/v1/AUTH_%(tenant_id)s', + :zaqar_default_queue => 'tripleo' } } it 'should configure tripleo ui' do @@ -74,13 +96,13 @@ describe 'tripleo::ui' do ) is_expected.to contain_file('/etc/httpd/conf.d/openstack-tripleo-ui.conf').with_content(/cleaned by Puppet/) is_expected.to contain_file('/var/www/openstack-tripleo-ui/dist/tripleo_ui_config.js') - .with_content(/"keystone": "http:\/\/127.0.0.1:1111\/"/) - .with_content(/"heat": "http:\/\/127.0.0.1:2222\/"/) - .with_content(/"ironic": "http:\/\/127.0.0.1:3333\/"/) - .with_content(/"mistral": "http:\/\/127.0.0.1:4444\/"/) - .with_content(/"swift": "http:\/\/127.0.0.1:5555\/"/) - .with_content(/"zaqar-websocket": "http:\/\/127.0.0.1:6666\/"/) - .with_content(/"zaqar_default_queue": "myqueue"/) + .with_content(/'keystone': 'https:\/\/127.0.0.1:443\/keystone\/v2.0'/) + .with_content(/'heat': 'https:\/\/127.0.0.1:443\/heat\/v1\/%\(tenant_id\)s'/) + .with_content(/'zaqar-websocket': 'wss:\/\/127.0.0.1:443\/zaqar'/) + .with_content(/'ironic': 'https:\/\/127.0.0.1:443\/ironic'/) + .with_content(/'mistral': 'https:\/\/127.0.0.1:443\/mistral\/v2'/) + .with_content(/'swift': 'https:\/\/127.0.0.1:443\/swift\/v1\/AUTH_%\(tenant_id\)s'/) + .with_content(/'zaqar_default_queue': 'tripleo'/) end end diff --git a/spec/fixtures/hieradata/default.yaml b/spec/fixtures/hieradata/default.yaml index 4d5dc99..eadb444 100644 --- a/spec/fixtures/hieradata/default.yaml +++ b/spec/fixtures/hieradata/default.yaml @@ -3,14 +3,18 @@ my_hash: network: '127.0.0.1' not_hash: string # aodh profile required hieradata +aodh::rabbit_password: 'password' aodh_redis_password: 'password' redis_vip: '127.0.0.1' aodh::auth::auth_password: 'password' aodh::db::mysql::password: 'password' aodh::keystone::authtoken::password: 'password' # babican profile required hieradata +barbican::api::rabbit_password: 'password' barbican::db::mysql::password: 'password' barbican::keystone::authtoken::password: 'password' +# ceilometer related items +ceilometer::rabbit_password: 'password' ceilometer::keystone::authtoken::password: 'password' # ceph related items ceph::profile::params::mon_key: 'password' @@ -33,3 +37,5 @@ memcached_node_ips_v6: - '::1' memcached_node_ips: - '127.0.0.1' +# octavia related items +octavia::rabbit_password: 'password' |