Finish converting to rspec-puppet-facts

Change-Id: I66c41584347c9986ac7e884e80efa982b4050175
This commit is contained in:
Mykyta Karpin 2016-11-22 16:11:28 +02:00
parent 9b0aa85594
commit ca26a6bbc8
29 changed files with 507 additions and 541 deletions

View File

@ -138,7 +138,7 @@ describe 'ironic::api::authtoken' do
facts.merge!(OSDefaults.get_facts())
end
it_configures 'ironic api authtoken'
it_behaves_like 'ironic api authtoken'
end
end

View File

@ -146,41 +146,26 @@ describe 'ironic::api' do
end
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge({
:osfamily => 'Debian',
:operatingsystem => 'Debian',
:operatingsystemrelease => '8.0',
:concat_basedir => '/var/lib/puppet/concat',
:fqdn => 'some.host.tld',
})
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[:osfamily]
when 'Debian'
{ :api_package => 'ironic-api',
:api_service => 'ironic-api' }
when 'RedHat'
{ :api_service => 'openstack-ironic-api' }
end
end
it_behaves_like 'ironic api'
end
let :platform_params do
{ :api_package => 'ironic-api',
:api_service => 'ironic-api' }
end
it_configures 'ironic api'
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge({
:osfamily => 'RedHat',
:operatingsystem => 'RedHat',
:operatingsystemrelease => '7.2',
:concat_basedir => '/var/lib/puppet/concat',
:fqdn => 'some.host.tld',
})
end
let :platform_params do
{ :api_service => 'openstack-ironic-api' }
end
it_configures 'ironic api'
end
end

View File

@ -22,19 +22,17 @@ require 'spec_helper'
describe 'ironic::client' do
context 'on Debian platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'Debian' })
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
it { is_expected.to contain_class('ironic::client') }
it { is_expected.to contain_class('ironic::client') }
end
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'RedHat' })
end
it { is_expected.to contain_class('ironic::client') }
end
end

View File

@ -124,38 +124,36 @@ describe 'ironic::conductor' do
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'Debian' })
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
case facts[:osfamily]
when 'Debian'
let :platform_params do
{ :conductor_package => 'ironic-conductor',
:conductor_service => 'ironic-conductor' }
end
# https://bugs.launchpad.net/cloud-archive/+bug/1572800
it 'installs ipmitool package' do
is_expected.to contain_package('ipmitool').with(
:ensure => 'present',
:name => 'ipmitool',
:tag => ['openstack', 'ironic-package'],
)
end
when 'RedHat'
let :platform_params do
{ :conductor_service => 'ironic-conductor' }
end
end
it_behaves_like 'ironic conductor'
end
let :platform_params do
{ :conductor_package => 'ironic-conductor',
:conductor_service => 'ironic-conductor' }
end
it_configures 'ironic conductor'
# https://bugs.launchpad.net/cloud-archive/+bug/1572800
it 'installs ipmitool package' do
is_expected.to contain_package('ipmitool').with(
:ensure => 'present',
:name => 'ipmitool',
:tag => ['openstack', 'ironic-package'],
)
end
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'RedHat' })
end
let :platform_params do
{ :conductor_service => 'ironic-conductor' }
end
it_configures 'ironic conductor'
end
end

View File

@ -42,7 +42,7 @@ describe 'ironic::cors' do
facts.merge!(OSDefaults.get_facts())
end
it_configures 'ironic cors'
it_behaves_like 'ironic cors'
end
end

View File

@ -30,34 +30,22 @@ describe 'ironic::db::mysql' do
{ :password => 'passw0rd' }
end
let :facts do
@default_facts.merge({ :osfamily => 'Debian' })
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
it { is_expected.to contain_openstacklib__db__mysql('ironic').with(
:user => 'ironic',
:password_hash => '*74B1C21ACE0C2D6B0678A5E503D2A60E8F9651A3',
:charset => 'utf8',
:collate => 'utf8_general_ci',
)}
context 'on Debian platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'Debian' })
end
it { is_expected.to contain_openstacklib__db__mysql('ironic').with(
:user => 'ironic',
:password_hash => '*74B1C21ACE0C2D6B0678A5E503D2A60E8F9651A3',
:charset => 'utf8',
:collate => 'utf8_general_ci',
)}
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'RedHat' })
end
it { is_expected.to contain_openstacklib__db__mysql('ironic').with(
:user => 'ironic',
:password_hash => '*74B1C21ACE0C2D6B0678A5E503D2A60E8F9651A3',
:charset => 'utf8',
:collate => 'utf8_general_ci',
)}
end
describe "overriding allowed_hosts param to array" do

