Convert spec testing to rspec-puppet-facts
Change-Id: I2864d8f095270c3f64e4000b3e8789e323f9dd19
This commit is contained in:
@@ -18,9 +18,9 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'ironic::bifrost' do
|
||||
|
||||
let :default_params do
|
||||
{ :git_source_repo => 'https://git.openstack.org/openstack/bifrost',
|
||||
{
|
||||
:git_source_repo => 'https://git.openstack.org/openstack/bifrost',
|
||||
:revision => master,
|
||||
:git_dest_repo_folder => '/opt/stack/bifrost',
|
||||
:bifrost_config_folder => '/etc/bifrost',
|
||||
@@ -51,39 +51,45 @@ describe 'ironic::bifrost' do
|
||||
end
|
||||
|
||||
let :params do
|
||||
{ :mysql_password => 'changeme',
|
||||
{
|
||||
:mysql_password => 'changeme',
|
||||
:ironic_db_password => 'changeme',
|
||||
:baremetal_json_hosts => 'test',
|
||||
}
|
||||
end
|
||||
|
||||
it 'should clone with vcsrepo bifrost repo with master branch' do
|
||||
is_expected.to contain_vcsrepo('/opt/stack/bifrost').with(
|
||||
'ensure' => 'present',
|
||||
'provider' => 'git',
|
||||
'revision' => 'master',
|
||||
'source' => 'https://git.openstack.org/openstack/bifrost',
|
||||
)
|
||||
shared_examples 'ironic::bifrost' do
|
||||
it { should contain_vcsrepo('/opt/stack/bifrost').with(
|
||||
:ensure => 'present',
|
||||
:provider => 'git',
|
||||
:revision => 'master',
|
||||
:source => 'https://git.openstack.org/openstack/bifrost',
|
||||
)}
|
||||
|
||||
it { should contain_file('/etc/bifrost').with(
|
||||
:ensure => 'directory',
|
||||
)}
|
||||
|
||||
it { should contain_file('/etc/bifrost/bifrost_global_vars').with(
|
||||
:ensure => 'present',
|
||||
:content => /ironic_url/,
|
||||
)}
|
||||
|
||||
it { should contain_file('/etc/bifrost/baremetal.json').with(
|
||||
:ensure => 'present',
|
||||
:content => /test/,
|
||||
)}
|
||||
end
|
||||
|
||||
it 'should contain folder /etc/bifrost' do
|
||||
is_expected.to contain_file('/etc/bifrost').with(
|
||||
'ensure' => 'directory',
|
||||
)
|
||||
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
|
||||
|
||||
it 'should contain file /etc/bifrost/bifrost_global_vars' do
|
||||
is_expected.to contain_file('/etc/bifrost/bifrost_global_vars').with(
|
||||
'ensure' => 'present',
|
||||
'content' => /ironic_url/,
|
||||
)
|
||||
it_behaves_like 'ironic::bifrost'
|
||||
end
|
||||
|
||||
it 'should contain file /etc/bifrost/baremetal.json' do
|
||||
is_expected.to contain_file('/etc/bifrost/baremetal.json').with(
|
||||
'ensure' => 'present',
|
||||
'content' => /test/,
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
@@ -1,9 +1,9 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'ironic::config' do
|
||||
|
||||
let :params do
|
||||
{ :ironic_config => {
|
||||
{
|
||||
:ironic_config => {
|
||||
'DEFAULT/foo' => { 'value' => 'fooValue' },
|
||||
'DEFAULT/bar' => { 'value' => 'barValue' },
|
||||
'DEFAULT/baz' => { 'ensure' => 'absent' }
|
||||
@@ -16,18 +16,31 @@ describe 'ironic::config' do
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_class('ironic::deps') }
|
||||
shared_examples 'ironic::config' do
|
||||
it { should contain_class('ironic::deps') }
|
||||
|
||||
it 'configures arbitrary ironic configurations' do
|
||||
is_expected.to contain_ironic_config('DEFAULT/foo').with_value('fooValue')
|
||||
is_expected.to contain_ironic_config('DEFAULT/bar').with_value('barValue')
|
||||
is_expected.to contain_ironic_config('DEFAULT/baz').with_ensure('absent')
|
||||
it {
|
||||
should contain_ironic_config('DEFAULT/foo').with_value('fooValue')
|
||||
should contain_ironic_config('DEFAULT/bar').with_value('barValue')
|
||||
should contain_ironic_config('DEFAULT/baz').with_ensure('absent')
|
||||
}
|
||||
|
||||
it {
|
||||
should contain_ironic_api_paste_ini('DEFAULT/foo2').with_value('fooValue')
|
||||
should contain_ironic_api_paste_ini('DEFAULT/bar2').with_value('barValue')
|
||||
should contain_ironic_api_paste_ini('DEFAULT/baz2').with_ensure('absent')
|
||||
}
|
||||
end
|
||||
|
||||
it 'configures arbitrary ironic-api-paste configurations' do
|
||||
is_expected.to contain_ironic_api_paste_ini('DEFAULT/foo2').with_value('fooValue')
|
||||
is_expected.to contain_ironic_api_paste_ini('DEFAULT/bar2').with_value('barValue')
|
||||
is_expected.to contain_ironic_api_paste_ini('DEFAULT/baz2').with_ensure('absent')
|
||||
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
|
||||
|
||||
it_behaves_like 'ironic::config'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user