Merge pull request #472 from enovance/split_unit_tests
Split unit tests
This commit is contained in:
commit
d94a1b9e94
123
spec/classes/cloud_compute_api_spec.rb
Normal file
123
spec/classes/cloud_compute_api_spec.rb
Normal file
@ -0,0 +1,123 @@
|
||||
#
|
||||
# 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 cloud::compute::api class
|
||||
#
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'cloud::compute::api' do
|
||||
|
||||
shared_examples_for 'openstack compute api' do
|
||||
|
||||
let :pre_condition do
|
||||
"class { 'cloud::compute':
|
||||
availability_zone => 'MyZone',
|
||||
nova_db_host => '10.0.0.1',
|
||||
nova_db_user => 'nova',
|
||||
nova_db_password => 'secrete',
|
||||
rabbit_hosts => ['10.0.0.1'],
|
||||
rabbit_password => 'secrete',
|
||||
ks_glance_internal_host => '10.0.0.1',
|
||||
glance_api_port => '9292',
|
||||
verbose => true,
|
||||
debug => true,
|
||||
use_syslog => true,
|
||||
neutron_protocol => 'http',
|
||||
neutron_endpoint => '10.0.0.1',
|
||||
neutron_region_name => 'MyRegion',
|
||||
neutron_password => 'secrete',
|
||||
memcache_servers => ['10.0.0.1','10.0.0.2'],
|
||||
log_facility => 'LOG_LOCAL0' }"
|
||||
end
|
||||
|
||||
let :params do
|
||||
{ :ks_keystone_internal_host => '127.0.0.1',
|
||||
:ks_nova_password => 'novapassword',
|
||||
:api_eth => '127.0.0.1',
|
||||
:ks_ec2_public_port => '8773',
|
||||
:ks_nova_public_port => '8774',
|
||||
:ks_metadata_public_port => '8775',
|
||||
:neutron_metadata_proxy_shared_secret => 'metadatapassword' }
|
||||
end
|
||||
|
||||
it 'configure nova common' do
|
||||
should contain_class('nova').with(
|
||||
:verbose => true,
|
||||
:debug => true,
|
||||
:use_syslog => true,
|
||||
:log_facility => 'LOG_LOCAL0',
|
||||
:rabbit_userid => 'nova',
|
||||
:rabbit_hosts => ['10.0.0.1'],
|
||||
:rabbit_password => 'secrete',
|
||||
:rabbit_virtual_host => '/',
|
||||
:memcached_servers => ['10.0.0.1','10.0.0.2'],
|
||||
:database_connection => 'mysql://nova:secrete@10.0.0.1/nova?charset=utf8',
|
||||
:glance_api_servers => 'http://10.0.0.1:9292',
|
||||
:log_dir => false
|
||||
)
|
||||
should contain_nova_config('DEFAULT/resume_guests_state_on_host_boot').with('value' => true)
|
||||
should contain_nova_config('DEFAULT/default_availability_zone').with('value' => 'MyZone')
|
||||
should contain_nova_config('DEFAULT/servicegroup_driver').with_value('mc')
|
||||
end
|
||||
|
||||
it 'configure neutron on compute node' do
|
||||
should contain_class('nova::network::neutron').with(
|
||||
:neutron_admin_password => 'secrete',
|
||||
:neutron_admin_auth_url => 'http://10.0.0.1:35357/v2.0',
|
||||
:neutron_region_name => 'MyRegion',
|
||||
:neutron_url => 'http://10.0.0.1:9696'
|
||||
)
|
||||
end
|
||||
|
||||
it 'checks if Nova DB is populated' do
|
||||
should contain_exec('nova_db_sync').with(
|
||||
:command => 'nova-manage db sync',
|
||||
:user => 'nova',
|
||||
:path => '/usr/bin',
|
||||
:unless => '/usr/bin/mysql nova -h 10.0.0.1 -u nova -psecrete -e "show tables" | /bin/grep Tables'
|
||||
)
|
||||
end
|
||||
|
||||
it 'configure nova-api' do
|
||||
should contain_class('nova::api').with(
|
||||
:enabled => true,
|
||||
:auth_host => '127.0.0.1',
|
||||
:admin_password => 'novapassword',
|
||||
:api_bind_address => '127.0.0.1',
|
||||
:metadata_listen => '127.0.0.1',
|
||||
:neutron_metadata_proxy_shared_secret => 'metadatapassword',
|
||||
:osapi_v3 => true
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian' }
|
||||
end
|
||||
|
||||
it_configures 'openstack compute api'
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'RedHat' }
|
||||
end
|
||||
it_configures 'openstack compute api'
|
||||
end
|
||||
|
||||
end
|
105
spec/classes/cloud_compute_cert_spec.rb
Normal file
105
spec/classes/cloud_compute_cert_spec.rb
Normal file
@ -0,0 +1,105 @@
|
||||
#
|
||||
# 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 cloud::compute::cert class
|
||||
#
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'cloud::compute::cert' do
|
||||
|
||||
shared_examples_for 'openstack compute cert' do
|
||||
|
||||
let :pre_condition do
|
||||
"class { 'cloud::compute':
|
||||
availability_zone => 'MyZone',
|
||||
nova_db_host => '10.0.0.1',
|
||||
nova_db_user => 'nova',
|
||||
nova_db_password => 'secrete',
|
||||
rabbit_hosts => ['10.0.0.1'],
|
||||
rabbit_password => 'secrete',
|
||||
ks_glance_internal_host => '10.0.0.1',
|
||||
glance_api_port => '9292',
|
||||
verbose => true,
|
||||
debug => true,
|
||||
use_syslog => true,
|
||||
neutron_protocol => 'http',
|
||||
neutron_endpoint => '10.0.0.1',
|
||||
neutron_region_name => 'MyRegion',
|
||||
neutron_password => 'secrete',
|
||||
memcache_servers => ['10.0.0.1','10.0.0.2'],
|
||||
log_facility => 'LOG_LOCAL0' }"
|
||||
end
|
||||
|
||||
it 'configure nova common' do
|
||||
should contain_class('nova').with(
|
||||
:verbose => true,
|
||||
:debug => true,
|
||||
:use_syslog => true,
|
||||
:log_facility => 'LOG_LOCAL0',
|
||||
:rabbit_userid => 'nova',
|
||||
:rabbit_hosts => ['10.0.0.1'],
|
||||
:rabbit_password => 'secrete',
|
||||
:rabbit_virtual_host => '/',
|
||||
:memcached_servers => ['10.0.0.1','10.0.0.2'],
|
||||
:database_connection => 'mysql://nova:secrete@10.0.0.1/nova?charset=utf8',
|
||||
:glance_api_servers => 'http://10.0.0.1:9292',
|
||||
:log_dir => false
|
||||
)
|
||||
should contain_nova_config('DEFAULT/resume_guests_state_on_host_boot').with('value' => true)
|
||||
should contain_nova_config('DEFAULT/default_availability_zone').with('value' => 'MyZone')
|
||||
should contain_nova_config('DEFAULT/servicegroup_driver').with_value('mc')
|
||||
end
|
||||
|
||||
it 'configure neutron on compute node' do
|
||||
should contain_class('nova::network::neutron').with(
|
||||
:neutron_admin_password => 'secrete',
|
||||
:neutron_admin_auth_url => 'http://10.0.0.1:35357/v2.0',
|
||||
:neutron_region_name => 'MyRegion',
|
||||
:neutron_url => 'http://10.0.0.1:9696'
|
||||
)
|
||||
end
|
||||
|
||||
it 'checks if Nova DB is populated' do
|
||||
should contain_exec('nova_db_sync').with(
|
||||
:command => 'nova-manage db sync',
|
||||
:user => 'nova',
|
||||
:path => '/usr/bin',
|
||||
:unless => '/usr/bin/mysql nova -h 10.0.0.1 -u nova -psecrete -e "show tables" | /bin/grep Tables'
|
||||
)
|
||||
end
|
||||
|
||||
it 'configure nova-cert' do
|
||||
should contain_class('nova::cert').with(:enabled => true)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian' }
|
||||
end
|
||||
|
||||
it_configures 'openstack compute cert'
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'RedHat' }
|
||||
end
|
||||
it_configures 'openstack compute cert'
|
||||
end
|
||||
|
||||
end
|
105
spec/classes/cloud_compute_conductor_spec.rb
Normal file
105
spec/classes/cloud_compute_conductor_spec.rb
Normal file
@ -0,0 +1,105 @@
|
||||
#
|
||||
# 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 cloud::compute::conductor class
|
||||
#
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'cloud::compute::conductor' do
|
||||
|
||||
shared_examples_for 'openstack compute conductor' do
|
||||
|
||||
let :pre_condition do
|
||||
"class { 'cloud::compute':
|
||||
availability_zone => 'MyZone',
|
||||
nova_db_host => '10.0.0.1',
|
||||
nova_db_user => 'nova',
|
||||
nova_db_password => 'secrete',
|
||||
rabbit_hosts => ['10.0.0.1'],
|
||||
rabbit_password => 'secrete',
|
||||
ks_glance_internal_host => '10.0.0.1',
|
||||
glance_api_port => '9292',
|
||||
verbose => true,
|
||||
debug => true,
|
||||
use_syslog => true,
|
||||
neutron_protocol => 'http',
|
||||
neutron_endpoint => '10.0.0.1',
|
||||
neutron_region_name => 'MyRegion',
|
||||
neutron_password => 'secrete',
|
||||
memcache_servers => ['10.0.0.1','10.0.0.2'],
|
||||
log_facility => 'LOG_LOCAL0' }"
|
||||
end
|
||||
|
||||
it 'configure nova common' do
|
||||
should contain_class('nova').with(
|
||||
:verbose => true,
|
||||
:debug => true,
|
||||
:use_syslog => true,
|
||||
:log_facility => 'LOG_LOCAL0',
|
||||
:rabbit_userid => 'nova',
|
||||
:rabbit_hosts => ['10.0.0.1'],
|
||||
:rabbit_password => 'secrete',
|
||||
:rabbit_virtual_host => '/',
|
||||
:memcached_servers => ['10.0.0.1','10.0.0.2'],
|
||||
:database_connection => 'mysql://nova:secrete@10.0.0.1/nova?charset=utf8',
|
||||
:glance_api_servers => 'http://10.0.0.1:9292',
|
||||
:log_dir => false
|
||||
)
|
||||
should contain_nova_config('DEFAULT/resume_guests_state_on_host_boot').with('value' => true)
|
||||
should contain_nova_config('DEFAULT/default_availability_zone').with('value' => 'MyZone')
|
||||
should contain_nova_config('DEFAULT/servicegroup_driver').with_value('mc')
|
||||
end
|
||||
|
||||
it 'configure neutron on compute node' do
|
||||
should contain_class('nova::network::neutron').with(
|
||||
:neutron_admin_password => 'secrete',
|
||||
:neutron_admin_auth_url => 'http://10.0.0.1:35357/v2.0',
|
||||
:neutron_region_name => 'MyRegion',
|
||||
:neutron_url => 'http://10.0.0.1:9696'
|
||||
)
|
||||
end
|
||||
|
||||
it 'checks if Nova DB is populated' do
|
||||
should contain_exec('nova_db_sync').with(
|
||||
:command => 'nova-manage db sync',
|
||||
:user => 'nova',
|
||||
:path => '/usr/bin',
|
||||
:unless => '/usr/bin/mysql nova -h 10.0.0.1 -u nova -psecrete -e "show tables" | /bin/grep Tables'
|
||||
)
|
||||
end
|
||||
|
||||
it 'configure nova-conductor' do
|
||||
should contain_class('nova::conductor').with(:enabled => true)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian' }
|
||||
end
|
||||
|
||||
it_configures 'openstack compute conductor'
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'RedHat' }
|
||||
end
|
||||
it_configures 'openstack compute conductor'
|
||||
end
|
||||
|
||||
end
|
105
spec/classes/cloud_compute_consoleauth_spec.rb
Normal file
105
spec/classes/cloud_compute_consoleauth_spec.rb
Normal file
@ -0,0 +1,105 @@
|
||||
#
|
||||
# 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 cloud::compute::consoleauth class
|
||||
#
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'cloud::compute::consoleauth' do
|
||||
|
||||
shared_examples_for 'openstack compute consoleauth' do
|
||||
|
||||
let :pre_condition do
|
||||
"class { 'cloud::compute':
|
||||
availability_zone => 'MyZone',
|
||||
nova_db_host => '10.0.0.1',
|
||||
nova_db_user => 'nova',
|
||||
nova_db_password => 'secrete',
|
||||
rabbit_hosts => ['10.0.0.1'],
|
||||
rabbit_password => 'secrete',
|
||||
ks_glance_internal_host => '10.0.0.1',
|
||||
glance_api_port => '9292',
|
||||
verbose => true,
|
||||
debug => true,
|
||||
use_syslog => true,
|
||||
neutron_protocol => 'http',
|
||||
neutron_endpoint => '10.0.0.1',
|
||||
neutron_region_name => 'MyRegion',
|
||||
neutron_password => 'secrete',
|
||||
memcache_servers => ['10.0.0.1','10.0.0.2'],
|
||||
log_facility => 'LOG_LOCAL0' }"
|
||||
end
|
||||
|
||||
it 'configure nova common' do
|
||||
should contain_class('nova').with(
|
||||
:verbose => true,
|
||||
:debug => true,
|
||||
:use_syslog => true,
|
||||
:log_facility => 'LOG_LOCAL0',
|
||||
:rabbit_userid => 'nova',
|
||||
:rabbit_hosts => ['10.0.0.1'],
|
||||
:rabbit_password => 'secrete',
|
||||
:rabbit_virtual_host => '/',
|
||||
:memcached_servers => ['10.0.0.1','10.0.0.2'],
|
||||
:database_connection => 'mysql://nova:secrete@10.0.0.1/nova?charset=utf8',
|
||||
:glance_api_servers => 'http://10.0.0.1:9292',
|
||||
:log_dir => false
|
||||
)
|
||||
should contain_nova_config('DEFAULT/resume_guests_state_on_host_boot').with('value' => true)
|
||||
should contain_nova_config('DEFAULT/default_availability_zone').with('value' => 'MyZone')
|
||||
should contain_nova_config('DEFAULT/servicegroup_driver').with_value('mc')
|
||||
end
|
||||
|
||||
it 'configure neutron on compute node' do
|
||||
should contain_class('nova::network::neutron').with(
|
||||
:neutron_admin_password => 'secrete',
|
||||
:neutron_admin_auth_url => 'http://10.0.0.1:35357/v2.0',
|
||||
:neutron_region_name => 'MyRegion',
|
||||
:neutron_url => 'http://10.0.0.1:9696'
|
||||
)
|
||||
end
|
||||
|
||||
it 'checks if Nova DB is populated' do
|
||||
should contain_exec('nova_db_sync').with(
|
||||
:command => 'nova-manage db sync',
|
||||
:user => 'nova',
|
||||
:path => '/usr/bin',
|
||||
:unless => '/usr/bin/mysql nova -h 10.0.0.1 -u nova -psecrete -e "show tables" | /bin/grep Tables'
|
||||
)
|
||||
end
|
||||
|
||||
it 'configure nova-consoleauth' do
|
||||
should contain_class('nova::consoleauth').with(:enabled => true)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian' }
|
||||
end
|
||||
|
||||
it_configures 'openstack compute consoleauth'
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'RedHat' }
|
||||
end
|
||||
it_configures 'openstack compute consoleauth'
|
||||
end
|
||||
|
||||
end
|
113
spec/classes/cloud_compute_consoleproxy_spec.rb
Normal file
113
spec/classes/cloud_compute_consoleproxy_spec.rb
Normal file
@ -0,0 +1,113 @@
|
||||
#
|
||||
# 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 cloud::compute::consoleproxy class
|
||||
#
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'cloud::compute::consoleproxy' do
|
||||
|
||||
shared_examples_for 'openstack compute consoleproxy' do
|
||||
|
||||
let :pre_condition do
|
||||
"class { 'cloud::compute':
|
||||
availability_zone => 'MyZone',
|
||||
nova_db_host => '10.0.0.1',
|
||||
nova_db_user => 'nova',
|
||||
nova_db_password => 'secrete',
|
||||
rabbit_hosts => ['10.0.0.1'],
|
||||
rabbit_password => 'secrete',
|
||||
ks_glance_internal_host => '10.0.0.1',
|
||||
glance_api_port => '9292',
|
||||
verbose => true,
|
||||
debug => true,
|
||||
use_syslog => true,
|
||||
neutron_protocol => 'http',
|
||||
neutron_endpoint => '10.0.0.1',
|
||||
neutron_region_name => 'MyRegion',
|
||||
neutron_password => 'secrete',
|
||||
memcache_servers => ['10.0.0.1','10.0.0.2'],
|
||||
log_facility => 'LOG_LOCAL0' }"
|
||||
end
|
||||
|
||||
let :params do
|
||||
{ :api_eth => '10.0.0.1',
|
||||
:spice_port => '6082' }
|
||||
end
|
||||
|
||||
it 'configure nova common' do
|
||||
should contain_class('nova').with(
|
||||
:verbose => true,
|
||||
:debug => true,
|
||||
:use_syslog => true,
|
||||
:log_facility => 'LOG_LOCAL0',
|
||||
:rabbit_userid => 'nova',
|
||||
:rabbit_hosts => ['10.0.0.1'],
|
||||
:rabbit_password => 'secrete',
|
||||
:rabbit_virtual_host => '/',
|
||||
:memcached_servers => ['10.0.0.1','10.0.0.2'],
|
||||
:database_connection => 'mysql://nova:secrete@10.0.0.1/nova?charset=utf8',
|
||||
:glance_api_servers => 'http://10.0.0.1:9292',
|
||||
:log_dir => false
|
||||
)
|
||||
should contain_nova_config('DEFAULT/resume_guests_state_on_host_boot').with('value' => true)
|
||||
should contain_nova_config('DEFAULT/default_availability_zone').with('value' => 'MyZone')
|
||||
should contain_nova_config('DEFAULT/servicegroup_driver').with_value('mc')
|
||||
end
|
||||
|
||||
it 'configure neutron on compute node' do
|
||||
should contain_class('nova::network::neutron').with(
|
||||
:neutron_admin_password => 'secrete',
|
||||
:neutron_admin_auth_url => 'http://10.0.0.1:35357/v2.0',
|
||||
:neutron_region_name => 'MyRegion',
|
||||
:neutron_url => 'http://10.0.0.1:9696'
|
||||
)
|
||||
end
|
||||
|
||||
it 'checks if Nova DB is populated' do
|
||||
should contain_exec('nova_db_sync').with(
|
||||
:command => 'nova-manage db sync',
|
||||
:user => 'nova',
|
||||
:path => '/usr/bin',
|
||||
:unless => '/usr/bin/mysql nova -h 10.0.0.1 -u nova -psecrete -e "show tables" | /bin/grep Tables'
|
||||
)
|
||||
end
|
||||
|
||||
it 'configure nova-spicehtml5proxy' do
|
||||
should contain_class('nova::spicehtml5proxy').with(
|
||||
:enabled => true,
|
||||
:host => '10.0.0.1'
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian' }
|
||||
end
|
||||
|
||||
it_configures 'openstack compute consoleproxy'
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'RedHat' }
|
||||
end
|
||||
it_configures 'openstack compute consoleproxy'
|
||||
end
|
||||
|
||||
end
|
105
spec/classes/cloud_compute_scheduler_spec.rb
Normal file
105
spec/classes/cloud_compute_scheduler_spec.rb
Normal file
@ -0,0 +1,105 @@
|
||||
#
|
||||
# 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 cloud::compute::scheduler class
|
||||
#
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'cloud::compute::scheduler' do
|
||||
|
||||
shared_examples_for 'openstack compute scheduler' do
|
||||
|
||||
let :pre_condition do
|
||||
"class { 'cloud::compute':
|
||||
availability_zone => 'MyZone',
|
||||
nova_db_host => '10.0.0.1',
|
||||
nova_db_user => 'nova',
|
||||
nova_db_password => 'secrete',
|
||||
rabbit_hosts => ['10.0.0.1'],
|
||||
rabbit_password => 'secrete',
|
||||
ks_glance_internal_host => '10.0.0.1',
|
||||
glance_api_port => '9292',
|
||||
verbose => true,
|
||||
debug => true,
|
||||
use_syslog => true,
|
||||
neutron_protocol => 'http',
|
||||
neutron_endpoint => '10.0.0.1',
|
||||
neutron_region_name => 'MyRegion',
|
||||
neutron_password => 'secrete',
|
||||
memcache_servers => ['10.0.0.1','10.0.0.2'],
|
||||
log_facility => 'LOG_LOCAL0' }"
|
||||
end
|
||||
|
||||
it 'configure nova common' do
|
||||
should contain_class('nova').with(
|
||||
:verbose => true,
|
||||
:debug => true,
|
||||
:use_syslog => true,
|
||||
:log_facility => 'LOG_LOCAL0',
|
||||
:rabbit_userid => 'nova',
|
||||
:rabbit_hosts => ['10.0.0.1'],
|
||||
:rabbit_password => 'secrete',
|
||||
:rabbit_virtual_host => '/',
|
||||
:memcached_servers => ['10.0.0.1','10.0.0.2'],
|
||||
:database_connection => 'mysql://nova:secrete@10.0.0.1/nova?charset=utf8',
|
||||
:glance_api_servers => 'http://10.0.0.1:9292',
|
||||
:log_dir => false
|
||||
)
|
||||
should contain_nova_config('DEFAULT/resume_guests_state_on_host_boot').with('value' => true)
|
||||
should contain_nova_config('DEFAULT/default_availability_zone').with('value' => 'MyZone')
|
||||
should contain_nova_config('DEFAULT/servicegroup_driver').with_value('mc')
|
||||
end
|
||||
|
||||
it 'configure neutron on compute node' do
|
||||
should contain_class('nova::network::neutron').with(
|
||||
:neutron_admin_password => 'secrete',
|
||||
:neutron_admin_auth_url => 'http://10.0.0.1:35357/v2.0',
|
||||
:neutron_region_name => 'MyRegion',
|
||||
:neutron_url => 'http://10.0.0.1:9696'
|
||||
)
|
||||
end
|
||||
|
||||
it 'checks if Nova DB is populated' do
|
||||
should contain_exec('nova_db_sync').with(
|
||||
:command => 'nova-manage db sync',
|
||||
:user => 'nova',
|
||||
:path => '/usr/bin',
|
||||
:unless => '/usr/bin/mysql nova -h 10.0.0.1 -u nova -psecrete -e "show tables" | /bin/grep Tables'
|
||||
)
|
||||
end
|
||||
|
||||
it 'configure nova-scheduler' do
|
||||
should contain_class('nova::scheduler').with(:enabled => true)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian' }
|
||||
end
|
||||
|
||||
it_configures 'openstack compute scheduler'
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'RedHat' }
|
||||
end
|
||||
it_configures 'openstack compute scheduler'
|
||||
end
|
||||
|
||||
end
|
109
spec/classes/cloud_image_api_spec.rb
Normal file
109
spec/classes/cloud_image_api_spec.rb
Normal file
@ -0,0 +1,109 @@
|
||||
#
|
||||
# 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 cloud::image class
|
||||
#
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'cloud::image::api' do
|
||||
|
||||
let :params do
|
||||
{ :glance_db_host => '10.0.0.1',
|
||||
:glance_db_user => 'glance',
|
||||
:glance_db_password => 'secrete',
|
||||
:ks_keystone_internal_host => '10.0.0.1',
|
||||
:ks_glance_internal_host => '10.0.0.1',
|
||||
:openstack_vip => '10.0.0.42',
|
||||
:ks_glance_api_internal_port => '9292',
|
||||
:ks_glance_registry_internal_port => '9191',
|
||||
:ks_glance_password => 'secrete',
|
||||
:rabbit_host => '10.0.0.1',
|
||||
:rabbit_password => 'secrete',
|
||||
:glance_rbd_user => 'glance',
|
||||
:glance_rbd_pool => 'images',
|
||||
:debug => true,
|
||||
:verbose => true,
|
||||
:use_syslog => true,
|
||||
:log_facility => 'LOG_LOCAL0',
|
||||
:api_eth => '10.0.0.1'
|
||||
}
|
||||
end
|
||||
|
||||
shared_examples_for 'openstack image api' do
|
||||
|
||||
it 'configure glance-api' do
|
||||
should contain_class('glance::api').with(
|
||||
:database_connection => 'mysql://glance:secrete@10.0.0.1/glance?charset=utf8',
|
||||
:keystone_password => 'secrete',
|
||||
:registry_host => '10.0.0.42',
|
||||
:registry_port => '9191',
|
||||
:keystone_tenant => 'services',
|
||||
:keystone_user => 'glance',
|
||||
:show_image_direct_url => true,
|
||||
:verbose => true,
|
||||
:debug => true,
|
||||
:auth_host => '10.0.0.1',
|
||||
:log_facility => 'LOG_LOCAL0',
|
||||
:bind_host => '10.0.0.1',
|
||||
:bind_port => '9292',
|
||||
:use_syslog => true,
|
||||
:log_dir => false,
|
||||
:log_file => false
|
||||
)
|
||||
end
|
||||
|
||||
# TODO(EmilienM) Disabled for now
|
||||
# Follow-up https://github.com/enovance/puppet-openstack-cloud/issues/160
|
||||
#
|
||||
# it 'configure glance notifications with rabbitmq backend' do
|
||||
# should contain_class('glance::notify::rabbitmq').with(
|
||||
# :rabbit_password => 'secrete',
|
||||
# :rabbit_userid => 'glance',
|
||||
# :rabbit_host => '10.0.0.1'
|
||||
# )
|
||||
# end
|
||||
it { should contain_glance_api_config('DEFAULT/notifier_driver').with_value('noop') }
|
||||
|
||||
it 'configure glance rbd backend' do
|
||||
should contain_class('glance::backend::rbd').with(
|
||||
:rbd_store_pool => 'images',
|
||||
:rbd_store_user => 'glance'
|
||||
)
|
||||
end
|
||||
|
||||
it 'configure crontab to clean glance cache' do
|
||||
should contain_class('glance::cache::cleaner')
|
||||
should contain_class('glance::cache::pruner')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian' }
|
||||
end
|
||||
|
||||
it_configures 'openstack image api'
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'RedHat' }
|
||||
end
|
||||
|
||||
it_configures 'openstack image api'
|
||||
end
|
||||
|
||||
end
|
84
spec/classes/cloud_image_registry_spec.rb
Normal file
84
spec/classes/cloud_image_registry_spec.rb
Normal file
@ -0,0 +1,84 @@
|
||||
#
|
||||
# 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 cloud::image class
|
||||
#
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'cloud::image::registry' do
|
||||
|
||||
let :params do
|
||||
{ :glance_db_host => '10.0.0.1',
|
||||
:glance_db_user => 'glance',
|
||||
:glance_db_password => 'secrete',
|
||||
:ks_keystone_internal_host => '10.0.0.1',
|
||||
:ks_glance_internal_host => '10.0.0.1',
|
||||
:ks_glance_registry_internal_port => '9191',
|
||||
:ks_glance_password => 'secrete',
|
||||
:debug => true,
|
||||
:verbose => true,
|
||||
:use_syslog => true,
|
||||
:log_facility => 'LOG_LOCAL0',
|
||||
:api_eth => '10.0.0.1'
|
||||
}
|
||||
end
|
||||
|
||||
shared_examples_for 'openstack image registry' do
|
||||
|
||||
it 'configure glance-registry' do
|
||||
should contain_class('glance::registry').with(
|
||||
:database_connection => 'mysql://glance:secrete@10.0.0.1/glance?charset=utf8',
|
||||
:keystone_password => 'secrete',
|
||||
:keystone_tenant => 'services',
|
||||
:keystone_user => 'glance',
|
||||
:verbose => true,
|
||||
:debug => true,
|
||||
:auth_host => '10.0.0.1',
|
||||
:log_facility => 'LOG_LOCAL0',
|
||||
:bind_host => '10.0.0.1',
|
||||
:bind_port => '9191',
|
||||
:use_syslog => true,
|
||||
:log_dir => false,
|
||||
:log_file => false
|
||||
)
|
||||
end
|
||||
|
||||
it 'checks if Glance DB is populated' do
|
||||
should contain_exec('glance_db_sync').with(
|
||||
:command => 'glance-manage db_sync',
|
||||
:user => 'glance',
|
||||
:path => '/usr/bin',
|
||||
:unless => '/usr/bin/mysql glance -h 10.0.0.1 -u glance -psecrete -e "show tables" | /bin/grep Tables'
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian' }
|
||||
end
|
||||
|
||||
it_configures 'openstack image registry'
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'RedHat' }
|
||||
end
|
||||
|
||||
it_configures 'openstack image registry'
|
||||
end
|
||||
|
||||
end
|
84
spec/classes/cloud_telemetry_alarmevaluator_spec.rb
Normal file
84
spec/classes/cloud_telemetry_alarmevaluator_spec.rb
Normal file
@ -0,0 +1,84 @@
|
||||
#
|
||||
# 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 cloud::telemetry::alarmevaluator class
|
||||
#
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'cloud::telemetry::alarmevaluator' do
|
||||
|
||||
shared_examples_for 'openstack telemetry alarmevaluator' do
|
||||
|
||||
let :pre_condition do
|
||||
"class { 'cloud::telemetry':
|
||||
ceilometer_secret => 'secrete',
|
||||
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_ceilometer_password => 'secrete',
|
||||
region => 'MyRegion',
|
||||
log_facility => 'LOG_LOCAL0',
|
||||
use_syslog => true,
|
||||
verbose => true,
|
||||
debug => true }"
|
||||
end
|
||||
|
||||
it 'configure ceilometer common' do
|
||||
should contain_class('ceilometer').with(
|
||||
:verbose => true,
|
||||
:debug => true,
|
||||
:rabbit_userid => 'ceilometer',
|
||||
:rabbit_hosts => ['10.0.0.1'],
|
||||
:rabbit_password => 'secrete',
|
||||
:metering_secret => 'secrete',
|
||||
:use_syslog => true,
|
||||
:log_facility => 'LOG_LOCAL0',
|
||||
:log_dir => false
|
||||
)
|
||||
should contain_class('ceilometer::agent::auth').with(
|
||||
:auth_password => 'secrete',
|
||||
:auth_url => 'http://10.0.0.1:5000/v2.0',
|
||||
:auth_region => 'MyRegion'
|
||||
)
|
||||
end
|
||||
|
||||
it 'configure ceilometer alarm evaluator' do
|
||||
should contain_class('ceilometer::alarm::evaluator')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian',
|
||||
:hostname => 'node1' }
|
||||
end
|
||||
|
||||
it_configures 'openstack telemetry alarmevaluator'
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'RedHat',
|
||||
:hostname => 'node1' }
|
||||
end
|
||||
|
||||
it_configures 'openstack telemetry alarmevaluator'
|
||||
end
|
||||
|
||||
end
|
83
spec/classes/cloud_telemetry_alarmnotifier_spec.rb
Normal file
83
spec/classes/cloud_telemetry_alarmnotifier_spec.rb
Normal file
@ -0,0 +1,83 @@
|
||||
#
|
||||
# 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 cloud::telemetry::alarmnotifier class
|
||||
#
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'cloud::telemetry::alarmnotifier' do
|
||||
|
||||
shared_examples_for 'openstack telemetry alarmnotifier' do
|
||||
|
||||
let :pre_condition do
|
||||
"class { 'cloud::telemetry':
|
||||
ceilometer_secret => 'secrete',
|
||||
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_ceilometer_password => 'secrete',
|
||||
region => 'MyRegion',
|
||||
log_facility => 'LOG_LOCAL0',
|
||||
use_syslog => true,
|
||||
verbose => true,
|
||||
debug => true }"
|
||||
end
|
||||
|
||||
it 'configure ceilometer common' do
|
||||
should contain_class('ceilometer').with(
|
||||
:verbose => true,
|
||||
:debug => true,
|
||||
:rabbit_userid => 'ceilometer',
|
||||
:rabbit_hosts => ['10.0.0.1'],
|
||||
:rabbit_password => 'secrete',
|
||||
:metering_secret => 'secrete',
|
||||
:use_syslog => true,
|
||||
:log_facility => 'LOG_LOCAL0',
|
||||
:log_dir => false
|
||||
)
|
||||
should contain_class('ceilometer::agent::auth').with(
|
||||
:auth_password => 'secrete',
|
||||
:auth_url => 'http://10.0.0.1:5000/v2.0',
|
||||
:auth_region => 'MyRegion'
|
||||
)
|
||||
end
|
||||
|
||||
it 'configure ceilometer alarm notifier' do
|
||||
should contain_class('ceilometer::alarm::notifier')
|
||||
end
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian',
|
||||
:hostname => 'node1' }
|
||||
end
|
||||
|
||||
it_configures 'openstack telemetry alarmnotifier'
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'RedHat',
|
||||
:hostname => 'node1' }
|
||||
end
|
||||
|
||||
it_configures 'openstack telemetry alarmnotifier'
|
||||
end
|
||||
|
||||
end
|
112
spec/classes/cloud_telemetry_api_spec.rb
Normal file
112
spec/classes/cloud_telemetry_api_spec.rb
Normal file
@ -0,0 +1,112 @@
|
||||
#
|
||||
# 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 cloud::telemetry::api class
|
||||
#
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'cloud::telemetry::api' do
|
||||
|
||||
shared_examples_for 'openstack telemetry api' do
|
||||
|
||||
let :pre_condition do
|
||||
"class { 'cloud::telemetry':
|
||||
ceilometer_secret => 'secrete',
|
||||
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_ceilometer_password => 'secrete',
|
||||
region => 'MyRegion',
|
||||
log_facility => 'LOG_LOCAL0',
|
||||
use_syslog => true,
|
||||
verbose => true,
|
||||
debug => true }"
|
||||
end
|
||||
|
||||
let :params do
|
||||
{ :ks_keystone_internal_host => '127.0.0.1',
|
||||
:ks_keystone_internal_proto => 'http',
|
||||
:ks_ceilometer_internal_port => '8777',
|
||||
:ks_ceilometer_password => 'rabbitpassword',
|
||||
:api_eth => '127.0.0.1',
|
||||
:mongo_nodes => ['node1', 'node2', 'node3'] }
|
||||
end
|
||||
|
||||
it 'configure ceilometer common' do
|
||||
should contain_class('ceilometer').with(
|
||||
:verbose => true,
|
||||
:debug => true,
|
||||
:rabbit_userid => 'ceilometer',
|
||||
:rabbit_hosts => ['10.0.0.1'],
|
||||
:rabbit_password => 'secrete',
|
||||
:metering_secret => 'secrete',
|
||||
:use_syslog => true,
|
||||
:log_facility => 'LOG_LOCAL0',
|
||||
:log_dir => false
|
||||
)
|
||||
should contain_class('ceilometer::agent::auth').with(
|
||||
:auth_password => 'secrete',
|
||||
:auth_url => 'http://10.0.0.1:5000/v2.0',
|
||||
:auth_region => 'MyRegion'
|
||||
)
|
||||
end
|
||||
|
||||
it 'configure ceilometer-api' do
|
||||
should contain_class('ceilometer::api').with(
|
||||
:keystone_password => 'rabbitpassword',
|
||||
:keystone_host => '127.0.0.1',
|
||||
:keystone_protocol => 'http',
|
||||
:host => '127.0.0.1'
|
||||
)
|
||||
end
|
||||
|
||||
it 'configure ceilometer-expirer' do
|
||||
should contain_class('ceilometer::expirer').with(
|
||||
:time_to_live => '2592000',
|
||||
:minute => '0',
|
||||
:hour => '0'
|
||||
)
|
||||
end
|
||||
|
||||
it 'synchronize ceilometer db indexes' do
|
||||
should contain_class('ceilometer::db').with(
|
||||
:sync_db => true,
|
||||
:database_connection => 'mongodb://node1,node2,node3/ceilometer?replicaSet=ceilometer'
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian',
|
||||
:hostname => 'node1' }
|
||||
end
|
||||
|
||||
it_configures 'openstack telemetry api'
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'RedHat',
|
||||
:hostname => 'node1' }
|
||||
end
|
||||
|
||||
it_configures 'openstack telemetry api'
|
||||
end
|
||||
|
||||
end
|
@ -13,14 +13,14 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
# Unit tests for cloud::telemetry::server class
|
||||
# Unit tests for cloud::telemetry::centralagent class
|
||||
#
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'cloud::telemetry::centralagent' do
|
||||
|
||||
shared_examples_for 'openstack telemetry central agent' do
|
||||
shared_examples_for 'openstack telemetry centralagent' do
|
||||
|
||||
let :pre_condition do
|
||||
"class { 'cloud::telemetry':
|
||||
@ -39,7 +39,7 @@ describe 'cloud::telemetry::centralagent' do
|
||||
end
|
||||
|
||||
let :params do
|
||||
{ :enabled => true }
|
||||
{ :enabled => 'true', }
|
||||
end
|
||||
|
||||
it 'configure ceilometer common' do
|
||||
@ -62,27 +62,29 @@ describe 'cloud::telemetry::centralagent' do
|
||||
end
|
||||
|
||||
it 'configure ceilometer central agent' do
|
||||
should contain_class('ceilometer::agent::central').with(
|
||||
:enabled => true
|
||||
)
|
||||
should contain_class('ceilometer::agent::central').with({
|
||||
'enabled' => 'true',
|
||||
})
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian' }
|
||||
{ :osfamily => 'Debian',
|
||||
:hostname => 'node1' }
|
||||
end
|
||||
|
||||
it_configures 'openstack telemetry central agent'
|
||||
it_configures 'openstack telemetry centralagent'
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'RedHat' }
|
||||
{ :osfamily => 'RedHat',
|
||||
:hostname => 'node1' }
|
||||
end
|
||||
|
||||
it_configures 'openstack telemetry central agent'
|
||||
it_configures 'openstack telemetry centralagent'
|
||||
end
|
||||
|
||||
end
|
||||
|
84
spec/classes/cloud_telemetry_collector_spec.rb
Normal file
84
spec/classes/cloud_telemetry_collector_spec.rb
Normal file
@ -0,0 +1,84 @@
|
||||
#
|
||||
# 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 cloud::telemetry::collector class
|
||||
#
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'cloud::telemetry::collector' do
|
||||
|
||||
shared_examples_for 'openstack telemetry collector' do
|
||||
|
||||
let :pre_condition do
|
||||
"class { 'cloud::telemetry':
|
||||
ceilometer_secret => 'secrete',
|
||||
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_ceilometer_password => 'secrete',
|
||||
region => 'MyRegion',
|
||||
log_facility => 'LOG_LOCAL0',
|
||||
use_syslog => true,
|
||||
verbose => true,
|
||||
debug => true }"
|
||||
end
|
||||
|
||||
it 'configure ceilometer common' do
|
||||
should contain_class('ceilometer').with(
|
||||
:verbose => true,
|
||||
:debug => true,
|
||||
:rabbit_userid => 'ceilometer',
|
||||
:rabbit_hosts => ['10.0.0.1'],
|
||||
:rabbit_password => 'secrete',
|
||||
:metering_secret => 'secrete',
|
||||
:use_syslog => true,
|
||||
:log_facility => 'LOG_LOCAL0',
|
||||
:log_dir => false
|
||||
)
|
||||
should contain_class('ceilometer::agent::auth').with(
|
||||
:auth_password => 'secrete',
|
||||
:auth_url => 'http://10.0.0.1:5000/v2.0',
|
||||
:auth_region => 'MyRegion'
|
||||
)
|
||||
end
|
||||
|
||||
it 'configure ceilometer collector' do
|
||||
should contain_class('ceilometer::collector')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian',
|
||||
:hostname => 'node1' }
|
||||
end
|
||||
|
||||
it_configures 'openstack telemetry collector'
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'RedHat',
|
||||
:hostname => 'node1' }
|
||||
end
|
||||
|
||||
it_configures 'openstack telemetry collector'
|
||||
end
|
||||
|
||||
end
|
84
spec/classes/cloud_telemetry_notification_spec.rb
Normal file
84
spec/classes/cloud_telemetry_notification_spec.rb
Normal file
@ -0,0 +1,84 @@
|
||||
#
|
||||
# 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 cloud::telemetry::notification class
|
||||
#
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'cloud::telemetry::notification' do
|
||||
|
||||
shared_examples_for 'openstack telemetry notification' do
|
||||
|
||||
let :pre_condition do
|
||||
"class { 'cloud::telemetry':
|
||||
ceilometer_secret => 'secrete',
|
||||
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_ceilometer_password => 'secrete',
|
||||
region => 'MyRegion',
|
||||
log_facility => 'LOG_LOCAL0',
|
||||
use_syslog => true,
|
||||
verbose => true,
|
||||
debug => true }"
|
||||
end
|
||||
|
||||
it 'configure ceilometer common' do
|
||||
should contain_class('ceilometer').with(
|
||||
:verbose => true,
|
||||
:debug => true,
|
||||
:rabbit_userid => 'ceilometer',
|
||||
:rabbit_hosts => ['10.0.0.1'],
|
||||
:rabbit_password => 'secrete',
|
||||
:metering_secret => 'secrete',
|
||||
:use_syslog => true,
|
||||
:log_facility => 'LOG_LOCAL0',
|
||||
:log_dir => false
|
||||
)
|
||||
should contain_class('ceilometer::agent::auth').with(
|
||||
:auth_password => 'secrete',
|
||||
:auth_url => 'http://10.0.0.1:5000/v2.0',
|
||||
:auth_region => 'MyRegion'
|
||||
)
|
||||
end
|
||||
|
||||
it 'configure ceilometer notification agent' do
|
||||
should contain_class('ceilometer::agent::notification')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian',
|
||||
:hostname => 'node1' }
|
||||
end
|
||||
|
||||
it_configures 'openstack telemetry notification'
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'RedHat',
|
||||
:hostname => 'node1' }
|
||||
end
|
||||
|
||||
it_configures 'openstack telemetry notification'
|
||||
end
|
||||
|
||||
end
|
128
spec/classes/cloud_telemetry_spec.rb
Normal file
128
spec/classes/cloud_telemetry_spec.rb
Normal file
@ -0,0 +1,128 @@
|
||||
#
|
||||
# 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 cloud::telemetry::server class
|
||||
#
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'cloud::telemetry::server' do
|
||||
|
||||
shared_examples_for 'openstack telemetry server' do
|
||||
|
||||
let :pre_condition do
|
||||
"class { 'cloud::telemetry':
|
||||
ceilometer_secret => 'secrete',
|
||||
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_ceilometer_password => 'secrete',
|
||||
region => 'MyRegion',
|
||||
log_facility => 'LOG_LOCAL0',
|
||||
use_syslog => true,
|
||||
verbose => true,
|
||||
debug => true }"
|
||||
end
|
||||
|
||||
let :params do
|
||||
{ :ks_keystone_internal_host => '10.0.0.1',
|
||||
:ks_keystone_internal_proto => 'http',
|
||||
:ks_ceilometer_internal_port => '8777',
|
||||
:ks_ceilometer_password => 'secrete',
|
||||
:api_eth => '10.0.0.1',
|
||||
:mongo_nodes => ['node1', 'node2', 'node3'] }
|
||||
end
|
||||
|
||||
it 'configure ceilometer common' do
|
||||
should contain_class('ceilometer').with(
|
||||
:verbose => true,
|
||||
:debug => true,
|
||||
:rabbit_userid => 'ceilometer',
|
||||
:rabbit_hosts => ['10.0.0.1'],
|
||||
:rabbit_password => 'secrete',
|
||||
:metering_secret => 'secrete',
|
||||
:use_syslog => true,
|
||||
:log_facility => 'LOG_LOCAL0',
|
||||
:log_dir => false
|
||||
)
|
||||
should contain_class('ceilometer::agent::auth').with(
|
||||
:auth_password => 'secrete',
|
||||
:auth_url => 'http://10.0.0.1:5000/v2.0',
|
||||
:auth_region => 'MyRegion'
|
||||
)
|
||||
end
|
||||
|
||||
it 'configure ceilometer collector' do
|
||||
should contain_class('ceilometer::collector')
|
||||
end
|
||||
|
||||
it 'configure ceilometer notification agent' do
|
||||
should contain_class('ceilometer::agent::notification')
|
||||
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',
|
||||
:host => '10.0.0.1'
|
||||
)
|
||||
end
|
||||
|
||||
it 'configure ceilometer-expirer' do
|
||||
should contain_class('ceilometer::expirer').with(
|
||||
:time_to_live => '2592000',
|
||||
:minute => '0',
|
||||
:hour => '0'
|
||||
)
|
||||
end
|
||||
|
||||
it 'synchronize ceilometer db indexes' do
|
||||
should contain_class('ceilometer::db').with(
|
||||
:sync_db => true,
|
||||
:database_connection => 'mongodb://node1,node2,node3/ceilometer?replicaSet=ceilometer'
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian',
|
||||
:hostname => 'node1' }
|
||||
end
|
||||
|
||||
it_configures 'openstack telemetry server'
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'RedHat',
|
||||
:hostname => 'node1' }
|
||||
end
|
||||
|
||||
it_configures 'openstack telemetry server'
|
||||
end
|
||||
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user