View File

@ -35,7 +35,7 @@ describe 'ironic::db::postgresql' do
}))
end
it_configures 'ironic::db::postgresql'
it_behaves_like 'ironic::db::postgresql'
end
end

View File

@ -78,15 +78,7 @@ describe 'ironic::db' do
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'Debian',
:operatingsystem => 'Debian',
:operatingsystemrelease => 'jessie',
})
end
it_configures 'ironic::db'
shared_examples_for 'ironic::db on Debian platforms' do
context 'using pymysql driver' do
let :params do
@ -118,14 +110,7 @@ describe 'ironic::db' do
end
context 'on Redhat platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'RedHat',
:operatingsystemrelease => '7.1',
})
end
it_configures 'ironic::db'
shared_examples_for 'ironic::db on RedHat platforms' do
context 'using pymysql driver' do
let :params do
@ -136,4 +121,26 @@ describe 'ironic::db' do
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({
:concat_basedir => '/var/lib/puppet/concat',
:fqdn => 'some.host.tld',
}))
end
case facts[:osfamily]
when 'Debian'
it_behaves_like 'ironic::db on Debian platforms'
when 'RedHat'
it_behaves_like 'ironic::db on RedHat platforms'
end
it_behaves_like 'ironic::db'
end
end
end

View File

@ -42,7 +42,7 @@ describe 'ironic::db::sync' do
}))
end
it_configures 'ironic-dbsync'
it_behaves_like 'ironic-dbsync'
end
end

View File

@ -69,7 +69,7 @@ describe 'ironic::drivers::agent' do
let (:facts) do
facts.merge(OSDefaults.get_facts())
end
it_configures 'ironic agent driver'
it_behaves_like 'ironic agent driver'
end
end

View File

@ -40,7 +40,7 @@ describe 'ironic::drivers::drac' do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
it_configures 'ironic drac driver'
it_behaves_like 'ironic drac driver'
end
end

View File

@ -65,7 +65,7 @@ describe 'ironic::drivers::ilo' do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
it_configures 'ironic ilo driver'
it_behaves_like 'ironic ilo driver'
end
end

View File

@ -50,20 +50,17 @@ describe 'ironic::drivers::ipmi' do
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'Debian' })
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 ipmi driver'
end
it_configures 'ironic ipmi driver'
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'RedHat' })
end
it_configures 'ironic ipmi driver'
end
end

View File

@ -111,20 +111,20 @@ describe 'ironic::drivers::pxe' do
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'Debian' })
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({
:concat_basedir => '/var/lib/puppet/concat',
:fqdn => 'some.host.tld',
}))
end
it_behaves_like 'ironic pxe driver'
end
it_configures 'ironic pxe driver'
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'RedHat' })
end
it_configures 'ironic pxe driver'
end
end

View File

@ -43,7 +43,7 @@ describe 'ironic::drivers::ssh' do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
it_configures 'ironic driver ssh'
it_behaves_like 'ironic driver ssh'
end
end

View File

@ -282,29 +282,30 @@ describe 'ironic' do
end
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'Debian' })
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({
:concat_basedir => '/var/lib/puppet/concat',
:fqdn => 'some.host.tld',
}))
end
let :platform_params do
{ :common_package_name => 'ironic-common',
:lib_package_name => 'python-ironic-lib' }
end
let :platform_params do
case facts[:osfamily]
when 'Debian'
{ :common_package_name => 'ironic-common',
:lib_package_name => 'python-ironic-lib' }
when 'RedHat'
{ :common_package_name => 'openstack-ironic-common',
:lib_package_name => 'python-ironic-lib' }
end
end
it_configures 'ironic'
it_behaves_like 'ironic'
end
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'RedHat' })
end
let :platform_params do
{ :common_package_name => 'openstack-ironic-common',
:lib_package_name => 'python-ironic-lib' }
end
it_configures 'ironic'
end
end

