summaryrefslogtreecommitdiffstats
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
parentb50938c8cefce85482b0ce282efdaf7c718084ba (diff)
parentf418c79632a7f21ff6ab11ef1715cd4a5b361789 (diff)
Merge "Add cinder profile spec tests"
-rw-r--r--manifests/profile/base/cinder/volume.pp20
-rw-r--r--spec/classes/tripleo_profile_base_cinder_api_spec.rb86
-rw-r--r--spec/classes/tripleo_profile_base_cinder_backup_ceph_spec.rb59
-rw-r--r--spec/classes/tripleo_profile_base_cinder_backup_spec.rb56
-rw-r--r--spec/classes/tripleo_profile_base_cinder_backup_swift_spec.rb59
-rw-r--r--spec/classes/tripleo_profile_base_cinder_scheduler_spec.rb56
-rw-r--r--spec/classes/tripleo_profile_base_cinder_spec.rb122
-rw-r--r--spec/classes/tripleo_profile_base_cinder_volume_dellsc_spec.rb58
-rw-r--r--spec/classes/tripleo_profile_base_cinder_volume_eqlx_spec.rb58
-rw-r--r--spec/classes/tripleo_profile_base_cinder_volume_iscsi_spec.rb85
-rw-r--r--spec/classes/tripleo_profile_base_cinder_volume_netapp_spec.rb58
-rw-r--r--spec/classes/tripleo_profile_base_cinder_volume_nfs_spec.rb88
-rw-r--r--spec/classes/tripleo_profile_base_cinder_volume_rbd_spec.rb83
-rw-r--r--spec/classes/tripleo_profile_base_cinder_volume_spec.rb216
-rw-r--r--spec/fixtures/hiera.yaml1
-rw-r--r--spec/fixtures/hieradata/default.yaml3
-rw-r--r--spec/fixtures/hieradata/step1.yaml2
-rw-r--r--spec/fixtures/hieradata/step2.yaml2
-rw-r--r--spec/fixtures/hieradata/step3.yaml2
-rw-r--r--spec/fixtures/hieradata/step4.yaml9
-rw-r--r--spec/fixtures/hieradata/step5.yaml2
-rw-r--r--spec/fixtures/hieradata/step6.yaml2
22 files changed, 1120 insertions, 7 deletions
diff --git a/manifests/profile/base/cinder/volume.pp b/manifests/profile/base/cinder/volume.pp
index 7d562ec..64927b6 100644
--- a/manifests/profile/base/cinder/volume.pp
+++ b/manifests/profile/base/cinder/volume.pp
@@ -108,13 +108,19 @@ class tripleo::profile::base::cinder::volume (
$cinder_rbd_backend_name = undef
}
- $cinder_enabled_backends = delete_undef_values([$cinder_iscsi_backend_name,
- $cinder_rbd_backend_name,
- $cinder_eqlx_backend_name,
- $cinder_dellsc_backend_name,
- $cinder_netapp_backend_name,
- $cinder_nfs_backend_name,
- $cinder_user_enabled_backends])
+ $backends = delete_undef_values([$cinder_iscsi_backend_name,
+ $cinder_rbd_backend_name,
+ $cinder_eqlx_backend_name,
+ $cinder_dellsc_backend_name,
+ $cinder_netapp_backend_name,
+ $cinder_nfs_backend_name,
+ $cinder_user_enabled_backends])
+ # NOTE(aschultz): during testing it was found that puppet 3 may incorrectly
+ # include a "" in the previous array which is not removed by the
+ # delete_undef_values function. So we need to make sure we don't have any
+ # "" strings in our array.
+ $cinder_enabled_backends = delete($backends, '')
+
class { '::cinder::backends' :
enabled_backends => $cinder_enabled_backends,
}
diff --git a/spec/classes/tripleo_profile_base_cinder_api_spec.rb b/spec/classes/tripleo_profile_base_cinder_api_spec.rb
new file mode 100644
index 0000000..a0c607d
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_cinder_api_spec.rb
@@ -0,0 +1,86 @@
+#
+# 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::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'] }"
+ end
+
+ context 'with step less than 3' do
+ let(:params) { { :step => 1 } }
+
+ it 'should do nothing' do
+ is_expected.to contain_class('tripleo::profile::base::cinder::api')
+ is_expected.to contain_class('tripleo::profile::base::cinder')
+ is_expected.to_not contain_class('cinder::api')
+ is_expected.to_not contain_class('cinder::ceilometer')
+ is_expected.to_not contain_class('cinder::glance')
+ end
+ end
+
+ context 'with step 3 on bootstrap node' do
+ let(:params) { {
+ :step => 3,
+ :bootstrap_node => 'node.example.com',
+ } }
+
+ it 'should trigger complete configuration' do
+ is_expected.to contain_class('cinder::api')
+ is_expected.to contain_class('cinder::ceilometer')
+ is_expected.to contain_class('cinder::glance')
+ end
+ end
+
+ context 'with step 3 not on bootstrap node' do
+ let(:params) { {
+ :step => 3,
+ :bootstrap_node => 'other.example.com',
+ } }
+
+ it 'should not trigger any configuration' do
+ is_expected.to_not contain_class('cinder::api')
+ is_expected.to_not contain_class('cinder::ceilometer')
+ is_expected.to_not contain_class('cinder::glance')
+ end
+ end
+
+ context 'with step 4' do
+ let(:params) { {
+ :step => 4,
+ } }
+
+ it 'should trigger complete configuration' do
+ is_expected.to contain_class('cinder::api')
+ is_expected.to contain_class('cinder::ceilometer')
+ is_expected.to contain_class('cinder::glance')
+ 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::api'
+ end
+ end
+end
diff --git a/spec/classes/tripleo_profile_base_cinder_backup_ceph_spec.rb b/spec/classes/tripleo_profile_base_cinder_backup_ceph_spec.rb
new file mode 100644
index 0000000..46c3d15
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_cinder_backup_ceph_spec.rb
@@ -0,0 +1,59 @@
+#
+# 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::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::backup': step => #{params[:step]} }
+ EOF
+ 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::backup::ceph')
+ is_expected.to contain_class('tripleo::profile::base::cinder::backup')
+ is_expected.to_not contain_class('cinder::backup::ceph')
+ end
+ end
+
+ context 'with step 4' do
+ let(:params) { {
+ :step => 4,
+ } }
+
+ it 'should trigger complete configuration' do
+ is_expected.to contain_class('cinder::backup::ceph')
+ 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::backup::ceph'
+ end
+ end
+end
diff --git a/spec/classes/tripleo_profile_base_cinder_backup_spec.rb b/spec/classes/tripleo_profile_base_cinder_backup_spec.rb
new file mode 100644
index 0000000..0e15c9a
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_cinder_backup_spec.rb
@@ -0,0 +1,56 @@
+#
+# 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::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'] }"
+ 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::backup')
+ is_expected.to contain_class('tripleo::profile::base::cinder')
+ is_expected.to_not contain_class('cinder::backup')
+ end
+ end
+
+ context 'with step 4' do
+ let(:params) { {
+ :step => 4,
+ } }
+
+ it 'should trigger complete configuration' do
+ is_expected.to contain_class('cinder::backup')
+ 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::backup'
+ end
+ end
+end
diff --git a/spec/classes/tripleo_profile_base_cinder_backup_swift_spec.rb b/spec/classes/tripleo_profile_base_cinder_backup_swift_spec.rb
new file mode 100644
index 0000000..2c9d71f
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_cinder_backup_swift_spec.rb
@@ -0,0 +1,59 @@
+#
+# 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::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::backup': step => #{params[:step]} }
+ EOF
+ 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::backup::swift')
+ is_expected.to contain_class('tripleo::profile::base::cinder::backup')
+ is_expected.to_not contain_class('cinder::backup::swift')
+ end
+ end
+
+ context 'with step 4' do
+ let(:params) { {
+ :step => 4,
+ } }
+
+ it 'should trigger complete configuration' do
+ is_expected.to contain_class('cinder::backup::swift')
+ 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::backup::swift'
+ 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
new file mode 100644
index 0000000..cd044ee
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_cinder_scheduler_spec.rb
@@ -0,0 +1,56 @@
+#
+# 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::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'] }"
+ 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::scheduler')
+ is_expected.to contain_class('tripleo::profile::base::cinder')
+ is_expected.to_not contain_class('cinder::scheduler')
+ end
+ end
+
+ context 'with step 4' do
+ let(:params) { {
+ :step => 4,
+ } }
+
+ it 'should trigger complete configuration' do
+ is_expected.to contain_class('cinder::scheduler')
+ 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::scheduler'
+ end
+ end
+end
diff --git a/spec/classes/tripleo_profile_base_cinder_spec.rb b/spec/classes/tripleo_profile_base_cinder_spec.rb
new file mode 100644
index 0000000..6a36152
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_cinder_spec.rb
@@ -0,0 +1,122 @@
+#
+# 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' do
+ shared_examples_for 'tripleo::profile::base::cinder' do
+ context 'with step less than 3' do
+ let(:params) { { :step => 1 } }
+ it 'should do nothing' do
+ is_expected.to contain_class('tripleo::profile::base::cinder')
+ is_expected.to_not contain_class('cinder')
+ is_expected.to_not contain_class('cinder::config')
+ is_expected.to_not contain_class('cinder:::cron::db_purge')
+ end
+ end
+
+ 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'
+ } }
+
+ it 'should trigger complete configuration' do
+ is_expected.to contain_class('cinder').with(
+ :rabbit_hosts => params[:rabbit_hosts].map{ |h| "#{h}:#{params[:rabbit_port]}" }
+ )
+ is_expected.to contain_class('cinder::config')
+ is_expected.to_not contain_class('cinder::cron::db_purge')
+ end
+ end
+
+ context 'with step 3 not on bootstrap node' do
+ let(:params) { {
+ :step => 3,
+ :bootstrap_node => 'soemthingelse.example.com'
+ } }
+
+ it 'should not trigger any configuration' do
+ is_expected.to_not contain_class('cinder')
+ is_expected.to_not contain_class('cinder::config')
+ is_expected.to_not contain_class('cinder:::cron::db_purge')
+ end
+ end
+
+ 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'
+ } }
+
+ 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]}" }
+ )
+ is_expected.to contain_class('cinder::config')
+ is_expected.to_not contain_class('cinder:::cron::db_purge')
+ end
+ end
+
+ context 'with step 5' do
+ let(:params) { {
+ :step => 5,
+ :bootstrap_node => 'node.example.com',
+ :rabbit_hosts => ['127.0.0.1', '127.0.0.2']
+ } }
+
+ it 'should trigger complete configuration' do
+ is_expected.to contain_class('cinder').with(
+ :rabbit_hosts => params[:rabbit_hosts].map{ |h| "#{h}:5672" }
+ )
+ is_expected.to contain_class('cinder::config')
+ is_expected.to contain_class('cinder::cron::db_purge')
+ end
+ end
+
+ 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'],
+ :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" }
+ )
+ is_expected.to contain_class('cinder::config')
+ is_expected.to_not contain_class('cinder::cron::db_purge')
+ 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'
+ end
+ end
+end
diff --git a/spec/classes/tripleo_profile_base_cinder_volume_dellsc_spec.rb b/spec/classes/tripleo_profile_base_cinder_volume_dellsc_spec.rb
new file mode 100644
index 0000000..328e886
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_cinder_volume_dellsc_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::dellsc' do
+ shared_examples_for 'tripleo::profile::base::cinder::volume::dellsc' 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::dellsc')
+ 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__dellsc_iscsi('tripleo_dellsc')
+ 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__dellsc_iscsi('tripleo_dellsc')
+ 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::dellsc'
+ end
+ end
+end
diff --git a/spec/classes/tripleo_profile_base_cinder_volume_eqlx_spec.rb b/spec/classes/tripleo_profile_base_cinder_volume_eqlx_spec.rb
new file mode 100644
index 0000000..1a188aa
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_cinder_volume_eqlx_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::eqlx' do
+ shared_examples_for 'tripleo::profile::base::cinder::volume::eqlx' 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::eqlx')
+ 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')
+ 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__eqlx('tripleo_eqlx')
+ 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::eqlx'
+ end
+ end
+end
diff --git a/spec/classes/tripleo_profile_base_cinder_volume_iscsi_spec.rb b/spec/classes/tripleo_profile_base_cinder_volume_iscsi_spec.rb
new file mode 100644
index 0000000..65bf3dc
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_cinder_volume_iscsi_spec.rb
@@ -0,0 +1,85 @@
+#
+# 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::iscsi' do
+ shared_examples_for 'tripleo::profile::base::cinder::volume::iscsi' do
+ before :each do
+ facts.merge!({ :step => params[:step] })
+ end
+
+ context 'with step less than 4' do
+ let(:params) { {
+ :cinder_iscsi_address => '127.0.0.1',
+ :step => 3
+ } }
+
+ it 'should do nothing' 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_not contain_class('cinder::setup_test_volume')
+ is_expected.to_not contain_cinder__backend__iscsi('tripleo_iscsi')
+ end
+ end
+
+ context 'with step 4' do
+ let(:params) { {
+ :cinder_iscsi_address => '127.0.0.1',
+ :step => 4,
+ } }
+
+ context 'with defaults' do
+ it 'should trigger complete configuration' do
+ is_expected.to contain_class('cinder::setup_test_volume').with(
+ :size => '10280M'
+ )
+ is_expected.to contain_cinder__backend__iscsi('tripleo_iscsi').with(
+ :iscsi_ip_address => '127.0.0.1',
+ :iscsi_helper => 'tgtadm',
+ :iscsi_protocol => 'iscsi'
+ )
+ end
+ end
+
+ context 'with ipv6 address' do
+ before :each do
+ params.merge!({ :cinder_iscsi_address => 'fe80::fc54:ff:fe9e:7846' })
+ end
+ it 'should trigger complete configuration' do
+ is_expected.to contain_class('cinder::setup_test_volume').with(
+ :size => '10280M'
+ )
+ is_expected.to contain_cinder__backend__iscsi('tripleo_iscsi').with(
+ :iscsi_ip_address => '[fe80::fc54:ff:fe9e:7846]'
+ )
+ 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::iscsi'
+ end
+ end
+end
diff --git a/spec/classes/tripleo_profile_base_cinder_volume_netapp_spec.rb b/spec/classes/tripleo_profile_base_cinder_volume_netapp_spec.rb
new file mode 100644
index 0000000..732720e
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_cinder_volume_netapp_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::netapp' do
+ shared_examples_for 'tripleo::profile::base::cinder::volume::netapp' 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::netapp')
+ 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__netapp('tripleo_netapp')
+ end
+ end
+
+ context 'with step 4' do
+ let(:params) { {
+ :step => 4,
+ } }
+
+ it 'should trigger complete configuration' do
+ # TODO(aschultz): check parameters via hiera
+ is_expected.to contain_cinder__backend__netapp('tripleo_netapp')
+ 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::netapp'
+ end
+ end
+end
diff --git a/spec/classes/tripleo_profile_base_cinder_volume_nfs_spec.rb b/spec/classes/tripleo_profile_base_cinder_volume_nfs_spec.rb
new file mode 100644
index 0000000..194a70d
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_cinder_volume_nfs_spec.rb
@@ -0,0 +1,88 @@
+#
+# 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::nfs' do
+ shared_examples_for 'tripleo::profile::base::cinder::volume::nfs' do
+ before :each do
+ facts.merge!({ :step => params[:step] })
+ end
+
+ context 'with step less than 4' do
+ let(:params) { {
+ :cinder_nfs_servers => ['127.0.0.1'],
+ :step => 3
+ } }
+
+ it 'should do nothing' do
+ is_expected.to contain_class('tripleo::profile::base::cinder::volume::nfs')
+ 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__nfs('tripleo_nfs')
+ end
+ end
+
+ context 'with step 4' do
+ let(:params) { {
+ :cinder_nfs_servers => ['127.0.0.1'],
+ :step => 4,
+ } }
+
+ context 'with defaults' do
+ it 'should trigger complete configuration' do
+ is_expected.to contain_cinder__backend__nfs('tripleo_nfs').with(
+ :nfs_servers => ['127.0.0.1'],
+ :nfs_mount_options => '',
+ :nfs_shares_config => '/etc/cinder/shares-nfs.conf'
+ )
+ end
+ end
+
+ context 'with selinux' do
+ before :each do
+ facts.merge!({ :selinux => 'true' })
+ end
+ it 'should configure selinux' do
+ is_expected.to contain_selboolean('virt_use_nfs').with(
+ :value => 'on',
+ :persistent => true,
+ )
+ end
+ end
+
+ context 'without selinux' do
+ before :each do
+ facts.merge!({ :selinux => 'false' })
+ end
+ it 'should configure selinux' do
+ is_expected.to_not contain_selboolean('virt_use_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::nfs'
+ end
+ end
+end
diff --git a/spec/classes/tripleo_profile_base_cinder_volume_rbd_spec.rb b/spec/classes/tripleo_profile_base_cinder_volume_rbd_spec.rb
new file mode 100644
index 0000000..559b836
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_cinder_volume_rbd_spec.rb
@@ -0,0 +1,83 @@
+#
+# 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::rbd' do
+ shared_examples_for 'tripleo::profile::base::cinder::volume::rbd' 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::rbd')
+ 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__rbd('tripleo_ceph')
+ end
+ end
+
+ context 'with step 4' do
+ let(:params) { {
+ :step => 4,
+ } }
+
+ context 'with defaults' do
+ it 'should trigger complete configuration' do
+ is_expected.to contain_cinder__backend__rbd('tripleo_ceph').with(
+ :backend_host => 'hostgroup',
+ :rbd_pool => 'volumes',
+ :rbd_user => 'openstack',
+ )
+ end
+ end
+
+ context 'with customizations' do
+ before :each do
+ params.merge!({
+ :backend_name => 'poodles',
+ :cinder_rbd_backend_host => 'fe80::fc54:ff:fe9e:7846',
+ :cinder_rbd_pool_name => 'poolname',
+ :cinder_rbd_secret_uuid => 'secretuuid',
+ :cinder_rbd_user_name => 'kcatsnepo'
+ })
+ end
+ it 'should trigger complete configuration' do
+ is_expected.to contain_cinder__backend__rbd('poodles').with(
+ :backend_host => 'fe80::fc54:ff:fe9e:7846',
+ :rbd_pool => 'poolname',
+ :rbd_user => 'kcatsnepo',
+ :rbd_secret_uuid => 'secretuuid'
+ )
+ 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::rbd'
+ 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
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
diff --git a/spec/fixtures/hiera.yaml b/spec/fixtures/hiera.yaml
index d5368e9..07bc836 100644
--- a/spec/fixtures/hiera.yaml
+++ b/spec/fixtures/hiera.yaml
@@ -4,4 +4,5 @@
:yaml:
:datadir: './spec/fixtures/hieradata'
:hierarchy:
+ - 'step%{::step}'
- 'default'
diff --git a/spec/fixtures/hieradata/default.yaml b/spec/fixtures/hieradata/default.yaml
index 87ae28c..d63fc76 100644
--- a/spec/fixtures/hieradata/default.yaml
+++ b/spec/fixtures/hieradata/default.yaml
@@ -14,3 +14,6 @@ barbican::keystone::authtoken::password: 'password'
ceilometer::keystone::authtoken::password: 'password'
# ceph related items
ceph::profile::params::mon_key: 'password'
+# cinder related items
+cinder::rabbit_password: 'password'
+cinder::keystone::authtoken::password: 'password'
diff --git a/spec/fixtures/hieradata/step1.yaml b/spec/fixtures/hieradata/step1.yaml
new file mode 100644
index 0000000..795a4a7
--- /dev/null
+++ b/spec/fixtures/hieradata/step1.yaml
@@ -0,0 +1,2 @@
+---
+step: 1
diff --git a/spec/fixtures/hieradata/step2.yaml b/spec/fixtures/hieradata/step2.yaml
new file mode 100644
index 0000000..4bd5851
--- /dev/null
+++ b/spec/fixtures/hieradata/step2.yaml
@@ -0,0 +1,2 @@
+---
+step: 2
diff --git a/spec/fixtures/hieradata/step3.yaml b/spec/fixtures/hieradata/step3.yaml
new file mode 100644
index 0000000..1526e81
--- /dev/null
+++ b/spec/fixtures/hieradata/step3.yaml
@@ -0,0 +1,2 @@
+---
+step: 3
diff --git a/spec/fixtures/hieradata/step4.yaml b/spec/fixtures/hieradata/step4.yaml
new file mode 100644
index 0000000..0b53225
--- /dev/null
+++ b/spec/fixtures/hieradata/step4.yaml
@@ -0,0 +1,9 @@
+---
+step: 4
+# items needed for tripleo::profile::base::cinder::volume
+tripleo::profile::base::cinder::volume::iscsi::cinder_iscsi_address: '127.0.0.1'
+tripleo::profile::base::cinder::volume::nfs::cinder_nfs_servers:
+ - '127.0.0.1'
+cinder::backend::eqlx::eqlx_chap_login: 'user'
+cinder::backend::eqlx::eqlx_chap_password: 'user'
+
diff --git a/spec/fixtures/hieradata/step5.yaml b/spec/fixtures/hieradata/step5.yaml
new file mode 100644
index 0000000..442420f
--- /dev/null
+++ b/spec/fixtures/hieradata/step5.yaml
@@ -0,0 +1,2 @@
+---
+step: 5
diff --git a/spec/fixtures/hieradata/step6.yaml b/spec/fixtures/hieradata/step6.yaml
new file mode 100644
index 0000000..08ba54d
--- /dev/null
+++ b/spec/fixtures/hieradata/step6.yaml
@@ -0,0 +1,2 @@
+---
+step: 6