1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
require 'spec_helper'
describe 'openstacklib::iscsid' do
shared_examples_for 'openstacklib::iscsid' do
context 'with default params' do
it { is_expected.to contain_package('open-iscsi').with(
:name => platform_params[:open_iscsi_package_name],
:ensure => 'present',
:tag => 'openstack',
)}
it { is_expected.to contain_exec('create-initiatorname-file').with({
:command => 'echo "InitiatorName=`/usr/sbin/iscsi-iname`" > /etc/iscsi/initiatorname.iscsi',
:path => ['/usr/bin','/usr/sbin','/bin','/usr/bin'],
:creates => '/etc/iscsi/initiatorname.iscsi',
}).that_requires('Package[open-iscsi]')}
it { is_expected.to contain_service('iscsid').with(
:ensure => 'running',
:enable => true,
) }
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
let(:platform_params) do
case facts[:os]['family']
when 'Debian'
{ :open_iscsi_package_name => 'open-iscsi' }
when 'RedHat'
{ :open_iscsi_package_name => 'iscsi-initiator-utils' }
end
end
it_behaves_like 'openstacklib::iscsid'
end
end
end
|