View File

@ -138,7 +138,7 @@ describe 'ironic::inspector::authtoken' do
facts.merge!(OSDefaults.get_facts())
end
it_configures 'ironic inspector authtoken'
it_behaves_like 'ironic inspector authtoken'
end
end

View File

@ -54,7 +54,7 @@ describe 'ironic::inspector::db::mysql' do
facts.merge(OSDefaults.get_facts())
end
it_configures 'ironic::inspector::db::mysql'
it_behaves_like 'ironic::inspector::db::mysql'
end
end

View File

@ -32,7 +32,7 @@ describe 'ironic::inspector::db::postgresql' do
facts.merge(OSDefaults.get_facts())
end
it_configures 'ironic::inspector::db::postgresql'
it_behaves_like 'ironic::inspector::db::postgresql'
end
end

View File

@ -74,15 +74,7 @@ describe 'ironic::inspector::db' do
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'Debian',
:operatingsystem => 'Debian',
:operatingsystemrelease => 'jessie',
})
end
it_configures 'ironic::inspector::db'
shared_examples 'ironic::inspector::db on Debian platforms' do
context 'using pymysql driver' do
let :params do
@ -114,14 +106,7 @@ describe 'ironic::inspector::db' do
end
context 'on Redhat platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'RedHat',
:operatingsystemrelease => '7.1',
})
end
it_configures 'ironic::inspector::db'
shared_examples 'ironic::inspector::db on Redhat platforms' do
context 'using pymysql driver' do
let :params do
@ -132,4 +117,26 @@ describe 'ironic::inspector::db' do
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({
:concat_basedir => '/var/lib/puppet/concat',
:fqdn => 'some.host.tld',
}))
end
case facts[:osfamily]
when 'Debian'
it_behaves_like 'ironic::inspector::db on Debian platforms'
when 'RedHat'
it_behaves_like 'ironic::inspector::db on Redhat platforms'
end
it_behaves_like 'ironic::inspector::db'
end
end
end

View File

@ -23,7 +23,7 @@ describe 'ironic::inspector::db::sync' do
let (:facts) do
facts.merge(OSDefaults.get_facts())
end
it_configures 'inspector-dbsync'
it_behaves_like 'inspector-dbsync'
end
end

View File

@ -120,20 +120,16 @@ describe 'ironic::inspector::logging' do
}
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'Debian' })
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-inspector-logging'
end
it_configures 'ironic-inspector-logging'
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'RedHat' })
end
it_configures 'ironic-inspector-logging'
end
end

View File

@ -220,37 +220,29 @@ describe 'ironic::inspector' do
end
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge({
:osfamily => 'Debian',
:operatingsystem => 'Debian',
:operatingsystemrelease => '7.0'
})
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({
:concat_basedir => '/var/lib/puppet/concat',
:fqdn => 'some.host.tld',
}))
end
let :platform_params do
case facts[:osfamily]
when 'Debian'
{ :inspector_package => 'ironic-inspector',
:inspector_service => 'ironic-inspector' }
when 'RedHat'
{ :inspector_service => 'ironic-inspector' }
end
end
it_behaves_like 'ironic inspector'
end
let :platform_params do
{ :inspector_package => 'ironic-inspector',
:inspector_service => 'ironic-inspector' }
end
it_configures 'ironic inspector'
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge({
:osfamily => 'RedHat',
:operatingsystem => 'CentOS',
:operatingsystemrelease => '7.2.1511'
})
end
let :platform_params do
{ :inspector_service => 'ironic-inspector' }
end
it_configures 'ironic inspector'
end
end

View File

