Fix typo for ensure_service in Cinder BDD backend

This patch fixes typo in Cinder BDD backend for ensure_service
function with a proper property - running - instead of present.

Also added tests for daemons.

Change-Id: I5e99b884ab8bdabfa46924c793db3eedfe5880f8
(cherry picked from commit d93f49cb43)
This commit is contained in:
Denis Egorenko
2016-03-31 17:47:33 +03:00
parent 1c9e855952
commit e54badae3b
2 changed files with 30 additions and 1 deletions

View File

@@ -93,7 +93,7 @@ define cinder::backend::bdd (
name => $::cinder::params::tgt_package_name})
ensure_resource('service', 'tgtd', {
ensure => present,
ensure => running,
name => $::cinder::params::tgt_service_name,
require => Package['tgt']})

View File

@@ -60,6 +60,34 @@ describe 'cinder::backend::bdd' do
end
end
shared_examples_for 'check needed daemons' do
context 'tgtadm helper' do
it 'is expected to have tgtd daemon' do
is_expected.to contain_package('tgt').with(:ensure => :present)
is_expected.to contain_service('tgtd').with(:ensure => :running)
end
end
context 'lioadm helper' do
before do
params.merge!({:iscsi_helper => 'lioadm'})
end
it 'is expected to have target daemon' do
is_expected.to contain_package('targetcli').with(:ensure => :present)
is_expected.to contain_service('target').with(:ensure => :running)
end
end
context 'wrong helper' do
before do
params.merge!({:iscsi_helper => 'fake'})
end
it 'is expected to raise error' do
is_expected.to raise_error(Puppet::Error, /Unsupported iscsi helper: fake/)
end
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
@@ -69,6 +97,7 @@ describe 'cinder::backend::bdd' do
end
it_configures 'cinder block device'
it_configures 'check needed daemons'
end
end
end