
This patch aim to update our specs test in order to work with the rspec-puppet release 2.0.0, in the mean time, we update rspec syntax in order to be prepared for rspec 3.x move. In details: * Use shared_examples "a Puppet::Error" for puppet::error tests * Convert 'should' keyword to 'is_expected.to' (prepare rspec 3.x) * Fix spec tests for rspec-puppet 2.0.0 * Upgrade and pin rspec-puppet from 1.0.1 to 2.0.0 * Clean Gemfile (remove over-specificication of runtime deps of puppetlabs_spec_helper) Change-Id: Id5b428fb518f40cf92cd27078d36f19b6d60226b Card: https://trello.com/c/eHXc1Ryd/4-investigate-the-necessary-change-to-be-rspec-puppet-2-0-0-compliant
87 lines
2.3 KiB
Ruby
87 lines
2.3 KiB
Ruby
require 'spec_helper'
|
|
|
|
describe 'cinder::volume::iscsi' do
|
|
|
|
let :req_params do
|
|
{:iscsi_ip_address => '127.0.0.2'}
|
|
end
|
|
|
|
let :facts do
|
|
{:osfamily => 'Debian'}
|
|
end
|
|
|
|
describe 'with default params' do
|
|
|
|
let :params do
|
|
req_params
|
|
end
|
|
|
|
it { is_expected.to contain_cinder_config('DEFAULT/volume_driver').with(
|
|
:value => 'cinder.volume.drivers.lvm.LVMVolumeDriver')}
|
|
it { is_expected.to contain_cinder_config('DEFAULT/iscsi_ip_address').with(:value => '127.0.0.2')}
|
|
it { is_expected.to contain_cinder_config('DEFAULT/iscsi_helper').with(:value => 'tgtadm')}
|
|
it { is_expected.to contain_cinder_config('DEFAULT/volume_group').with(:value => 'cinder-volumes')}
|
|
it { is_expected.to contain_cinder_config('DEFAULT/volumes_dir').with(:value => '/var/lib/cinder/volumes')}
|
|
it { is_expected.to contain_cinder_config('DEFAULT/iscsi_protocol').with(:value => 'iscsi')}
|
|
|
|
end
|
|
|
|
describe 'with a non-default $volumes_dir' do
|
|
let(:params) { req_params.merge(:volumes_dir => '/etc/cinder/volumes')}
|
|
|
|
it 'should contain a cinder::backend::iscsi resource with /etc/cinder/volumes as $volumes dir' do
|
|
is_expected.to contain_cinder__backend__iscsi('DEFAULT').with({
|
|
:volumes_dir => '/etc/cinder/volumes'
|
|
})
|
|
end
|
|
|
|
end
|
|
|
|
describe 'with a unsupported iscsi helper' do
|
|
let(:params) { req_params.merge(:iscsi_helper => 'fooboozoo')}
|
|
|
|
it_raises 'a Puppet::Error', /Unsupported iscsi helper: fooboozoo/
|
|
end
|
|
|
|
describe 'with RedHat' do
|
|
|
|
let :params do
|
|
req_params
|
|
end
|
|
|
|
let :facts do
|
|
{:osfamily => 'RedHat',
|
|
:operatingsystem => 'RedHat',
|
|
:operatingsystemmajrelease => '6'}
|
|
end
|
|
|
|
it { is_expected.to contain_file_line('cinder include').with(
|
|
:line => 'include /var/lib/cinder/volumes/*',
|
|
:path => '/etc/tgt/targets.conf'
|
|
) }
|
|
|
|
end
|
|
|
|
describe 'with lioadm' do
|
|
|
|
let :params do {
|
|
:iscsi_ip_address => '127.0.0.2',
|
|
:iscsi_helper => 'lioadm'
|
|
}
|
|
end
|
|
|
|
let :facts do
|
|
{:osfamily => 'RedHat'}
|
|
end
|
|
|
|
it { is_expected.to contain_package('targetcli').with_ensure('present')}
|
|
it { is_expected.to contain_service('target').with(
|
|
:ensure => 'running',
|
|
:enable => 'true',
|
|
:require => 'Package[targetcli]'
|
|
) }
|
|
|
|
end
|
|
|
|
end
|