@ -22,135 +22,146 @@ require 'spec_helper'
describe 'ironic::keystone::auth_inspector' do
let :facts do
@default_facts.merge({ :osfamily => 'Debian' })
end
shared_examples_for 'ironic keystone auth inspector' do
describe 'with default class parameters' do
let :params do
{ :password => 'ironic_inspector_password',
:tenant => 'foobar' }
describe 'with default class parameters' do
let :params do
{ :password => 'ironic_inspector_password',
:tenant => 'foobar' }
end
it { is_expected.to contain_keystone_user('ironic-inspector').with(
:ensure => 'present',
:password => 'ironic_inspector_password',
) }
it { is_expected.to contain_keystone_user_role('ironic-inspector@foobar').with(
:ensure => 'present',
:roles => ['admin']
)}
it { is_expected.to contain_keystone_service('ironic-inspector::baremetal-introspection').with(
:ensure => 'present',
:type => 'baremetal-introspection',
:description => 'Bare Metal Introspection Service'
) }
it { is_expected.to contain_keystone_endpoint('RegionOne/ironic-inspector::baremetal-introspection').with(
:ensure => 'present',
:public_url => "http://127.0.0.1:5050",
:admin_url => "http://127.0.0.1:5050",
:internal_url => "http://127.0.0.1:5050"
) }
end
it { is_expected.to contain_keystone_user('ironic-inspector').with(
:ensure => 'present',
:password => 'ironic_inspector_password',
) }
describe 'when configuring ironic-inspector' do
let :pre_condition do
"class { 'ironic::inspector': auth_password => 'test' }"
end
it { is_expected.to contain_keystone_user_role('ironic-inspector@foobar').with(
:ensure => 'present',
:roles => ['admin']
)}
let :params do
{ :password => 'ironic_password',
:tenant => 'foobar' }
end
it { is_expected.to contain_keystone_service('ironic-inspector::baremetal-introspection').with(
:ensure => 'present',
:type => 'baremetal-introspection',
:description => 'Bare Metal Introspection Service'
) }
it { is_expected.to contain_keystone_endpoint('RegionOne/ironic-inspector::baremetal-introspection').with(
:ensure => 'present',
:public_url => "http://127.0.0.1:5050",
:admin_url => "http://127.0.0.1:5050",
:internal_url => "http://127.0.0.1:5050"
) }
end
describe 'when configuring ironic-inspector' do
let :pre_condition do
"class { 'ironic::inspector': auth_password => 'test' }"
end
let :params do
{ :password => 'ironic_password',
:tenant => 'foobar' }
end
describe 'with endpoint parameters' do
let :params do
{ :password => 'ironic_password',
:public_url => 'https://10.0.0.10:5050',
:admin_url => 'https://10.0.0.11:5050',
:internal_url => 'https://10.0.0.11:5050' }
end
end
describe 'with endpoint parameters' do
let :params do
{ :password => 'ironic_password',
it { is_expected.to contain_keystone_endpoint('RegionOne/ironic-inspector::baremetal-introspection').with(
:ensure => 'present',
:public_url => 'https://10.0.0.10:5050',
:admin_url => 'https://10.0.0.11:5050',
:internal_url => 'https://10.0.0.11:5050' }
:internal_url => 'https://10.0.0.11:5050'
) }
end
it { is_expected.to contain_keystone_endpoint('RegionOne/ironic-inspector::baremetal-introspection').with(
:ensure => 'present',
:public_url => 'https://10.0.0.10:5050',
:admin_url => 'https://10.0.0.11:5050',
:internal_url => 'https://10.0.0.11:5050'
) }
describe 'when overriding auth name' do
let :params do
{ :password => 'foo',
:auth_name => 'inspecty' }
end
it { is_expected.to contain_keystone_user('inspecty') }
it { is_expected.to contain_keystone_user_role('inspecty@services') }
it { is_expected.to contain_keystone_service('inspecty::baremetal-introspection') }
it { is_expected.to contain_keystone_endpoint('RegionOne/inspecty::baremetal-introspection') }
end
describe 'when overriding service name' do
let :params do
{
:service_name => 'inspector_service',
:password => 'ironic_password',
}
end
it { is_expected.to contain_keystone_user('ironic-inspector') }
it { is_expected.to contain_keystone_user_role('ironic-inspector@services') }
it { is_expected.to contain_keystone_service('inspector_service::baremetal-introspection') }
it { is_expected.to contain_keystone_endpoint('RegionOne/inspector_service::baremetal-introspection') }
end
describe 'when disabling user configuration' do
let :params do
{
:password => 'ironic_password',
:configure_user => false
}
end
it { is_expected.not_to contain_keystone_user('ironic-inspector') }
it { is_expected.to contain_keystone_user_role('ironic-inspector@services') }
it { is_expected.to contain_keystone_service('ironic-inspector::baremetal-introspection').with(
:ensure => 'present',
:type => 'baremetal-introspection',
:description => 'Bare Metal Introspection Service'
) }
end
describe 'when disabling user and user role configuration' do
let :params do
{
:password => 'ironic_password',
:configure_user => false,
:configure_user_role => false
}
end
it { is_expected.not_to contain_keystone_user('ironic-inspector') }
it { is_expected.not_to contain_keystone_user_role('ironic-inspector@services') }
it { is_expected.to contain_keystone_service('ironic-inspector::baremetal-introspection').with(
:ensure => 'present',
:type => 'baremetal-introspection',
:description => 'Bare Metal Introspection Service'
) }
end
end
describe 'when overriding auth name' do
let :params do
{ :password => 'foo',
:auth_name => 'inspecty' }
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 keystone auth inspector'
end
it { is_expected.to contain_keystone_user('inspecty') }
it { is_expected.to contain_keystone_user_role('inspecty@services') }
it { is_expected.to contain_keystone_service('inspecty::baremetal-introspection') }
it { is_expected.to contain_keystone_endpoint('RegionOne/inspecty::baremetal-introspection') }
end
describe 'when overriding service name' do
let :params do
{
:service_name => 'inspector_service',
:password => 'ironic_password',
}
end
it { is_expected.to contain_keystone_user('ironic-inspector') }
it { is_expected.to contain_keystone_user_role('ironic-inspector@services') }
it { is_expected.to contain_keystone_service('inspector_service::baremetal-introspection') }
it { is_expected.to contain_keystone_endpoint('RegionOne/inspector_service::baremetal-introspection') }
end
describe 'when disabling user configuration' do
let :params do
{
:password => 'ironic_password',
:configure_user => false
}
end
it { is_expected.not_to contain_keystone_user('ironic-inspector') }
it { is_expected.to contain_keystone_user_role('ironic-inspector@services') }
it { is_expected.to contain_keystone_service('ironic-inspector::baremetal-introspection').with(
:ensure => 'present',
:type => 'baremetal-introspection',
:description => 'Bare Metal Introspection Service'
) }
end
describe 'when disabling user and user role configuration' do
let :params do
{
:password => 'ironic_password',
:configure_user => false,
:configure_user_role => false
}
end
it { is_expected.not_to contain_keystone_user('ironic-inspector') }
it { is_expected.not_to contain_keystone_user_role('ironic-inspector@services') }
it { is_expected.to contain_keystone_service('ironic-inspector::baremetal-introspection').with(
:ensure => 'present',
:type => 'baremetal-introspection',
:description => 'Bare Metal Introspection Service'
) }
end
end

