fuel-library/deployment/puppet/ceilometer/spec/classes/ceilometer_expirer_spec.rb
Sergii Golovatiuk 5e9c278652 Sync puppet-ceilometer
4.0.0 b231c9681d476a05f437f828b95870ab4cbc4327

Change-Id: Ifa403d8066ede566dddbf49d67308c080b97ea77
Implements: blueprint merge-openstack-puppet-modules
Signed-Off: Sergii Golovatiuk <sgolovatiuk@mirantis.com>
2014-10-03 15:42:56 +03:00

88 lines
2.2 KiB
Ruby

#
# Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
#
# Author: Emilien Macchi <emilien.macchi@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 ceilometer::expirer
#
require 'spec_helper'
describe 'ceilometer::expirer' do
let :pre_condition do
"class { 'ceilometer': metering_secret => 's3cr3t' }"
end
let :params do
{ :time_to_live => '-1' }
end
shared_examples_for 'ceilometer-expirer' do
it { should contain_class('ceilometer::params') }
it 'installs ceilometer common package' do
should contain_package('ceilometer-common').with(
:ensure => 'present',
:name => platform_params[:common_package_name]
)
end
it 'configures a cron' do
should contain_cron('ceilometer-expirer').with(
:command => 'ceilometer-expirer',
:environment => 'PATH=/bin:/usr/bin:/usr/sbin',
:user => 'ceilometer',
:minute => 1,
:hour => 0,
:monthday => '*',
:month => '*',
:weekday => '*'
)
end
it 'configures database section in ceilometer.conf' do
should contain_ceilometer_config('database/time_to_live').with_value( params[:time_to_live] )
end
end
context 'on Debian platforms' do
let :facts do
{ :osfamily => 'Debian' }
end
let :platform_params do
{ :common_package_name => 'ceilometer-common' }
end
it_configures 'ceilometer-expirer'
end
context 'on RedHat platforms' do
let :facts do
{ :osfamily => 'RedHat' }
end
let :platform_params do
{ :common_package_name => 'openstack-ceilometer-common' }
end
it_configures 'ceilometer-expirer'
end
end