aboutsummaryrefslogtreecommitdiffstats
path: root/spec/classes/tripleo_profile_base_cinder_volume_spec.rb
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-12-09 09:51:04 +0000
committerGerrit Code Review <review@openstack.org>2016-12-09 09:51:04 +0000
commit9fcf8ac9ffc54e9377dd7aaa137401da2c717c89 (patch)
tree313e46ddb5577ddb7cb8ddd1fee8af8c807f6719 /spec/classes/tripleo_profile_base_cinder_volume_spec.rb
parentb50938c8cefce85482b0ce282efdaf7c718084ba (diff)
parentf418c79632a7f21ff6ab11ef1715cd4a5b361789 (diff)
Merge "Add cinder profile spec tests"
Diffstat (limited to 'spec/classes/tripleo_profile_base_cinder_volume_spec.rb')
-rw-r--r--spec/classes/tripleo_profile_base_cinder_volume_spec.rb216
1 files changed, 216 insertions, 0 deletions
diff --git a/spec/classes/tripleo_profile_base_cinder_volume_spec.rb b/spec/classes/tripleo_profile_base_cinder_volume_spec.rb
new file mode 100644
index 0000000..e0ec9de
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_cinder_volume_spec.rb
@@ -0,0 +1,216 @@
+#
+# 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' do
+
+ shared_examples_for 'tripleo::profile::base::cinder::volume' do
+ # this hack allows hiera('step') to work as the spec hiera config will
+ # allow any included modules to automagically get the right step from
+ # hiera. (╯°□°)╯︵ ┻━┻
+ before :each do
+ facts.merge!({ :step => params[:step] })
+ end
+
+ let(:pre_condition) do
+ "class { '::tripleo::profile::base::cinder': step => #{params[:step]}, rabbit_hosts => ['127.0.0.1'] }"
+ 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')
+ is_expected.to contain_class('tripleo::profile::base::cinder')
+ is_expected.to_not contain_class('cinder::volume')
+ end
+ end
+
+ context 'with step 4' do
+ let(:params) { { :step => 4 } }
+
+ context 'with defaults' do
+ it 'should configure iscsi' do
+ is_expected.to 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_iscsi']
+ )
+ end
+ end
+
+ context 'with only dellsc' do
+ before :each do
+ params.merge!({
+ :cinder_enable_dellsc_backend => true,
+ :cinder_enable_iscsi_backend => false,
+ })
+ end
+ it 'should configure only dellsc' do
+ is_expected.to contain_class('tripleo::profile::base::cinder::volume::dellsc')
+ 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_dellsc']
+ )
+ end
+ end
+
+ context 'with only eqlx' do
+ before :each do
+ params.merge!({
+ :cinder_enable_eqlx_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')
+ 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']
+ )
+ end
+ end
+
+ context 'with only netapp' do
+ before :each do
+ params.merge!({
+ :cinder_enable_netapp_backend => true,
+ :cinder_enable_iscsi_backend => false,
+ })
+ end
+ it 'should configure only netapp' do
+ is_expected.to contain_class('tripleo::profile::base::cinder::volume::netapp')
+ 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_netapp']
+ )
+ end
+ end
+
+ context 'with only nfs' do
+ before :each do
+ params.merge!({
+ :cinder_enable_nfs_backend => true,
+ :cinder_enable_iscsi_backend => false,
+ })
+ end
+ it 'should configure only nfs' do
+ is_expected.to contain_class('tripleo::profile::base::cinder::volume::nfs')
+ 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_nfs']
+ )
+ end
+ end
+
+ context 'with only rbd' do
+ before :each do
+ params.merge!({
+ :cinder_enable_rbd_backend => true,
+ :cinder_enable_iscsi_backend => false,
+ })
+ end
+ it 'should configure only ceph' do
+ is_expected.to contain_class('tripleo::profile::base::cinder::volume::rbd')
+ 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_ceph']
+ )
+ end
+ end
+
+ context 'with only user backend' do
+ before :each do
+ params.merge!({
+ :cinder_enable_iscsi_backend => false,
+ :cinder_user_enabled_backends => 'poodles'
+ })
+ end
+ 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::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')
+ 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 => ['poodles']
+ )
+ end
+ end
+
+ context 'with all tripleo backends' do
+ before :each do
+ params.merge!({
+ :cinder_enable_iscsi_backend => true,
+ :cinder_enable_dellsc_backend => true,
+ :cinder_enable_eqlx_backend => true,
+ :cinder_enable_netapp_backend => true,
+ :cinder_enable_nfs_backend => true,
+ :cinder_enable_rbd_backend => true,
+ })
+ end
+ 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::netapp')
+ is_expected.to contain_class('tripleo::profile::base::cinder::volume::nfs')
+ is_expected.to contain_class('tripleo::profile::base::cinder::volume::rbd')
+ 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_iscsi', 'tripleo_ceph', 'tripleo_eqlx',
+ 'tripleo_dellsc', 'tripleo_netapp','tripleo_nfs']
+ )
+ end
+ 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'
+ end
+ end
+end