View File

@ -22,133 +22,145 @@ require 'spec_helper'
describe 'ironic::keystone::auth' do
let :facts do
@default_facts.merge({ :osfamily => 'Debian' })
end
shared_examples_for 'ironic keystone auth' do
describe 'with default class parameters' do
let :params do
{ :password => 'ironic_password',
:tenant => 'foobar' }
describe 'with default class parameters' do
let :params do
{ :password => 'ironic_password',
:tenant => 'foobar' }
end
it { is_expected.to contain_keystone_user('ironic').with(
:ensure => 'present',
:password => 'ironic_password',
) }
it { is_expected.to contain_keystone_user_role('ironic@foobar').with(
:ensure => 'present',
:roles => ['admin']
)}
it { is_expected.to contain_keystone_service('ironic::baremetal').with(
:ensure => 'present',
:description => 'Ironic Bare Metal Provisioning Service'
) }
it { is_expected.to contain_keystone_endpoint('RegionOne/ironic::baremetal').with(
:ensure => 'present',
:public_url => "http://127.0.0.1:6385",
:admin_url => "http://127.0.0.1:6385",
:internal_url => "http://127.0.0.1:6385"
) }
end
it { is_expected.to contain_keystone_user('ironic').with(
:ensure => 'present',
:password => 'ironic_password',
) }
describe 'when configuring ironic-server' do
let :pre_condition do
"class { 'ironic::server': auth_password => 'test' }"
end
it { is_expected.to contain_keystone_user_role('ironic@foobar').with(
:ensure => 'present',
:roles => ['admin']
)}
let :params do
{ :password => 'ironic_password',
:tenant => 'foobar' }
end
it { is_expected.to contain_keystone_service('ironic::baremetal').with(
:ensure => 'present',
:description => 'Ironic Bare Metal Provisioning Service'
) }
it { is_expected.to contain_keystone_endpoint('RegionOne/ironic::baremetal').with(
:ensure => 'present',
:public_url => "http://127.0.0.1:6385",
:admin_url => "http://127.0.0.1:6385",
:internal_url => "http://127.0.0.1:6385"
) }
end
describe 'when configuring ironic-server' do
let :pre_condition do
"class { 'ironic::server': auth_password => 'test' }"
#FIXME it { should contain_keystone_endpoint('RegionOne/ironic').with_notify('Service[ironic-server]') }
end
let :params do
{ :password => 'ironic_password',
:tenant => 'foobar' }
end
describe 'with endpoint parameters' do
let :params do
{ :password => 'ironic_password',
:public_url => 'https://10.0.0.10:6385',
:admin_url => 'https://10.0.0.11:6385',
:internal_url => 'https://10.0.0.11:6385' }
end
#FIXME it { should contain_keystone_endpoint('RegionOne/ironic').with_notify('Service[ironic-server]') }
end
describe 'with endpoint parameters' do
let :params do
{ :password => 'ironic_password',
it { is_expected.to contain_keystone_endpoint('RegionOne/ironic::baremetal').with(
:ensure => 'present',
:public_url => 'https://10.0.0.10:6385',
:admin_url => 'https://10.0.0.11:6385',
:internal_url => 'https://10.0.0.11:6385' }
:internal_url => 'https://10.0.0.11:6385'
) }
end
it { is_expected.to contain_keystone_endpoint('RegionOne/ironic::baremetal').with(
:ensure => 'present',
:public_url => 'https://10.0.0.10:6385',
:admin_url => 'https://10.0.0.11:6385',
:internal_url => 'https://10.0.0.11:6385'
) }
end
describe 'when overriding auth name' do
let :params do
{ :password => 'foo',
:auth_name => 'ironicy' }
end
describe 'when overriding auth name' do
let :params do
{ :password => 'foo',
:auth_name => 'ironicy' }
it { is_expected.to contain_keystone_user('ironicy') }
it { is_expected.to contain_keystone_user_role('ironicy@services') }
it { is_expected.to contain_keystone_service('ironic::baremetal') }
it { is_expected.to contain_keystone_endpoint('RegionOne/ironic::baremetal') }
end
it { is_expected.to contain_keystone_user('ironicy') }
it { is_expected.to contain_keystone_user_role('ironicy@services') }
it { is_expected.to contain_keystone_service('ironic::baremetal') }
it { is_expected.to contain_keystone_endpoint('RegionOne/ironic::baremetal') }
end
describe 'when overriding service name' do
let :params do
{
:service_name => 'ironic_service',
:password => 'ironic_password',
}
end
describe 'when overriding service name' do
let :params do
{
:service_name => 'ironic_service',
:password => 'ironic_password',
}
it { is_expected.to contain_keystone_user('ironic') }
it { is_expected.to contain_keystone_user_role('ironic@services') }
it { is_expected.to contain_keystone_service('ironic_service::baremetal') }
it { is_expected.to contain_keystone_endpoint('RegionOne/ironic_service::baremetal') }
end
it { is_expected.to contain_keystone_user('ironic') }
it { is_expected.to contain_keystone_user_role('ironic@services') }
it { is_expected.to contain_keystone_service('ironic_service::baremetal') }
it { is_expected.to contain_keystone_endpoint('RegionOne/ironic_service::baremetal') }
end
describe 'when disabling user configuration' do
describe 'when disabling user configuration' do
let :params do
{
:password => 'ironic_password',
:configure_user => false
}
end
it { is_expected.not_to contain_keystone_user('ironic') }
it { is_expected.to contain_keystone_user_role('ironic@services') }
it { is_expected.to contain_keystone_service('ironic::baremetal').with(
:ensure => 'present',
:description => 'Ironic Bare Metal Provisioning Service'
) }
let :params do
{
:password => 'ironic_password',
:configure_user => false
}
end
it { is_expected.not_to contain_keystone_user('ironic') }
describe 'when disabling user and user role configuration' do
it { is_expected.to contain_keystone_user_role('ironic@services') }
let :params do
{
:password => 'ironic_password',
:configure_user => false,
:configure_user_role => false
}
end
it { is_expected.to contain_keystone_service('ironic::baremetal').with(
:ensure => 'present',
:description => 'Ironic Bare Metal Provisioning Service'
) }
it { is_expected.not_to contain_keystone_user('ironic') }
it { is_expected.not_to contain_keystone_user_role('ironic@services') }
it { is_expected.to contain_keystone_service('ironic::baremetal').with(
:ensure => 'present',
:description => 'Ironic Bare Metal Provisioning Service'
) }
end
end
describe 'when disabling user and user role configuration' do
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 :params do
{
:password => 'ironic_password',
:configure_user => false,
:configure_user_role => false
}
it_behaves_like 'ironic keystone auth'
end
it { is_expected.not_to contain_keystone_user('ironic') }
it { is_expected.not_to contain_keystone_user_role('ironic@services') }
it { is_expected.to contain_keystone_service('ironic::baremetal').with(
:ensure => 'present',
:description => 'Ironic Bare Metal Provisioning Service'
) }
end
end

