summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/classes/tripleo_cluster_cassandra_spec.rb54
-rw-r--r--spec/classes/tripleo_cluster_zookeeper_spec.rb86
-rw-r--r--spec/classes/tripleo_firewall_spec.rb4
-rw-r--r--spec/classes/tripleo_midonet_api_spec.rb76
-rw-r--r--spec/classes/tripleo_packages_spec.rb5
-rw-r--r--spec/classes/tripleo_profile_base_aodh_api_spec.rb58
-rw-r--r--spec/classes/tripleo_profile_base_aodh_evaluator_spec.rb59
-rw-r--r--spec/classes/tripleo_profile_base_aodh_listener_spec.rb56
-rw-r--r--spec/classes/tripleo_profile_base_aodh_notifier_spec.rb56
-rw-r--r--spec/classes/tripleo_profile_base_aodh_spec.rb94
-rw-r--r--spec/classes/tripleo_profile_base_barbican_api_spec.rb107
-rw-r--r--spec/classes/tripleo_profile_base_barbican_spec.rb56
-rw-r--r--spec/classes/tripleo_profile_base_ceilometer_api_spec.rb57
-rw-r--r--spec/classes/tripleo_profile_base_ceilometer_collector_spec.rb143
-rw-r--r--spec/classes/tripleo_profile_base_ceilometer_expirer_spec.rb58
-rw-r--r--spec/classes/tripleo_profile_base_ceilometer_spec.rb55
-rw-r--r--spec/classes/tripleo_profile_base_ceph_client_spec.rb59
-rw-r--r--spec/classes/tripleo_profile_base_ceph_mon_spec.rb77
-rw-r--r--spec/classes/tripleo_profile_base_ceph_osd_spec.rb75
-rw-r--r--spec/classes/tripleo_profile_base_ceph_rgw_spec.rb99
-rw-r--r--spec/classes/tripleo_profile_base_ceph_spec.rb99
-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/classes/tripleo_ui_spec.rb99
-rw-r--r--spec/fixtures/hiera.yaml3
-rw-r--r--spec/fixtures/hieradata/default.yaml16
-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
-rw-r--r--spec/spec_helper.rb2
44 files changed, 2435 insertions, 221 deletions
diff --git a/spec/classes/tripleo_cluster_cassandra_spec.rb b/spec/classes/tripleo_cluster_cassandra_spec.rb
deleted file mode 100644
index 3f7d471..0000000
--- a/spec/classes/tripleo_cluster_cassandra_spec.rb
+++ /dev/null
@@ -1,54 +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 cassandra service
-
-require 'spec_helper'
-
-describe 'tripleo::cluster::cassandra' do
-
- shared_examples_for 'tripleo::cluster::cassandra' do
-
- let :params do
- {
- :cassandra_servers => ['192.168.2.2', '192.168.2.3'],
- :cassandra_ip => '192.168.2.2'
- }
- end
-
- it 'should configure cassandra' do
- is_expected.to contain_class('cassandra').with(
- :seeds => ['192.168.2.2', '192.168.2.3'],
- :listen_address => '192.168.2.2',
- :storage_port => 7000,
- :ssl_storage_port => 7001,
- :native_transport_port => 9042,
- :rpc_port => 9160
- )
-
- end
- end
-
- on_supported_os.each do |os, facts|
- context "on #{os}" do
- let(:facts) do
- facts.merge({})
- end
-
- it_behaves_like 'tripleo::cluster::cassandra'
- end
- end
-
-end
diff --git a/spec/classes/tripleo_cluster_zookeeper_spec.rb b/spec/classes/tripleo_cluster_zookeeper_spec.rb
deleted file mode 100644
index fc003b6..0000000
--- a/spec/classes/tripleo_cluster_zookeeper_spec.rb
+++ /dev/null
@@ -1,86 +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 zookeeper service
-
-require 'spec_helper'
-
-describe 'tripleo::cluster::zookeeper' do
-
- shared_examples_for 'tripleo::cluster::zookeeper' do
- let :params do
- {
- :zookeeper_server_ips => ['23.43.2.34', '23.43.2.35', '24.43.2.36'],
- :zookeeper_hostnames => ['host1.midonet', 'host2.midonet', 'host3.midonet']
- }
- end
-
- context 'on host1' do
- before :each do
- facts.merge!({ :hostname => 'host1.midonet'})
- params.merge!({ :zookeeper_client_ip => '23.43.2.34' })
- end
-
- it 'should call zookeeper using id==1' do
- is_expected.to contain_class('zookeeper').with(
- :servers => ['23.43.2.34', '23.43.2.35', '24.43.2.36'],
- :client_ip => '23.43.2.34',
- :id => 1
- )
- end
- end
-
- context 'on host2' do
- before :each do
- facts.merge!({ :hostname => 'host2.midonet'})
- params.merge!({ :zookeeper_client_ip => '23.43.2.35' })
- end
-
- it 'should call zookeeper using id==1' do
- is_expected.to contain_class('zookeeper').with(
- :servers => ['23.43.2.34', '23.43.2.35', '24.43.2.36'],
- :client_ip => '23.43.2.35',
- :id => 2
- )
- end
- end
-
- context 'on host3' do
- before :each do
- facts.merge!({ :hostname => 'host3.midonet'})
- params.merge!({ :zookeeper_client_ip => '23.43.2.36' })
- end
-
- it 'should call zookeeper using id==1' do
- is_expected.to contain_class('zookeeper').with(
- :servers => ['23.43.2.34', '23.43.2.35', '24.43.2.36'],
- :client_ip => '23.43.2.36',
- :id => 3
- )
- end
-
- end
- end
-
- on_supported_os.each do |os, facts|
- context "on #{os}" do
- let(:facts) do
- facts.merge({})
- end
-
- it_behaves_like 'tripleo::cluster::zookeeper'
- end
- end
-end
diff --git a/spec/classes/tripleo_firewall_spec.rb b/spec/classes/tripleo_firewall_spec.rb
index 1270aa7..3116a51 100644
--- a/spec/classes/tripleo_firewall_spec.rb
+++ b/spec/classes/tripleo_firewall_spec.rb
@@ -76,7 +76,8 @@ describe 'tripleo::firewall' do
'301 add custom application 2' => {'port' => '8081', 'proto' => 'tcp', 'action' => 'accept'},
'302 fwd custom cidr 1' => {'chain' => 'FORWARD', 'destination' => '192.0.2.0/24'},
'303 add custom application 3' => {'dport' => '8081', 'proto' => 'tcp', 'action' => 'accept'},
- '304 add custom application 4' => {'sport' => '1000', 'proto' => 'tcp', 'action' => 'accept'}
+ '304 add custom application 4' => {'sport' => '1000', 'proto' => 'tcp', 'action' => 'accept'},
+ '305 add gre rule' => {'proto' => 'gre'}
}
)
end
@@ -109,6 +110,7 @@ describe 'tripleo::firewall' do
:action => 'accept',
:state => ['NEW'],
)
+ is_expected.to contain_firewall('305 add gre rule').without(:state)
end
end
diff --git a/spec/classes/tripleo_midonet_api_spec.rb b/spec/classes/tripleo_midonet_api_spec.rb
deleted file mode 100644
index 25b375b..0000000
--- a/spec/classes/tripleo_midonet_api_spec.rb
+++ /dev/null
@@ -1,76 +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 api
-
-require 'spec_helper'
-
-describe 'tripleo::network::midonet::api' do
-
- shared_examples_for 'tripleo::midonet::api' do
-
- let :params do
- {
- :zookeeper_servers => ['192.168.2.1', '192.168.2.2'],
- :vip => '192.23.0.2',
- :keystone_ip => '192.23.0.2',
- :keystone_admin_token => 'admin_token',
- :admin_password => 'admin_password',
- :bind_address => '192.23.0.65'
- }
- end
-
- it 'should call api configuration' do
- is_expected.to contain_class('midonet::midonet_api::run').with(
- :zk_servers => [{'ip' => '192.168.2.1', 'port' => 2181},
- {'ip' => '192.168.2.2', 'port' => 2181}],
- :keystone_auth => true,
- :tomcat_package => 'tomcat',
- :vtep => false,
- :api_ip => '192.23.0.2',
- :api_port => '8081',
- :keystone_host => '192.23.0.2',
- :keystone_port => 35357,
- :keystone_admin_token => 'admin_token',
- :keystone_tenant_name => 'admin',
- :catalina_base => '/usr/share/tomcat',
- :bind_address => '192.23.0.65'
- )
- end
-
- it 'should install the cli' do
- is_expected.to contain_class('midonet::midonet_cli').with(
- :api_endpoint => 'http://192.23.0.2:8081/midonet-api',
- :username => 'admin',
- :password => 'admin_password',
- :tenant_name => 'admin'
- )
- end
-
- end
-
- on_supported_os.each do |os, facts|
- context "on #{os}" do
- let(:facts) do
- facts.merge({
- :augeasversion => '1.0.0'
- })
- end
-
- it_behaves_like 'tripleo::midonet::api'
- end
- end
-
-end
diff --git a/spec/classes/tripleo_packages_spec.rb b/spec/classes/tripleo_packages_spec.rb
index 076d9cd..8db238a 100644
--- a/spec/classes/tripleo_packages_spec.rb
+++ b/spec/classes/tripleo_packages_spec.rb
@@ -29,9 +29,8 @@ describe 'tripleo::packages' do
}
end
- it 'should contain correct upgrade ordering' do
- is_expected.to contain_exec('package-upgrade').that_comes_before('Service[nova-compute]')
- is_expected.to contain_exec('package-upgrade').with(:command => 'yum -y update')
+ it 'should contain upgrade exec' do
+ is_expected.to contain_exec('package-upgrade').with(:command => 'yum -y update')
end
end
diff --git a/spec/classes/tripleo_profile_base_aodh_api_spec.rb b/spec/classes/tripleo_profile_base_aodh_api_spec.rb
new file mode 100644
index 0000000..22f26cf
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_aodh_api_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::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'] }"
+ 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::aodh::api')
+ is_expected.to contain_class('tripleo::profile::base::aodh')
+ is_expected.to_not contain_class('aodh::api')
+ is_expected.to_not contain_class('aodh::wsgi::apache')
+ end
+ end
+
+ context 'with step 4' do
+ let(:params) { {
+ :step => 4,
+ } }
+
+ it 'should trigger complete configuration' do
+ is_expected.to contain_class('aodh::api')
+ is_expected.to contain_class('aodh::wsgi::apache')
+ 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::aodh::api'
+ end
+ end
+end
diff --git a/spec/classes/tripleo_profile_base_aodh_evaluator_spec.rb b/spec/classes/tripleo_profile_base_aodh_evaluator_spec.rb
new file mode 100644
index 0000000..495794d
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_aodh_evaluator_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::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'] }"
+ 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::aodh::evaluator')
+ is_expected.to contain_class('tripleo::profile::base::aodh')
+ is_expected.to_not contain_class('aodh::evaluator')
+ end
+ end
+
+ context 'with step 4' do
+ let(:params) { {
+ :step => 4,
+ } }
+
+ it 'should trigger complete configuration' do
+ # TODO(aschultz): need to parameterize the pass/vip so we can test ipv6
+ is_expected.to contain_class('aodh::evaluator').with(
+ :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::aodh::evaluator'
+ end
+ end
+end
diff --git a/spec/classes/tripleo_profile_base_aodh_listener_spec.rb b/spec/classes/tripleo_profile_base_aodh_listener_spec.rb
new file mode 100644
index 0000000..022ee5c
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_aodh_listener_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::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'] }"
+ 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::aodh::listener')
+ is_expected.to contain_class('tripleo::profile::base::aodh')
+ is_expected.to_not contain_class('aodh::listener')
+ end
+ end
+
+ context 'with step 4' do
+ let(:params) { {
+ :step => 4,
+ } }
+
+ it 'should trigger complete configuration' do
+ is_expected.to contain_class('aodh::listener')
+ 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::aodh::listener'
+ end
+ end
+end
diff --git a/spec/classes/tripleo_profile_base_aodh_notifier_spec.rb b/spec/classes/tripleo_profile_base_aodh_notifier_spec.rb
new file mode 100644
index 0000000..f2116ca
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_aodh_notifier_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::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'] }"
+ 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::aodh::notifier')
+ is_expected.to contain_class('tripleo::profile::base::aodh')
+ is_expected.to_not contain_class('aodh::notifier')
+ end
+ end
+
+ context 'with step 4' do
+ let(:params) { {
+ :step => 4,
+ } }
+
+ it 'should trigger complete configuration' do
+ is_expected.to contain_class('aodh::notifier')
+ 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::aodh::notifier'
+ end
+ end
+end
diff --git a/spec/classes/tripleo_profile_base_aodh_spec.rb b/spec/classes/tripleo_profile_base_aodh_spec.rb
new file mode 100644
index 0000000..3befa23
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_aodh_spec.rb
@@ -0,0 +1,94 @@
+#
+# 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::aodh' do
+ shared_examples_for 'tripleo::profile::base::aodh' 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::aodh')
+ is_expected.to_not contain_class('aodh')
+ is_expected.to_not contain_class('aodh::auth')
+ is_expected.to_not contain_class('aodh::config')
+ is_expected.to_not contain_class('aodh::client')
+ is_expected.to_not contain_class('aodh::db::sync')
+ end
+ end
+
+ context 'with step 3 on bootstrap node' do
+ let(:params) { {
+ :step => 3,
+ :bootstrap_node => 'node.example.com',
+ :rabbit_hosts => ['localhost1.localdomain', 'localhost2.localdomain']
+ } }
+
+ it 'should trigger complete configuration' do
+ is_expected.to contain_class('aodh').with(
+ :rabbit_hosts => params[:rabbit_hosts].map { |h| h + ":5672" }
+ )
+ is_expected.to contain_class('aodh::auth')
+ is_expected.to contain_class('aodh::config')
+ is_expected.to contain_class('aodh::client')
+ is_expected.to contain_class('aodh::db::sync')
+ 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('aodh')
+ is_expected.to_not contain_class('aodh::auth')
+ is_expected.to_not contain_class('aodh::config')
+ is_expected.to_not contain_class('aodh::client')
+ is_expected.to_not contain_class('aodh::db::sync')
+ end
+ end
+
+ context 'with step 4 on other node' do
+ let(:params) { {
+ :step => 4,
+ :bootstrap_node => 'somethingelse.example.com',
+ :rabbit_hosts => ['localhost1.localdomain', 'localhost2.localdomain']
+ } }
+
+ 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" }
+ )
+ is_expected.to contain_class('aodh::auth')
+ is_expected.to contain_class('aodh::config')
+ is_expected.to contain_class('aodh::client')
+ is_expected.to contain_class('aodh::db::sync')
+ 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::aodh'
+ end
+ end
+end
diff --git a/spec/classes/tripleo_profile_base_barbican_api_spec.rb b/spec/classes/tripleo_profile_base_barbican_api_spec.rb
new file mode 100644
index 0000000..169642e
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_barbican_api_spec.rb
@@ -0,0 +1,107 @@
+#
+# 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::barbican::api' do
+ shared_examples_for 'tripleo::profile::base::barbican::api' do
+ let(:pre_condition) do
+ "class { '::tripleo::profile::base::barbican': step => #{params[:step]} }"
+ 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::barbican::api')
+ is_expected.to contain_class('tripleo::profile::base::barbican')
+ is_expected.to_not contain_class('barbican::api')
+ is_expected.to_not contain_class('barbican::api::logging')
+ is_expected.to_not contain_class('barbican::keystone::notification')
+ is_expected.to_not contain_class('barbican::quota')
+ is_expected.to_not contain_class('barbican::wsgi::apache')
+ 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('tripleo::profile::base::barbican::api')
+ is_expected.to contain_class('tripleo::profile::base::barbican')
+ is_expected.to contain_class('barbican::db::mysql')
+ is_expected.to contain_class('barbican::db::sync')
+ is_expected.to contain_class('barbican::api')
+ is_expected.to contain_class('barbican::api::logging')
+ is_expected.to contain_class('barbican::keystone::notification')
+ is_expected.to contain_class('barbican::quota')
+ is_expected.to contain_class('barbican::wsgi::apache')
+ 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 contain_class('tripleo::profile::base::barbican::api')
+ is_expected.to contain_class('tripleo::profile::base::barbican')
+ is_expected.to_not contain_class('barbican::db::mysql')
+ is_expected.to_not contain_class('barbican::db::sync')
+ is_expected.to_not contain_class('barbican::api')
+ is_expected.to_not contain_class('barbican::api::logging')
+ is_expected.to_not contain_class('barbican::keystone::notification')
+ is_expected.to_not contain_class('barbican::quota')
+ is_expected.to_not contain_class('barbican::wsgi::apache')
+ end
+ end
+
+ context 'with step 4 not on bootstrap node' do
+ let(:params) { {
+ :step => 4,
+ :bootstrap_node => 'other.example.com',
+ } }
+
+ it 'should trigger complete configuration with out db items' do
+ is_expected.to_not contain_class('barbican::db::mysql')
+ # TODO(aschultz): barbican::api includes this automatically
+ #is_expected.to_not contain_class('barbican::db::sync')
+ is_expected.to contain_class('barbican::api')
+ is_expected.to contain_class('barbican::api::logging')
+ is_expected.to contain_class('barbican::keystone::notification')
+ is_expected.to contain_class('barbican::quota')
+ is_expected.to contain_class('barbican::wsgi::apache')
+ 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::barbican::api'
+ end
+ end
+end
diff --git a/spec/classes/tripleo_profile_base_barbican_spec.rb b/spec/classes/tripleo_profile_base_barbican_spec.rb
new file mode 100644
index 0000000..470b2c2
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_barbican_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::barbican' do
+ shared_examples_for 'tripleo::profile::base::barbican' 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::barbican')
+ is_expected.to_not contain_class('barbican')
+ is_expected.to_not contain_class('barbican::config')
+ is_expected.to_not contain_class('barbican::client')
+ end
+ end
+
+ context 'with step 3' do
+ let(:params) { {
+ :step => 3,
+ } }
+
+ it 'should trigger complete configuration' do
+ is_expected.to contain_class('barbican').with(
+ :rabbit_hosts => params[:rabbit_hosts]
+ )
+ is_expected.to contain_class('barbican')
+ is_expected.to contain_class('barbican::config')
+ is_expected.to contain_class('barbican::client')
+ 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::barbican'
+ 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
new file mode 100644
index 0000000..935e9e8
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_ceilometer_api_spec.rb
@@ -0,0 +1,57 @@
+#
+# 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::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'] }"
+ 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::api')
+ is_expected.to_not contain_class('ceilometer::api')
+ is_expected.to_not contain_class('ceilometer::wsgi::apache')
+ end
+ end
+
+ context 'with step 4' do
+ let(:params) { {
+ :step => 4,
+ } }
+
+ it 'should trigger complete configuration' do
+ is_expected.to contain_class('ceilometer::api')
+ is_expected.to contain_class('ceilometer::wsgi::apache')
+ 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::api'
+ end
+ end
+end
diff --git a/spec/classes/tripleo_profile_base_ceilometer_collector_spec.rb b/spec/classes/tripleo_profile_base_ceilometer_collector_spec.rb
new file mode 100644
index 0000000..2e4b50a
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_ceilometer_collector_spec.rb
@@ -0,0 +1,143 @@
+#
+# 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::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'] }"
+ end
+
+ context 'with step 3 on bootstrap node with mongodb' do
+ let(:params) { {
+ :step => 3,
+ :bootstrap_node => 'node.example.com',
+ :mongodb_node_ips => ['127.0.0.1',],
+ :mongodb_replset => 'replicaset'
+ } }
+
+ it 'should trigger complete configuration' do
+ is_expected.to contain_class('tripleo::profile::base::ceilometer::collector')
+ is_expected.to contain_class('ceilometer::db::sync')
+ is_expected.to contain_class('ceilometer::db').with(
+ :database_connection => 'mongodb://127.0.0.1:27017/ceilometer?replicaSet=replicaset'
+ )
+ end
+ end
+
+ context 'with step 3 on bootstrap node with mongodb with ipv6' do
+ let(:params) { {
+ :step => 3,
+ :bootstrap_node => 'node.example.com',
+ :mongodb_ipv6 => true,
+ :mongodb_node_ips => ['::1','fe80::ca5b:76ff:fe4b:be3b'],
+ :mongodb_replset => 'replicaset'
+ } }
+
+ it 'should trigger complete configuration' do
+ is_expected.to contain_class('tripleo::profile::base::ceilometer::collector')
+ is_expected.to contain_class('ceilometer::db::sync')
+ is_expected.to contain_class('ceilometer::db').with(
+ :sync_db => true,
+ :database_connection => 'mongodb://[::1]:27017,[fe80::ca5b:76ff:fe4b:be3b]:27017/ceilometer?replicaSet=replicaset'
+ )
+ end
+ end
+
+ context 'with step 3 on bootstrap node without mongodb' do
+ let(:params) { {
+ :step => 3,
+ :bootstrap_node => 'node.example.com',
+ :ceilometer_backend => 'somethingelse',
+ :mongodb_node_ips => ['127.0.0.1',],
+ :mongodb_replset => 'replicaset'
+ } }
+
+ it 'should trigger complete configuration' do
+ is_expected.to contain_class('tripleo::profile::base::ceilometer::collector')
+ is_expected.to contain_class('ceilometer::db::sync')
+ is_expected.to contain_class('ceilometer::db').without(
+ :database_connection => 'mongodb://127.0.0.1:27017/ceilometer?replicaSet=replicaset'
+ )
+ is_expected.to contain_class('ceilometer::db').with(
+ :sync_db => true
+ )
+ 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 contain_class('tripleo::profile::base::ceilometer::collector')
+ is_expected.to_not contain_class('ceilometer::db')
+ end
+ end
+
+ context 'with step 4 on bootstrap node' do
+ let(:params) { {
+ :step => 4,
+ :bootstrap_node => 'node.example.com',
+ :mongodb_node_ips => ['127.0.0.1',],
+ :mongodb_replset => 'replicaset'
+ } }
+
+ it 'should trigger complete configuration' do
+ is_expected.to contain_class('ceilometer::db::sync')
+ is_expected.to contain_class('ceilometer::db').with(
+ :sync_db => true,
+ :database_connection => 'mongodb://127.0.0.1:27017/ceilometer?replicaSet=replicaset'
+ )
+ is_expected.to contain_class('ceilometer::collector')
+ is_expected.to contain_class('ceilometer::dispatcher::gnocchi')
+ end
+ end
+
+ context 'with step 4 not on bootstrap node' do
+ let(:params) { {
+ :step => 4,
+ :bootstrap_node => 'somethingelse.example.com',
+ :mongodb_node_ips => ['127.0.0.1',],
+ :mongodb_replset => 'replicaset'
+ } }
+
+ it 'should trigger complete configuration' do
+ is_expected.to_not contain_class('ceilometer::db::sync')
+ is_expected.to contain_class('ceilometer::db').with(
+ :sync_db => false,
+ :database_connection => 'mongodb://127.0.0.1:27017/ceilometer?replicaSet=replicaset'
+ )
+ is_expected.to contain_class('ceilometer::collector')
+ is_expected.to contain_class('ceilometer::dispatcher::gnocchi')
+ 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::collector'
+ end
+ end
+end
diff --git a/spec/classes/tripleo_profile_base_ceilometer_expirer_spec.rb b/spec/classes/tripleo_profile_base_ceilometer_expirer_spec.rb
new file mode 100644
index 0000000..c13f3c8
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_ceilometer_expirer_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::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'] }"
+ 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::expirer')
+ is_expected.to_not contain_class('ceilometer::expirer')
+ end
+ end
+
+ context 'with step 4' do
+ let(:params) { {
+ :step => 4,
+ } }
+
+ it 'should trigger complete configuration' do
+ is_expected.to contain_class('ceilometer::expirer')
+ is_expected.to contain_cron('ceilometer-expirer').with(
+ :command => 'sleep $(($(od -A n -t d -N 3 /dev/urandom) % 86400)) && ceilometer-expirer'
+ )
+ 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::expirer'
+ end
+ end
+end
diff --git a/spec/classes/tripleo_profile_base_ceilometer_spec.rb b/spec/classes/tripleo_profile_base_ceilometer_spec.rb
new file mode 100644
index 0000000..075aff8
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_ceilometer_spec.rb
@@ -0,0 +1,55 @@
+#
+# 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' do
+ shared_examples_for 'tripleo::profile::base::ceilometer' 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::ceilometer')
+ is_expected.to_not contain_class('ceilometer')
+ is_expected.to_not contain_class('ceilometer::config')
+ end
+ end
+
+ context 'with step 3' do
+ let(:params) { {
+ :step => 3,
+ :rabbit_hosts => ['localhost1.localdomain', 'localhost2.localdomain']
+ } }
+
+ it 'should trigger complete configuration' do
+ is_expected.to contain_class('ceilometer').with(
+ :rabbit_hosts => params[:rabbit_hosts].map{ |h| h + ':5672' }
+ )
+ is_expected.to contain_class('ceilometer::config')
+ 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'
+ end
+ end
+end
diff --git a/spec/classes/tripleo_profile_base_ceph_client_spec.rb b/spec/classes/tripleo_profile_base_ceph_client_spec.rb
new file mode 100644
index 0000000..11367d2
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_ceph_client_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::ceph::client' do
+ shared_examples_for 'tripleo::profile::base::ceph::client' do
+ let (:pre_condition) do
+ <<-eof
+ class { '::tripleo::profile::base::ceph':
+ step => #{params[:step]}
+ }
+ eof
+ end
+
+ context 'with step less than 2' do
+ let(:params) { { :step => 1 } }
+ it 'should do nothing' do
+ is_expected.to contain_class('tripleo::profile::base::ceph::client')
+ is_expected.to contain_class('tripleo::profile::base::ceph')
+ is_expected.to_not contain_class('ceph::profile::client')
+ end
+ end
+
+ context 'with step 2' do
+ let(:params) { {
+ :step => 2,
+ } }
+
+ it 'should include client configuration' do
+ is_expected.to contain_class('tripleo::profile::base::ceph')
+ is_expected.to contain_class('ceph::profile::client')
+ 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::ceph::client'
+ end
+ end
+end
diff --git a/spec/classes/tripleo_profile_base_ceph_mon_spec.rb b/spec/classes/tripleo_profile_base_ceph_mon_spec.rb
new file mode 100644
index 0000000..d5dde4f
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_ceph_mon_spec.rb
@@ -0,0 +1,77 @@
+#
+# 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::ceph::mon' do
+ shared_examples_for 'tripleo::profile::base::ceph::mon' do
+ let (:pre_condition) do
+ <<-eof
+ class { '::tripleo::profile::base::ceph':
+ step => #{params[:step]}
+ }
+ eof
+ end
+
+ context 'with step less than 2' do
+ let(:params) { { :step => 1 } }
+ it 'should do nothing' do
+ is_expected.to contain_class('tripleo::profile::base::ceph::mon')
+ is_expected.to contain_class('tripleo::profile::base::ceph')
+ is_expected.to_not contain_class('ceph::profile::mon')
+ end
+ end
+
+ context 'with step 2' do
+ let(:params) { {
+ :step => 2,
+ } }
+
+ it 'should include mon configuration' do
+ is_expected.to contain_class('tripleo::profile::base::ceph')
+ is_expected.to contain_class('ceph::profile::mon')
+ end
+ end
+
+ context 'with step 4 create pools' do
+ let(:params) { {
+ :step => 4,
+ :ceph_pools => { 'mypool' => { 'size' => 5, 'pg_num' => 128, 'pgp_num' => 128 } }
+ } }
+
+ it 'should include mon configuration' do
+ is_expected.to contain_class('tripleo::profile::base::ceph')
+ is_expected.to contain_class('ceph::profile::mon')
+ is_expected.to contain_ceph__pool('mypool').with({
+ :size => 5,
+ :pg_num => 128,
+ :pgp_num => 128
+ })
+ 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::ceph::mon'
+ end
+ end
+end
diff --git a/spec/classes/tripleo_profile_base_ceph_osd_spec.rb b/spec/classes/tripleo_profile_base_ceph_osd_spec.rb
new file mode 100644
index 0000000..3008e12
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_ceph_osd_spec.rb
@@ -0,0 +1,75 @@
+#
+# 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::ceph::osd' do
+ shared_examples_for 'tripleo::profile::base::ceph::osd' do
+ let (:pre_condition) do
+ <<-eof
+ class { '::tripleo::profile::base::ceph':
+ step => #{params[:step]}
+ }
+ eof
+ 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::ceph::osd')
+ is_expected.to contain_class('tripleo::profile::base::ceph')
+ is_expected.to_not contain_class('ceph::profile::osd')
+ end
+ end
+
+ context 'with step 3 defaults' do
+ let(:params) { {
+ :step => 3,
+ } }
+
+ it 'should include osd configuration' do
+ is_expected.to contain_class('tripleo::profile::base::ceph')
+ is_expected.to contain_class('ceph::profile::osd')
+ is_expected.to_not contain_exec('set selinux to permissive on boot')
+ is_expected.to_not contain_exec('set selinux to permissive')
+ end
+ end
+
+ context 'with step 3 enable selinux permissive' do
+ let(:params) { {
+ :step => 3,
+ :ceph_osd_selinux_permissive => true
+ } }
+
+ it 'should include osd configuration' do
+ is_expected.to contain_class('tripleo::profile::base::ceph')
+ is_expected.to contain_class('ceph::profile::osd')
+ is_expected.to contain_exec('set selinux to permissive on boot')
+ is_expected.to contain_exec('set selinux to permissive')
+ 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::ceph::osd'
+ end
+ end
+end
diff --git a/spec/classes/tripleo_profile_base_ceph_rgw_spec.rb b/spec/classes/tripleo_profile_base_ceph_rgw_spec.rb
new file mode 100644
index 0000000..88f971b
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_ceph_rgw_spec.rb
@@ -0,0 +1,99 @@
+#
+# 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::ceph::rgw' do
+ shared_examples_for 'tripleo::profile::base::ceph::rgw' do
+ let (:pre_condition) do
+ <<-eof
+ class { '::tripleo::profile::base::ceph':
+ step => #{params[:step]}
+ }
+ eof
+ end
+
+ let (:default_params) do
+ {
+ :keystone_admin_token => 'token',
+ :keystone_url => 'url',
+ :rgw_key => 'key',
+ :civetweb_bind_ip => '2001:db8:0:1234:0:567:8:1',
+ :civetweb_bind_port => '8888',
+ }
+ end
+
+ context 'with step less than 3' do
+ let(:params) { default_params.merge({ :step => 1 }) }
+ it 'should do nothing' do
+ is_expected.to contain_class('tripleo::profile::base::ceph::rgw')
+ is_expected.to contain_class('tripleo::profile::base::ceph')
+ is_expected.to_not contain_class('ceph::rgw')
+ end
+ end
+
+ context 'with step 3' do
+ let(:params) { default_params.merge({ :step => 3 }) }
+ it 'should include rgw configuration' do
+ is_expected.to contain_class('tripleo::profile::base::ceph')
+ is_expected.to contain_ceph__rgw('radosgw.gateway').with(
+ :frontend_type => 'civetweb',
+ :rgw_frontends => 'civetweb port=[2001:db8:0:1234:0:567:8:1]:8888'
+ )
+ is_expected.to contain_ceph__key('client.radosgw.gateway').with(
+ :secret => 'key',
+ :cap_mon => 'allow *',
+ :cap_osd => 'allow *',
+ :inject => true
+ )
+ is_expected.to_not contain_ceph__rgw__keystone('radosgw.gateway')
+ end
+ end
+
+ context 'with step 4' do
+ let(:params) { default_params.merge({ :step => 4 }) }
+ it 'should include rgw configuration' do
+ is_expected.to contain_class('tripleo::profile::base::ceph')
+ is_expected.to contain_ceph__rgw('radosgw.gateway').with(
+ :frontend_type => 'civetweb',
+ :rgw_frontends => 'civetweb port=[2001:db8:0:1234:0:567:8:1]:8888'
+ )
+ is_expected.to contain_ceph__key('client.radosgw.gateway').with(
+ :secret => 'key',
+ :cap_mon => 'allow *',
+ :cap_osd => 'allow *',
+ :inject => true
+ )
+ is_expected.to contain_ceph__rgw__keystone('radosgw.gateway').with(
+ :rgw_keystone_accepted_roles => ['admin', '_member_', 'Member'],
+ :use_pki => false,
+ :rgw_keystone_admin_token => 'token',
+ :rgw_keystone_url => 'url'
+ )
+ 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::ceph::rgw'
+ end
+ end
+end
diff --git a/spec/classes/tripleo_profile_base_ceph_spec.rb b/spec/classes/tripleo_profile_base_ceph_spec.rb
new file mode 100644
index 0000000..1532fb7
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_ceph_spec.rb
@@ -0,0 +1,99 @@
+#
+# 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::ceph' do
+ shared_examples_for 'tripleo::profile::base::ceph' do
+ context 'with step less than 2' do
+ let(:params) { { :step => 1 } }
+ it 'should do nothing' do
+ is_expected.to contain_class('tripleo::profile::base::ceph')
+ is_expected.to_not contain_class('ceph::conf')
+ is_expected.to_not contain_class('ceph::profile::params')
+ end
+ end
+
+ context 'with step 2' do
+ let(:params) { {
+ :step => 2,
+ } }
+
+ it 'should trigger complete configuration' do
+ is_expected.to contain_class('ceph::profile::params').with(
+ :mon_initial_members => nil,
+ :mon_host => '127.0.0.1'
+ )
+ is_expected.to contain_class('ceph::conf')
+ end
+ end
+
+ context 'with step 2 with initial members' do
+ let(:params) { {
+ :step => 2,
+ :ceph_mon_initial_members => [ 'monA', 'monB', 'monc' ]
+ } }
+
+ it 'should trigger complete configuration' do
+ is_expected.to contain_class('ceph::profile::params').with(
+ :mon_initial_members => 'mona,monb,monc',
+ :mon_host => '127.0.0.1'
+ )
+ is_expected.to contain_class('ceph::conf')
+ end
+ end
+
+ context 'with step 2 with ipv4 mon host' do
+ let(:params) { {
+ :step => 2,
+ :ceph_mon_host => ['10.0.0.1', '10.0.0.2']
+ } }
+
+ it 'should trigger complete configuration' do
+ is_expected.to contain_class('ceph::profile::params').with(
+ :mon_initial_members => nil,
+ :mon_host => '10.0.0.1,10.0.0.2'
+ )
+ is_expected.to contain_class('ceph::conf')
+ end
+ end
+
+ context 'with step 2 with ipv6 mon host' do
+ let(:params) { {
+ :step => 2,
+ :ceph_mon_host => ['fe80::fc54:ff:fe9e:7846', '10.0.0.2']
+ } }
+
+ it 'should trigger complete configuration' do
+ is_expected.to contain_class('ceph::profile::params').with(
+ :mon_initial_members => nil,
+ :mon_host => '[fe80::fc54:ff:fe9e:7846],10.0.0.2'
+ )
+ is_expected.to contain_class('ceph::conf')
+ 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::ceph'
+ end
+ end
+end
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/classes/tripleo_ui_spec.rb b/spec/classes/tripleo_ui_spec.rb
new file mode 100644
index 0000000..588a944
--- /dev/null
+++ b/spec/classes/tripleo_ui_spec.rb
@@ -0,0 +1,99 @@
+#
+# 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::ui' do
+ shared_examples_for 'tripleo::ui' do
+ let(:pre_condition) do
+ 'include ::apache'
+ end
+
+ context 'with required parameters' do
+ let(:params) { {
+ :servername => facts[:hostname],
+ :bind_host => '127.0.0.1',
+ :keystone_url => 'http://127.0.0.1:5000/'
+ } }
+
+ it 'should configure tripleo ui' do
+ is_expected.to contain_class('tripleo::ui')
+ is_expected.to contain_apache__vhost('tripleo-ui').with(
+ :ensure => 'present',
+ :servername => facts[:hostname],
+ :ip => '127.0.0.1',
+ :port => 3000,
+ :docroot => '/var/www/openstack-tripleo-ui/dist',
+ :options => [ 'Indexes', 'FollowSymLinks' ],
+ :fallbackresource => '/index.html'
+ )
+ 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"/)
+ 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'
+ } }
+
+ it 'should configure tripleo ui' do
+ is_expected.to contain_class('tripleo::ui')
+ is_expected.to contain_apache__vhost('tripleo-ui').with(
+ :ensure => 'present',
+ :servername => 'custom.example.com',
+ :ip => '127.0.0.2',
+ :port => 3001,
+ :docroot => '/var/www/openstack-tripleo-ui/dist',
+ :options => [ 'Indexes', 'FollowSymLinks' ],
+ :fallbackresource => '/index.html'
+ )
+ 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"/)
+ 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::ui'
+ end
+ end
+end
diff --git a/spec/fixtures/hiera.yaml b/spec/fixtures/hiera.yaml
index 1dc3360..07bc836 100644
--- a/spec/fixtures/hiera.yaml
+++ b/spec/fixtures/hiera.yaml
@@ -4,4 +4,5 @@
:yaml:
:datadir: './spec/fixtures/hieradata'
:hierarchy:
- - default
+ - 'step%{::step}'
+ - 'default'
diff --git a/spec/fixtures/hieradata/default.yaml b/spec/fixtures/hieradata/default.yaml
index 0d0c944..d63fc76 100644
--- a/spec/fixtures/hieradata/default.yaml
+++ b/spec/fixtures/hieradata/default.yaml
@@ -1,3 +1,19 @@
+---
my_hash:
network: '127.0.0.1'
not_hash: string
+# aodh profile required hieradata
+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::db::mysql::password: 'password'
+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
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index b06b436..4fa8cc3 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -19,6 +19,8 @@ RSpec.configure do |c|
# custom global facts for all rspec tests
add_custom_fact :concat_basedir, '/var/lib/puppet/concat'
+ # needed for testing Puppet Openstack modules
+ add_custom_fact :os_service_default, '<SERVICE DEFAULT>'
end
at_exit { RSpec::Puppet::Coverage.report! }