puppet-tuskar/spec/classes/tuskar_ui_spec.rb
Yanis Guenane 8dba39eefa Add tag to package and service resources
In order to be able to take an action after all the packages of the
module have been installed/updated or all the services have been
started/restarted, we set a 'tuskar-package' and 'tuskar-service'
tag for each package and service of this module.

At the moment, there is a generic openstack tag that is not specific
enough if one wants to take action upon a single module change.

Use case :

If an action needs to be taken after all the packages have been
installed or updated : Package <| tag == 'tuskar-package' |> -> X

Change-Id: Ie80cdb04a7b9d5adb87bf13ab1adee963adae6af
2015-07-22 21:41:38 +02:00

80 lines
2.0 KiB
Ruby

#
# Unit tests for tuskar::ui
#
require 'spec_helper'
describe 'tuskar::ui' do
shared_examples_for 'tuskar ui' do
context 'with default parameters' do
it 'installs tuskar-ui package' do
should contain_package('tuskar-ui').with(
:name => platform_params[:ui_package_name],
:ensure => 'present',
:tag => ['openstack', 'tuskar-package'],
)
should_not contain_package('tuskar-ui-extras')
end
end
context 'with extras parameter parameter provided' do
let :params do
{ :extras => true }
end
it 'installs tuskar-ui and tuskar-ui-extras packages' do
should contain_package('tuskar-ui').with(
:name => platform_params[:ui_package_name],
:ensure => 'present',
:tag => ['openstack', 'tuskar-package'],
)
should contain_package('tuskar-ui-extras').with(
:name => platform_params[:ui_extras_package_name],
:ensure => 'present',
:tag => ['openstack', 'tuskar-package'],
)
end
end
context 'with package_ensure parameter provided' do
let :params do
{ :package_ensure => 'absent' }
end
it 'installs tuskar-ui and tuskar-ui-extras packages' do
should contain_package('tuskar-ui').with(
:name => platform_params[:ui_package_name],
:ensure => 'absent',
:tag => ['openstack', 'tuskar-package'],
)
end
end
end
context 'on Debian platforms' do
let :facts do
{ :osfamily => 'Debian' }
end
let :platform_params do
{ :ui_package_name => 'tuskar-ui',
:ui_extras_package_name => 'tuskar-ui-extras' }
end
it_configures 'tuskar ui'
end
context 'on RedHat platforms' do
let :facts do
{ :osfamily => 'RedHat' }
end
let :platform_params do
{ :ui_package_name => 'openstack-tuskar-ui',
:ui_extras_package_name => 'openstack-tuskar-ui-extras' }
end
it_configures 'tuskar ui'
end
end