aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/classes/tripleo_certmonger_ca_local_spec.rb (renamed from spec/classes/tripleo_certmonger_ca_local.rb)0
-rw-r--r--spec/classes/tripleo_certmonger_etcd_spec.rb (renamed from spec/classes/tripleo_certmonger_etcd.rb)0
-rw-r--r--spec/classes/tripleo_certmonger_mysql_spec.rb (renamed from spec/classes/tripleo_certmonger_mysql.rb)0
-rw-r--r--spec/classes/tripleo_certmonger_rabbitmq_spec.rb (renamed from spec/classes/tripleo_certmonger_rabbitmq.rb)0
-rw-r--r--spec/classes/tripleo_profile_base_docker_spec.rb79
-rw-r--r--spec/classes/tripleo_profile_base_novajoin_spec.rb126
-rw-r--r--spec/classes/tripleo_profile_base_swift_ringbuilder_spec.rb (renamed from spec/classes/tripleo_profile_base_swift_ringbuilder.rb)0
7 files changed, 205 insertions, 0 deletions
diff --git a/spec/classes/tripleo_certmonger_ca_local.rb b/spec/classes/tripleo_certmonger_ca_local_spec.rb
index 7ee9383..7ee9383 100644
--- a/spec/classes/tripleo_certmonger_ca_local.rb
+++ b/spec/classes/tripleo_certmonger_ca_local_spec.rb
diff --git a/spec/classes/tripleo_certmonger_etcd.rb b/spec/classes/tripleo_certmonger_etcd_spec.rb
index fc0aad3..fc0aad3 100644
--- a/spec/classes/tripleo_certmonger_etcd.rb
+++ b/spec/classes/tripleo_certmonger_etcd_spec.rb
diff --git a/spec/classes/tripleo_certmonger_mysql.rb b/spec/classes/tripleo_certmonger_mysql_spec.rb
index 23b1e4f..23b1e4f 100644
--- a/spec/classes/tripleo_certmonger_mysql.rb
+++ b/spec/classes/tripleo_certmonger_mysql_spec.rb
diff --git a/spec/classes/tripleo_certmonger_rabbitmq.rb b/spec/classes/tripleo_certmonger_rabbitmq_spec.rb
index 5c011ce..5c011ce 100644
--- a/spec/classes/tripleo_certmonger_rabbitmq.rb
+++ b/spec/classes/tripleo_certmonger_rabbitmq_spec.rb
diff --git a/spec/classes/tripleo_profile_base_docker_spec.rb b/spec/classes/tripleo_profile_base_docker_spec.rb
index 0b988f6..bb21055 100644
--- a/spec/classes/tripleo_profile_base_docker_spec.rb
+++ b/spec/classes/tripleo_profile_base_docker_spec.rb
@@ -124,6 +124,85 @@ describe 'tripleo::profile::base::docker' do
}
end
+ context 'with step 4 and configure_libvirt_polkit disabled' do
+ let(:params) { {
+ :step => 4,
+ :configure_libvirt_polkit => false
+ } }
+ it {
+ is_expected.to_not contain_group('docker_nova_group')
+ is_expected.to_not contain_user('docker_nova_user')
+ is_expected.to_not contain_package('polkit')
+ is_expected.to_not contain_file('/etc/polkit-1/rules.d/50-nova.rules')
+ }
+ end
+
+ context 'with step 4 and configure_libvirt_polkit enabled' do
+ let(:params) { {
+ :step => 4,
+ :configure_libvirt_polkit => true
+ } }
+ it {
+ is_expected.to contain_group('docker_nova_group').with(
+ :name => 'docker_nova',
+ :gid => 42436
+ )
+ is_expected.to contain_user('docker_nova_user').with(
+ :name => 'docker_nova',
+ :uid => 42436,
+ :gid => 42436,
+ :shell => '/sbin/nologin',
+ :groups => ['nobody']
+ )
+ is_expected.to contain_package('polkit')
+ is_expected.to contain_file('/etc/polkit-1/rules.d/50-nova.rules')
+ }
+ end
+
+ context 'with step 4 and nova_compute service installed' do
+ let(:params) { {
+ :step => 4,
+ :services_enabled => ['docker', 'nova_compute']
+ } }
+ it {
+ is_expected.to contain_group('docker_nova_group').with(
+ :name => 'docker_nova',
+ :gid => 42436
+ )
+ is_expected.to contain_user('docker_nova_user').with(
+ :name => 'docker_nova',
+ :uid => 42436,
+ :gid => 42436,
+ :shell => '/sbin/nologin',
+ :groups => ['nobody']
+ )
+ is_expected.to contain_package('polkit')
+ is_expected.to contain_file('/etc/polkit-1/rules.d/50-nova.rules')
+ }
+ end
+
+ context 'with step 4 and configure_libvirt_polkit enabled and docker_nova uid' do
+ let(:params) { {
+ :step => 4,
+ :configure_libvirt_polkit => true,
+ :docker_nova_uid => 12345
+ } }
+ it {
+ is_expected.to contain_group('docker_nova_group').with(
+ :name => 'docker_nova',
+ :gid => 12345
+ )
+ is_expected.to contain_user('docker_nova_user').with(
+ :name => 'docker_nova',
+ :uid => 12345,
+ :gid => 12345,
+ :shell => '/sbin/nologin',
+ :groups => ['nobody']
+ )
+ is_expected.to contain_package('polkit')
+ is_expected.to contain_file('/etc/polkit-1/rules.d/50-nova.rules')
+ }
+ end
end
on_supported_os.each do |os, facts|
diff --git a/spec/classes/tripleo_profile_base_novajoin_spec.rb b/spec/classes/tripleo_profile_base_novajoin_spec.rb
new file mode 100644
index 0000000..e157d4f
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_novajoin_spec.rb
@@ -0,0 +1,126 @@
+#
+# 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::novajoin' do
+
+ let :pre_condition do
+ "include nova
+ class { '::nova::metadata::novajoin::authtoken':
+ password => 'passw0rd',
+ }"
+ end
+
+ let :params do
+ { :oslomsg_rpc_hosts => ['some.server.com'],
+ :oslomsg_rpc_password => 'somepassword',
+ :service_password => 'passw0rd',
+ :step => 5
+ }
+ end
+
+ shared_examples_for 'tripleo::profile::base::novajoin' do
+
+ context 'with step less than 3' do
+ before do
+ params.merge!({ :step => 2 })
+ end
+
+ it 'should not do anything' do
+ is_expected.to_not contain_class('nova::metadata::novajoin::api')
+ end
+ end
+
+ context 'with step 3' do
+ before do
+ params.merge!({ :step => 3 })
+ end
+
+ it 'should provide basic initialization' do
+ is_expected.to contain_class('nova::metadata::novajoin::api').with(
+ :transport_url => 'rabbit://guest:somepassword@some.server.com:5672/?ssl=0'
+ )
+ end
+ end
+
+ context 'with multiple hosts' do
+ before do
+ params.merge!({ :oslomsg_rpc_hosts => ['some.server.com', 'someother.server.com'] })
+ end
+
+ it 'should construct a multihost URL' do
+ is_expected.to contain_class('nova::metadata::novajoin::api').with(
+ :transport_url => 'rabbit://guest:somepassword@some.server.com:5672,guest:somepassword@someother.server.com:5672/?ssl=0'
+ )
+ end
+ end
+
+ context 'with username provided' do
+ before do
+ params.merge!({ :oslomsg_rpc_username => 'bunny' })
+ end
+
+ it 'should construct URL with username' do
+ is_expected.to contain_class('nova::metadata::novajoin::api').with(
+ :transport_url => 'rabbit://bunny:somepassword@some.server.com:5672/?ssl=0'
+ )
+ end
+ end
+
+ context 'with username and password provided' do
+ before do
+ params.merge!(
+ { :oslomsg_rpc_username => 'bunny',
+ :oslomsg_rpc_password => 'carrot'
+ }
+ )
+ end
+
+ it 'should construct URL with username and password' do
+ is_expected.to contain_class('nova::metadata::novajoin::api').with(
+ :transport_url => 'rabbit://bunny:carrot@some.server.com:5672/?ssl=0'
+ )
+ end
+ end
+
+ 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'
+ }
+ )
+ end
+
+ it 'should distributed user info across hosts URL' do
+ is_expected.to contain_class('nova::metadata::novajoin::api').with(
+ :transport_url => 'rabbit://bunny:carrot@some.server.com:5672,bunny:carrot@someother.server.com:5672/?ssl=0'
+ )
+ 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::novajoin'
+ end
+ end
+end
diff --git a/spec/classes/tripleo_profile_base_swift_ringbuilder.rb b/spec/classes/tripleo_profile_base_swift_ringbuilder_spec.rb
index 0139815..0139815 100644
--- a/spec/classes/tripleo_profile_base_swift_ringbuilder.rb
+++ b/spec/classes/tripleo_profile_base_swift_ringbuilder_spec.rb