orchestration: Add unit test full coverage

- Unit tests for Heat API & Engine
- Update manifest to support auth_key param

Signed-off-by: Emilien Macchi <emilien.macchi@enovance.com>
This commit is contained in:
Emilien Macchi
2014-01-06 14:50:20 +01:00
parent 363bef1103
commit f7747475ad
3 changed files with 116 additions and 34 deletions

View File

@@ -22,12 +22,14 @@ class privatecloud::orchestration::engine(
$ks_heat_public_host = $os_params::ks_heat_public_host,
$ks_heat_public_proto = $os_params::ks_heat_public_proto,
$ks_heat_password = $os_params::ks_heat_password,
$auth_encryption_key = $os_params::auth_encryption_key
) {
include 'privatecloud::orchestration'
class { 'heat::engine':
enabled => $enabled,
auth_encryption_key => $auth_encryption_key,
heat_metadata_server_url => "${ks_heat_public_proto}://${ks_heat_public_host}:8000",
heat_waitcondition_server_url => "${ks_heat_public_proto}://${ks_heat_public_host}:8000/v1/waitcondition",
heat_watch_server_url => "${ks_heat_public_proto}://${ks_heat_public_host}:8003"

View File

@@ -32,6 +32,9 @@ describe 'privatecloud::orchestration::api' do
ks_keystone_admin_host => '10.0.0.1',
ks_keystone_admin_port => '5000',
ks_keystone_admin_proto => 'http',
ks_heat_public_host => '10.0.0.1',
ks_heat_public_proto => 'http',
ks_heat_password => 'secrete',
heat_db_host => '10.0.0.1',
heat_db_user => 'heat',
heat_db_password => 'secrete',
@@ -40,8 +43,9 @@ describe 'privatecloud::orchestration::api' do
end
let :params do
{ :ks_heat_internal_port => '80040',
:ks_heat_internal_port => '80040',
{ :ks_heat_internal_port => '8004',
:ks_heat_cfn_internal_port => '8000',
:ks_heat_cloudwatch_internal_port => '8003',
:api_eth => '10.0.0.1' }
end
@@ -57,42 +61,22 @@ describe 'privatecloud::orchestration::api' do
:keystone_protocol => 'http',
:keystone_password => 'secrete',
:auth_uri => 'http://10.0.0.1:5000/v2.0',
:sql_connection => 'mysql://heat:secrete@10.0.0.1/heat',
:metering_secret => 'secrete'
:sql_connection => 'mysql://heat:secrete@10.0.0.1/heat'
)
end
it 'configure ceilometer db' do
should contain_class('ceilometer::db').with(
:database_connection => 'mongodb://10.0.0.2/ceilometer'
it 'configure heat api' do
should contain_class('heat::api').with(
:bind_host => '10.0.0.1',
:bind_port => '8004'
)
end
it 'configure ceilometer collector' do
should contain_class('ceilometer::collector')
end
it 'configure ceilometer alarm evaluator' do
should contain_class('ceilometer::alarm::evaluator')
end
it 'configure ceilometer alarm notifier' do
should contain_class('ceilometer::alarm::notifier')
end
it 'configure ceilometer-api' do
should contain_class('ceilometer::api').with(
:keystone_password => 'secrete',
:keystone_host => '10.0.0.1',
:keystone_protocol => 'http',
should contain_class('heat::api_cfn').with(
:bind_host => '10.0.0.1',
:bind_port => '8000'
)
end
it 'configure ceilometer-expirer' do
should contain_class('ceilometer::expirer').with(
:time_to_live => '2592000',
:minute => '0',
:hour => '0',
should contain_class('heat::api_cloudwatch').with(
:bind_host => '10.0.0.1',
:bind_port => '8003'
)
end

View File

@@ -0,0 +1,96 @@
#
# Copyright (C) 2014 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 privatecloud::orchestration::engine class
#
require 'spec_helper'
describe 'privatecloud::orchestration::engine' do
shared_examples_for 'openstack orchestration engine' do
let :pre_condition do
"class { 'privatecloud::orchestration':
rabbit_hosts => ['10.0.0.1'],
rabbit_password => 'secrete',
ks_keystone_internal_host => '10.0.0.1',
ks_keystone_internal_port => '5000',
ks_keystone_internal_proto => 'http',
ks_keystone_admin_host => '10.0.0.1',
ks_keystone_admin_port => '5000',
ks_keystone_admin_proto => 'http',
ks_heat_public_host => '10.0.0.1',
ks_heat_public_proto => 'http',
ks_heat_password => 'secrete',
heat_db_host => '10.0.0.1',
heat_db_user => 'heat',
heat_db_password => 'secrete',
verbose => true,
debug => true }"
end
let :params do
{ :enabled => true,
:auth_encryption_key => 'secrete',
:ks_heat_public_host => '10.0.0.1',
:ks_heat_public_proto => 'http',
:ks_heat_password => 'secrete' }
end
it 'configure heat common' do
should contain_class('heat').with(
:verbose => true,
:debug => true,
:rabbit_userid => 'heat',
:rabbit_hosts => ['10.0.0.1'],
:rabbit_password => 'secrete',
:keystone_host => '10.0.0.1',
:keystone_port => '5000',
:keystone_protocol => 'http',
:keystone_password => 'secrete',
:auth_uri => 'http://10.0.0.1:5000/v2.0',
:sql_connection => 'mysql://heat:secrete@10.0.0.1/heat'
)
end
it 'configure heat engine' do
should contain_class('heat::engine').with(
:enabled => true,
:heat_metadata_server_url => 'http://10.0.0.1:8000',
:heat_waitcondition_server_url => 'http://10.0.0.1:8000/v1/waitcondition',
:heat_watch_server_url => 'http://10.0.0.1:8003'
)
end
end
context 'on Debian platforms' do
let :facts do
{ :osfamily => 'Debian' }
end
it_configures 'openstack orchestration engine'
end
context 'on RedHat platforms' do
let :facts do
{ :osfamily => 'RedHat' }
end
it_configures 'openstack orchestration engine'
end
end