WIP - Add first unit tests

First unit tests for dashboard class.
Still WIP because they fail.

Signed-off-by: Emilien Macchi <emilien.macchi@enovance.com>
This commit is contained in:
Emilien Macchi 2013-12-28 11:24:06 +01:00
parent 9566070ccc
commit 642dee081d
5 changed files with 69 additions and 4 deletions

View File

@ -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
}

View File

@ -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':}

View File

@ -0,0 +1,59 @@
#
# Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
#
# 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

0
spec/fixtures/manifests/site.pp vendored Normal file
View File

View File

@ -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