diff --git a/manifests/dashboard/dashboard.pp b/manifests/dashboard/os_dashboard.pp similarity index 94% rename from manifests/dashboard/dashboard.pp rename to manifests/dashboard/os_dashboard.pp index 4fbfad58..08af688d 100644 --- a/manifests/dashboard/dashboard.pp +++ b/manifests/dashboard/os_dashboard.pp @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. # -# == Class: os_dashboard +# == Class: dashboard::os_dashboard # # Installs the OpenStack Dashboard (Horizon) # @@ -42,7 +42,7 @@ # Defaults false # -class os_dashboard( +class dashboard::os_dashboard( $ks_keystone_internal_host = $os_params::ks_keystone_internal_host, $secret_key = $os_params::secret_key, $horizon_port = $os_params::horizon_port, @@ -56,7 +56,7 @@ class os_dashboard( can_set_mount_point => 'False', # fqdn can can be ambiguous since we use reverse DNS here, # e.g: 127.0.0.1 instead of a public IP address. - # We forge $local_ip to avoid this situatioe + # We force $local_ip to avoid this situation fqdn => $local_ip } diff --git a/site.pp b/site.pp index 08f463b0..55d8575c 100644 --- a/site.pp +++ b/site.pp @@ -66,7 +66,7 @@ node 'os-ci-test13', 'os-ci-test12', 'os-ci-test11', /mgmt\d+.enovance.com/ inhe class {'os_sql_node':} ## Dashboard: - class {'os_dashboard':} + class {'dashboard::os_dashboard':} ## Telemetry class {'os_telemetry_common':} diff --git a/spec/classes/dashboard_spec.rb b/spec/classes/dashboard_spec.rb new file mode 100644 index 00000000..2c1b4ac3 --- /dev/null +++ b/spec/classes/dashboard_spec.rb @@ -0,0 +1,59 @@ +# +# Copyright (C) 2013 eNovance SAS +# +# 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 os_dashboard +# + +require 'spec_helper' + +describe 'dashboard::os_dashboard' do + + let :default_params do + { :listen_ssl => false } + end + + let :params do + {} + end + + shared_examples_for 'openstack dashboard' do + let :p do + default_params.merge(params) + end + + it 'configure horizon' do + should contain_class('horizon').with( + :listen_ssl => 'False' + ) + end + end + + context 'on Debian platforms' do + let :facts do + { :osfamily => 'Debian' } + end + + it_configures 'openstack dashboard' + end + + context 'on RedHat platforms' do + let :facts do + { :osfamily => 'RedHat' } + end + + it_configures 'openstack dashboard' + end + +end diff --git a/spec/fixtures/manifests/site.pp b/spec/fixtures/manifests/site.pp new file mode 100644 index 00000000..e69de29b diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 2c6f5664..eb9c22ef 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1 +1,7 @@ require 'puppetlabs_spec_helper/module_spec_helper' +#require 'shared_examples' + +RSpec.configure do |c| + c.alias_it_should_behave_like_to :it_configures, 'configures' + c.alias_it_should_behave_like_to :it_raises, 'raises' +end