aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--manifests/profile/base/nova.pp2
-rw-r--r--spec/classes/tripleo_profile_base_nova_api_spec.rb120
-rw-r--r--spec/classes/tripleo_profile_base_nova_compute_ironic_spec.rb67
-rw-r--r--spec/classes/tripleo_profile_base_nova_compute_libvirt_spec.rb69
-rw-r--r--spec/classes/tripleo_profile_base_nova_compute_spec.rb87
-rw-r--r--spec/classes/tripleo_profile_base_nova_conductor_spec.rb61
-rw-r--r--spec/classes/tripleo_profile_base_nova_consoleauth_spec.rb62
-rw-r--r--spec/classes/tripleo_profile_base_nova_libvirt_spec.rb68
-rw-r--r--spec/classes/tripleo_profile_base_nova_scheduler_spec.rb64
-rw-r--r--spec/classes/tripleo_profile_base_nova_spec.rb131
-rw-r--r--spec/classes/tripleo_profile_base_nova_vncproxy_spec.rb62
-rw-r--r--spec/fixtures/hieradata/default.yaml9
12 files changed, 801 insertions, 1 deletions
diff --git a/manifests/profile/base/nova.pp b/manifests/profile/base/nova.pp
index 63adbef..dae627c 100644
--- a/manifests/profile/base/nova.pp
+++ b/manifests/profile/base/nova.pp
@@ -87,7 +87,7 @@ class tripleo::profile::base::nova (
$memcache_servers = suffix(hiera('memcached_node_ips'), ':11211')
}
- if hiera('step') >= 4 or (hiera('step') >= 3 and $sync_db) {
+ if $step >= 4 or ($step >= 3 and $sync_db) {
$messaging_use_ssl_real = sprintf('%s', bool2num(str2bool($messaging_use_ssl)))
# TODO(ccamacho): remove sprintf once we properly type the port, needs
# to be a string for the os_transport_url function.
diff --git a/spec/classes/tripleo_profile_base_nova_api_spec.rb b/spec/classes/tripleo_profile_base_nova_api_spec.rb
new file mode 100644
index 0000000..0d2564d
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_nova_api_spec.rb
@@ -0,0 +1,120 @@
+#
+# 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::api' do
+ shared_examples_for 'tripleo::profile::base::nova::api' do
+ let(:pre_condition) do
+ <<-eos
+ class { '::tripleo::profile::base::nova':
+ step => #{params[:step]},
+ messaging_hosts => [ 'localhost' ],
+ messaging_username => 'nova',
+ messaging_password => 'foo'
+ }
+eos
+ end
+
+ context 'with step less than 3' do
+ let(:params) { {
+ :step => 1,
+ } }
+
+ 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::keystone::authtoken')
+ is_expected.to_not contain_class('nova::api')
+ is_expected.to_not contain_class('nova::wsgi::apache_api')
+ is_expected.to_not contain_class('nova::network::neutron')
+ }
+ end
+
+ context 'with step 3 on bootstrap node' do
+ let(:params) { {
+ :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 contain_class('nova::db::sync_cell_v2').with(
+ :transport_url => 'rabbit://nova:foo@localhost:5672/?ssl=0')
+ 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')
+ }
+ end
+
+ context 'with step 3 not on bootstrap node' do
+ let(:params) { {
+ :step => 3,
+ :bootstrap_node => 'other.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_not contain_class('nova::wsgi::apache_api')
+ is_expected.to_not contain_class('nova::network::neutron')
+ }
+ end
+
+ context 'with step 4 not on bootstrap node' do
+ let(:params) { {
+ :step => 4,
+ :bootstrap_node => 'other.example.com',
+ } }
+
+ it {
+ 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')
+ }
+ end
+
+ context 'with step 5' do
+ let(:params) { {
+ :step => 5,
+ :bootstrap_node => 'other.example.com',
+ } }
+
+ it {
+ is_expected.to contain_class('nova::cron::archive_deleted_rows')
+ }
+ 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::api'
+ 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
new file mode 100644
index 0000000..2155695
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_nova_compute_ironic_spec.rb
@@ -0,0 +1,67 @@
+#
+# 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::compute::ironic' do
+ shared_examples_for 'tripleo::profile::base::nova::compute::ironic' do
+
+ context 'with step less than 4' do
+ let(:params) { { :step => 1, } }
+
+ it {
+ is_expected.to contain_class('tripleo::profile::base::nova::compute::ironic')
+ is_expected.to_not contain_class('tripleo::profile::base::nova')
+ is_expected.to_not contain_class('nova::compute::ironic')
+ is_expected.to_not contain_class('nova::network::neutron')
+ }
+ end
+
+ context 'with step 4' do
+ let(:pre_condition) do
+ <<-eos
+ class { '::tripleo::profile::base::nova':
+ step => #{params[:step]},
+ messaging_hosts => [ '127.0.0.1' ],
+ }
+ class { '::tripleo::profile::base::nova::compute':
+ step => #{params[:step]},
+ }
+eos
+ end
+
+ let(:params) { { :step => 4, } }
+
+ it {
+ is_expected.to contain_class('tripleo::profile::base::nova::compute::ironic')
+ is_expected.to contain_class('tripleo::profile::base::nova')
+ is_expected.to contain_class('nova::compute::ironic')
+ is_expected.to contain_class('nova::network::neutron')
+ }
+ 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::compute::ironic'
+ end
+ end
+end
diff --git a/spec/classes/tripleo_profile_base_nova_compute_libvirt_spec.rb b/spec/classes/tripleo_profile_base_nova_compute_libvirt_spec.rb
new file mode 100644
index 0000000..0b33123
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_nova_compute_libvirt_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::compute::libvirt' do
+ shared_examples_for 'tripleo::profile::base::nova::compute::libvirt' do
+
+ context 'with step less than 4' do
+ let(:params) { { :step => 1, } }
+
+ it {
+ is_expected.to contain_class('tripleo::profile::base::nova::compute::libvirt')
+ is_expected.to_not contain_class('tripleo::profile::base::nova')
+ is_expected.to_not contain_class('tripleo::profile::base::nova::compute')
+ is_expected.to_not contain_class('nova::compute::libvirt')
+ is_expected.to_not contain_class('nova::compute::libvirt::qemu')
+ }
+ end
+
+ context 'with step 4' do
+ let(:pre_condition) do
+ <<-eos
+ class { '::tripleo::profile::base::nova':
+ step => #{params[:step]},
+ messaging_hosts => [ '127.0.0.1' ],
+ }
+ class { '::tripleo::profile::base::nova::compute':
+ step => #{params[:step]},
+ }
+eos
+ end
+
+ let(:params) { { :step => 4, } }
+
+ it {
+ is_expected.to contain_class('tripleo::profile::base::nova::compute::libvirt')
+ is_expected.to contain_class('tripleo::profile::base::nova')
+ is_expected.to contain_class('tripleo::profile::base::nova::compute')
+ is_expected.to contain_class('nova::compute::libvirt')
+ is_expected.to contain_class('nova::compute::libvirt::qemu')
+ }
+ 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::compute::libvirt'
+ end
+ end
+end
diff --git a/spec/classes/tripleo_profile_base_nova_compute_spec.rb b/spec/classes/tripleo_profile_base_nova_compute_spec.rb
new file mode 100644
index 0000000..a0b2387
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_nova_compute_spec.rb
@@ -0,0 +1,87 @@
+#
+# 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::compute' do
+ shared_examples_for 'tripleo::profile::base::nova::compute' do
+
+ context 'with step less than 4' do
+ let(:params) { { :step => 1, } }
+
+ it {
+ is_expected.to contain_class('tripleo::profile::base::nova::compute')
+ is_expected.to_not contain_class('tripleo::profile::base::nova')
+ is_expected.to_not contain_class('nova::compute')
+ is_expected.to_not contain_class('nova::network::neutron')
+ is_expected.to_not contain_exec('reset-iscsi-initiator-name')
+ is_expected.to_not contain_file('/etc/iscsi/.initiator_reset')
+ }
+ end
+
+ context 'with step 4' do
+ let(:pre_condition) do
+ <<-eos
+ class { '::tripleo::profile::base::nova':
+ step => #{params[:step]},
+ messaging_hosts => [ '127.0.0.1' ],
+ }
+eos
+ end
+
+ context 'default params' do
+ let(:params) { { :step => 4, } }
+
+ it {
+ is_expected.to contain_class('tripleo::profile::base::nova::compute')
+ is_expected.to contain_class('tripleo::profile::base::nova')
+ is_expected.to contain_class('tripleo::profile::base::nova')
+ is_expected.to contain_class('nova::compute')
+ is_expected.to contain_class('nova::network::neutron')
+ is_expected.to contain_exec('reset-iscsi-initiator-name')
+ is_expected.to contain_file('/etc/iscsi/.initiator_reset')
+ is_expected.to_not contain_package('nfs-utils')
+ }
+ end
+
+ context 'cinder nfs backend' do
+ let(:params) { { :step => 4, :cinder_nfs_backend => true } }
+
+ it {
+ is_expected.to contain_class('tripleo::profile::base::nova::compute')
+ is_expected.to contain_class('tripleo::profile::base::nova')
+ is_expected.to contain_class('tripleo::profile::base::nova')
+ is_expected.to contain_class('nova::compute')
+ is_expected.to contain_class('nova::network::neutron')
+ is_expected.to contain_exec('reset-iscsi-initiator-name')
+ is_expected.to contain_file('/etc/iscsi/.initiator_reset')
+ is_expected.to contain_package('nfs-utils')
+ }
+ 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::nova::compute'
+ end
+ end
+end
diff --git a/spec/classes/tripleo_profile_base_nova_conductor_spec.rb b/spec/classes/tripleo_profile_base_nova_conductor_spec.rb
new file mode 100644
index 0000000..8cdf8b0
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_nova_conductor_spec.rb
@@ -0,0 +1,61 @@
+#
+# 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::conductor' do
+ shared_examples_for 'tripleo::profile::base::nova::conductor' do
+ let(:pre_condition) do
+ <<-eos
+ class { '::tripleo::profile::base::nova':
+ step => #{params[:step]},
+ messaging_hosts => [ '127.0.0.1' ],
+ }
+eos
+ end
+
+ context 'with step less than 4' do
+ let(:params) { { :step => 1, } }
+
+ it {
+ is_expected.to contain_class('tripleo::profile::base::nova::conductor')
+ is_expected.to contain_class('tripleo::profile::base::nova')
+ is_expected.to_not contain_class('nova::conductor')
+ }
+ end
+
+ context 'with step 4' do
+ let(:params) { { :step => 4, } }
+
+ it {
+ is_expected.to contain_class('tripleo::profile::base::nova::conductor')
+ is_expected.to contain_class('tripleo::profile::base::nova')
+ is_expected.to contain_class('nova::conductor')
+ }
+ 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::conductor'
+ end
+ end
+end
diff --git a/spec/classes/tripleo_profile_base_nova_consoleauth_spec.rb b/spec/classes/tripleo_profile_base_nova_consoleauth_spec.rb
new file mode 100644
index 0000000..e8a2dff
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_nova_consoleauth_spec.rb
@@ -0,0 +1,62 @@
+#
+# 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::consoleauth' do
+ shared_examples_for 'tripleo::profile::base::nova::consoleauth' do
+
+ context 'with step less than 4' do
+ let(:params) { { :step => 1, } }
+
+ it {
+ is_expected.to contain_class('tripleo::profile::base::nova::consoleauth')
+ is_expected.to_not contain_class('tripleo::profile::base::nova')
+ is_expected.to_not contain_class('nova::consoleauth')
+ }
+ end
+
+ context 'with step 4' do
+ let(:pre_condition) do
+ <<-eos
+ class { '::tripleo::profile::base::nova':
+ step => #{params[:step]},
+ messaging_hosts => [ '127.0.0.1' ],
+ }
+eos
+ end
+
+ let(:params) { { :step => 4, } }
+
+ it {
+ is_expected.to contain_class('tripleo::profile::base::nova::consoleauth')
+ is_expected.to contain_class('tripleo::profile::base::nova')
+ is_expected.to contain_class('nova::consoleauth')
+ }
+ 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::consoleauth'
+ end
+ end
+end
diff --git a/spec/classes/tripleo_profile_base_nova_libvirt_spec.rb b/spec/classes/tripleo_profile_base_nova_libvirt_spec.rb
new file mode 100644
index 0000000..d263a74
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_nova_libvirt_spec.rb
@@ -0,0 +1,68 @@
+#
+# 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::libvirt' do
+ shared_examples_for 'tripleo::profile::base::nova::libvirt' do
+
+ context 'with step less than 4' do
+ let(:params) { { :step => 1, } }
+
+ it {
+ is_expected.to contain_class('tripleo::profile::base::nova::libvirt')
+ is_expected.to_not contain_class('tripleo::profile::base::nova')
+ is_expected.to_not contain_class('nova::compute::libvirt::services')
+ is_expected.to_not contain_file('/etclibvirt/qemu/networks/autostart/default.xml')
+ is_expected.to_not contain_file('/etclibvirt/qemu/networks/default.xml')
+ is_expected.to_not contain_exec('libvirt-default-net-destroy')
+ }
+ end
+
+ context 'with step 4' do
+ let(:pre_condition) do
+ <<-eos
+ class { '::tripleo::profile::base::nova':
+ step => #{params[:step]},
+ messaging_hosts => [ '127.0.0.1' ],
+ }
+eos
+ end
+
+ let(:params) { { :step => 4, } }
+
+ it {
+ is_expected.to contain_class('tripleo::profile::base::nova::libvirt')
+ is_expected.to contain_class('tripleo::profile::base::nova')
+ is_expected.to contain_class('nova::compute::libvirt::services')
+ is_expected.to contain_file('/etc/libvirt/qemu/networks/autostart/default.xml').with_ensure('absent')
+ is_expected.to contain_file('/etc/libvirt/qemu/networks/default.xml').with_ensure('absent')
+ is_expected.to contain_exec('libvirt-default-net-destroy')
+ }
+ 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::libvirt'
+ 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
new file mode 100644
index 0000000..87783c1
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_nova_scheduler_spec.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.
+#
+
+require 'spec_helper'
+
+describe 'tripleo::profile::base::nova::scheduler' do
+ shared_examples_for 'tripleo::profile::base::nova::scheduler' do
+
+ context 'with step less than 4' do
+ let(:params) { { :step => 1, } }
+
+ it {
+ is_expected.to contain_class('tripleo::profile::base::nova::scheduler')
+ is_expected.to_not contain_class('tripleo::profile::base::nova')
+ is_expected.to_not contain_class('nova::scheduler')
+ is_expected.to_not contain_class('nova::scheduler::filter')
+ }
+ end
+
+ context 'with step 4' do
+ let(:pre_condition) do
+ <<-eos
+ class { '::tripleo::profile::base::nova':
+ step => #{params[:step]},
+ messaging_hosts => [ '127.0.0.1' ],
+ }
+eos
+ end
+
+ let(:params) { { :step => 4, } }
+
+ it {
+ is_expected.to contain_class('tripleo::profile::base::nova::scheduler')
+ is_expected.to contain_class('tripleo::profile::base::nova')
+ is_expected.to contain_class('nova::scheduler')
+ is_expected.to contain_class('nova::scheduler::filter')
+ }
+ 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::scheduler'
+ end
+ end
+end
diff --git a/spec/classes/tripleo_profile_base_nova_spec.rb b/spec/classes/tripleo_profile_base_nova_spec.rb
new file mode 100644
index 0000000..8ba78af
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_nova_spec.rb
@@ -0,0 +1,131 @@
+#
+# 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' do
+ shared_examples_for 'tripleo::profile::base::nova' do
+
+ context 'with step less than 3' do
+ let(:params) { {
+ :step => 1,
+ :messaging_hosts => [ 'localhost' ],
+ :messaging_password => 'foo'
+ } }
+
+ it {
+ is_expected.to contain_class('tripleo::profile::base::nova')
+ is_expected.to_not contain_class('nova')
+ is_expected.to_not contain_class('nova::config')
+ is_expected.to_not contain_class('nova::cache')
+ }
+ end
+
+ context 'with step 3 on bootstrap node' do
+ let(:params) { {
+ :step => 3,
+ :bootstrap_node => 'node.example.com',
+ :messaging_hosts => [ 'localhost' ],
+ :messaging_username => 'nova',
+ :messaging_password => 'foo',
+ } }
+
+ it {
+ is_expected.to contain_class('tripleo::profile::base::nova')
+ is_expected.to contain_class('nova').with(
+ :default_transport_url => 'rabbit://nova:foo@localhost:5672/?ssl=0'
+ )
+ is_expected.to contain_class('nova::config')
+ is_expected.to contain_class('nova::cache').with(
+ :enabled => true,
+ :backend => 'oslo_cache.memcache_pool',
+ :memcache_servers => ['127.0.0.1:11211']
+ )
+ }
+ end
+
+ context 'with step 3 not on bootstrap node' do
+ let(:params) { {
+ :step => 3,
+ :bootstrap_node => 'other.example.com',
+ :messaging_hosts => [ 'localhost' ],
+ :messaging_password => 'foo'
+ } }
+
+ it {
+ is_expected.to contain_class('tripleo::profile::base::nova')
+ is_expected.to_not contain_class('nova')
+ is_expected.to_not contain_class('nova::config')
+ is_expected.to_not contain_class('nova::cache')
+ }
+ end
+
+ context 'with step 4' do
+ let(:params) { {
+ :step => 4,
+ :bootstrap_node => 'other.example.com',
+ :messaging_hosts => [ 'localhost' ],
+ :messaging_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::cache')
+ is_expected.to_not contain_class('nova::migration::libvirt')
+ }
+ end
+
+ context 'with step 4 with libvirt' do
+ let(:pre_condition) {
+ 'include ::nova::compute::libvirt::services'
+ }
+ let(:params) { {
+ :step => 4,
+ :libvirt_enabled => true,
+ :manage_migration => true,
+ :nova_compute_enabled => true,
+ :bootstrap_node => 'node.example.com',
+ :messaging_hosts => [ 'localhost' ],
+ :messaging_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::cache')
+ is_expected.to contain_class('nova::migration::libvirt').with(
+ :configure_libvirt => params[:libvirt_enabled],
+ :configure_nova => params[:nova_compute_enabled]
+ )
+ }
+ 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'
+ end
+ end
+end
diff --git a/spec/classes/tripleo_profile_base_nova_vncproxy_spec.rb b/spec/classes/tripleo_profile_base_nova_vncproxy_spec.rb
new file mode 100644
index 0000000..f077875
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_nova_vncproxy_spec.rb
@@ -0,0 +1,62 @@
+#
+# 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::vncproxy' do
+ shared_examples_for 'tripleo::profile::base::nova::vncproxy' do
+
+ context 'with step less than 4' do
+ let(:params) { { :step => 1, } }
+
+ it {
+ is_expected.to contain_class('tripleo::profile::base::nova::vncproxy')
+ is_expected.to_not contain_class('tripleo::profile::base::nova')
+ is_expected.to_not contain_class('nova::vncproxy')
+ }
+ end
+
+ context 'with step 4' do
+ let(:pre_condition) do
+ <<-eos
+ class { '::tripleo::profile::base::nova':
+ step => #{params[:step]},
+ messaging_hosts => [ '127.0.0.1' ],
+ }
+eos
+ end
+
+ let(:params) { { :step => 4, } }
+
+ it {
+ is_expected.to contain_class('tripleo::profile::base::nova::vncproxy')
+ is_expected.to contain_class('tripleo::profile::base::nova')
+ is_expected.to contain_class('nova::vncproxy')
+ }
+ 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::vncproxy'
+ end
+ end
+end
diff --git a/spec/fixtures/hieradata/default.yaml b/spec/fixtures/hieradata/default.yaml
index b09e914..4d5dc99 100644
--- a/spec/fixtures/hieradata/default.yaml
+++ b/spec/fixtures/hieradata/default.yaml
@@ -24,3 +24,12 @@ ceph::profile::params::rgw_keystone_admin_password: 'keystone_admin_password'
# cinder related items
cinder::rabbit_password: 'password'
cinder::keystone::authtoken::password: 'password'
+# nova related items
+nova::rabbit_password: 'password'
+nova::keystone::authtoken::password: 'password'
+nova::network::neutron::neutron_password: 'password'
+# memcache related items
+memcached_node_ips_v6:
+ - '::1'
+memcached_node_ips:
+ - '127.0.0.1'