View File

@ -120,20 +120,17 @@ describe 'ironic::logging' do
}
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'Debian' })
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-logging'
end
it_configures 'ironic-logging'
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'RedHat' })
end
it_configures 'ironic-logging'
end
end

View File

@ -32,7 +32,7 @@ describe 'ironic::policy' do
facts.merge!(OSDefaults.get_facts())
end
it_configures 'ironic policies'
it_behaves_like 'ironic policies'
end
end

View File

@ -123,28 +123,17 @@ describe 'ironic::pxe' do
end
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge({
:osfamily => 'Debian',
:operatingsystem => 'Debian',
:operatingsystemrelease => '7.0'
})
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 pxe'
end
it_configures 'ironic pxe'
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge({
:osfamily => 'RedHat',
:operatingsystem => 'CentOS',
:operatingsystemrelease => '7.2.1511'
})
end
it_configures 'ironic pxe'
end
end

View File

@ -2,23 +2,15 @@ require 'spec_helper'
describe 'ironic::wsgi::apache' do
let :global_facts do
OSDefaults.get_facts({
:os_workers => 8,
:concat_basedir => '/var/lib/puppet/concat',
:fqdn => 'some.host.tld'
})
end
shared_examples_for 'apache serving ironic with mod_wsgi' do
it { is_expected.to contain_service('httpd').with_name(platform_parameters[:httpd_service_name]) }
it { is_expected.to contain_service('httpd').with_name(platform_params[:httpd_service_name]) }
it { is_expected.to contain_class('ironic::params') }
it { is_expected.to contain_class('apache') }
it { is_expected.to contain_class('apache::mod::wsgi') }
describe 'with default parameters' do
it { is_expected.to contain_file("#{platform_parameters[:wsgi_script_path]}").with(
it { is_expected.to contain_file("#{platform_params[:wsgi_script_path]}").with(
'ensure' => 'directory',
'owner' => 'ironic',
'group' => 'ironic',
@ -28,28 +20,28 @@ describe 'ironic::wsgi::apache' do
it { is_expected.to contain_file('ironic_wsgi').with(
'ensure' => 'file',
'path' => "#{platform_parameters[:wsgi_script_path]}/app",
'source' => "#{platform_parameters[:wsgi_script_source]}",
'path' => "#{platform_params[:wsgi_script_path]}/app",
'source' => "#{platform_params[:wsgi_script_source]}",
'owner' => 'ironic',
'group' => 'ironic',
'mode' => '0644'
)}
it { is_expected.to contain_file('ironic_wsgi').that_requires("File[#{platform_parameters[:wsgi_script_path]}]") }
it { is_expected.to contain_file('ironic_wsgi').that_requires("File[#{platform_params[:wsgi_script_path]}]") }
it { is_expected.to contain_apache__vhost('ironic_wsgi').with(
'servername' => 'some.host.tld',
'ip' => nil,
'port' => '6385',
'docroot' => "#{platform_parameters[:wsgi_script_path]}",
'docroot' => "#{platform_params[:wsgi_script_path]}",
'docroot_owner' => 'ironic',
'docroot_group' => 'ironic',
'ssl' => 'true',
'wsgi_daemon_process' => 'ironic',
'wsgi_process_group' => 'ironic',
'wsgi_script_aliases' => { '/' => "#{platform_parameters[:wsgi_script_path]}/app" },
'wsgi_script_aliases' => { '/' => "#{platform_params[:wsgi_script_path]}/app" },
'require' => 'File[ironic_wsgi]'
)}
it { is_expected.to contain_concat("#{platform_parameters[:httpd_ports_file]}") }
it { is_expected.to contain_concat("#{platform_params[:httpd_ports_file]}") }
end
describe 'when overriding parameters using different ports' do
@ -67,58 +59,54 @@ describe 'ironic::wsgi::apache' do
'servername' => 'dummy.host',
'ip' => '10.42.51.1',
'port' => '12345',
'docroot' => "#{platform_parameters[:wsgi_script_path]}",
'docroot' => "#{platform_params[:wsgi_script_path]}",
'docroot_owner' => 'ironic',
'docroot_group' => 'ironic',
'ssl' => 'false',
'wsgi_daemon_process' => 'ironic',
'wsgi_process_group' => 'ironic',
'wsgi_script_aliases' => { '/' => "#{platform_parameters[:wsgi_script_path]}/app" },
'wsgi_script_aliases' => { '/' => "#{platform_params[:wsgi_script_path]}/app" },
'require' => 'File[ironic_wsgi]'
)}
it { is_expected.to contain_concat("#{platform_parameters[:httpd_ports_file]}") }
it { is_expected.to contain_concat("#{platform_params[:httpd_ports_file]}") }
end
end
context 'on RedHat platforms' do
let :facts do
global_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7.0'
})
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({
:os_workers => 8,
:concat_basedir => '/var/lib/puppet/concat',
:fqdn => 'some.host.tld'
}))
end
let :platform_parameters do
{
:httpd_service_name => 'httpd',
:httpd_ports_file => '/etc/httpd/conf/ports.conf',
:wsgi_script_path => '/var/www/cgi-bin/ironic',
:wsgi_script_source => '/usr/lib/python2.7/site-packages/ironic/api/app.wsgi',
}
end
let :platform_params do
case facts[:osfamily]
when 'Debian'
{
:httpd_service_name => 'apache2',
:httpd_ports_file => '/etc/apache2/ports.conf',
:wsgi_script_path => '/usr/lib/cgi-bin/ironic',
:wsgi_script_source => '/usr/lib/python2.7/dist-packages/ironic/api/app.wsgi',
}
when 'RedHat'
{
:httpd_service_name => 'httpd',
:httpd_ports_file => '/etc/httpd/conf/ports.conf',
:wsgi_script_path => '/var/www/cgi-bin/ironic',
:wsgi_script_source => '/usr/lib/python2.7/site-packages/ironic/api/app.wsgi',
}
end
end
it_configures 'apache serving ironic with mod_wsgi'
it_behaves_like 'apache serving ironic with mod_wsgi'
end
end
context 'on Debian platforms' do
let :facts do
global_facts.merge({
:osfamily => 'Debian',
:operatingsystem => 'Debian',
:operatingsystemrelease => '7.0'
})
end
let :platform_parameters do
{
:httpd_service_name => 'apache2',
:httpd_ports_file => '/etc/apache2/ports.conf',
:wsgi_script_path => '/usr/lib/cgi-bin/ironic',
:wsgi_script_source => '/usr/lib/python2.7/dist-packages/ironic/api/app.wsgi',
}
end
it_configures 'apache serving ironic with mod_wsgi'
end
end