Convert some spec testing to rspec-puppet-facts
Still some to do but these are causing issues right now. Change-Id: I667be66f75069d078ea8c6cd8ca34add2297d335
This commit is contained in:
parent
6686406bce
commit
f2ab2d4783
|
@ -244,7 +244,7 @@ class nova::metadata::novajoin::api (
|
||||||
|
|
||||||
exec { 'get-service-user-keytab':
|
exec { 'get-service-user-keytab':
|
||||||
command => "/usr/bin/kinit -kt /etc/krb5.keytab && ipa-getkeytab -s ${ipa_hostname_real} \
|
command => "/usr/bin/kinit -kt /etc/krb5.keytab && ipa-getkeytab -s ${ipa_hostname_real} \
|
||||||
-p nova/${::fqdn} -k ${keytab}",
|
-p nova/${::fqdn} -k ${keytab}",
|
||||||
creates => $keytab,
|
creates => $keytab,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,6 +103,7 @@ class nova::vendordata(
|
||||||
# ::nova::metadata, we remove the checkes here.
|
# ::nova::metadata, we remove the checkes here.
|
||||||
if $vendordata_caller {
|
if $vendordata_caller {
|
||||||
if ($vendordata_caller == 'metadata') {
|
if ($vendordata_caller == 'metadata') {
|
||||||
|
# lint:ignore:140chars
|
||||||
$vendordata_jsonfile_path_real = pick($::nova::metadata::vendordata_jsonfile_path, $vendordata_jsonfile_path)
|
$vendordata_jsonfile_path_real = pick($::nova::metadata::vendordata_jsonfile_path, $vendordata_jsonfile_path)
|
||||||
$vendordata_providers_pick = pick($::nova::metadata::vendordata_providers, $vendordata_providers)
|
$vendordata_providers_pick = pick($::nova::metadata::vendordata_providers, $vendordata_providers)
|
||||||
$vendordata_dynamic_targets_pick = pick($::nova::metadata::vendordata_dynamic_targets, $vendordata_dynamic_targets)
|
$vendordata_dynamic_targets_pick = pick($::nova::metadata::vendordata_dynamic_targets, $vendordata_dynamic_targets)
|
||||||
|
@ -132,6 +133,7 @@ class nova::vendordata(
|
||||||
$vendordata_dynamic_auth_project_name_real = pick($::nova::api::vendordata_dynamic_auth_project_name, $vendordata_dynamic_auth_project_name)
|
$vendordata_dynamic_auth_project_name_real = pick($::nova::api::vendordata_dynamic_auth_project_name, $vendordata_dynamic_auth_project_name)
|
||||||
$vendordata_dynamic_auth_user_domain_name_real = pick($::nova::api::vendordata_dynamic_auth_user_domain_name, $vendordata_dynamic_auth_user_domain_name)
|
$vendordata_dynamic_auth_user_domain_name_real = pick($::nova::api::vendordata_dynamic_auth_user_domain_name, $vendordata_dynamic_auth_user_domain_name)
|
||||||
$vendordata_dynamic_auth_username_real = pick($::nova::api::vendordata_dynamic_auth_username, $vendordata_dynamic_auth_username)
|
$vendordata_dynamic_auth_username_real = pick($::nova::api::vendordata_dynamic_auth_username, $vendordata_dynamic_auth_username)
|
||||||
|
# lint:endignore
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$vendordata_jsonfile_path_real = $vendordata_jsonfile_path
|
$vendordata_jsonfile_path_real = $vendordata_jsonfile_path
|
||||||
|
|
|
@ -1,32 +1,48 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe 'nova::config' do
|
describe 'nova::config' do
|
||||||
|
shared_examples 'nova::config' do
|
||||||
let :params do
|
let :params do
|
||||||
{ :nova_config => {
|
{
|
||||||
'DEFAULT/foo' => { 'value' => 'fooValue' },
|
:nova_config => {
|
||||||
'DEFAULT/bar' => { 'value' => 'barValue' },
|
'DEFAULT/foo' => { 'value' => 'fooValue' },
|
||||||
'DEFAULT/baz' => { 'ensure' => 'absent' }
|
'DEFAULT/bar' => { 'value' => 'barValue' },
|
||||||
},
|
'DEFAULT/baz' => { 'ensure' => 'absent' }
|
||||||
:nova_paste_api_ini => {
|
},
|
||||||
'DEFAULT/foo2' => { 'value' => 'fooValue' },
|
:nova_paste_api_ini => {
|
||||||
'DEFAULT/bar2' => { 'value' => 'barValue' },
|
'DEFAULT/foo2' => { 'value' => 'fooValue' },
|
||||||
'DEFAULT/baz2' => { 'ensure' => 'absent' }
|
'DEFAULT/bar2' => { 'value' => 'barValue' },
|
||||||
|
'DEFAULT/baz2' => { 'ensure' => 'absent' }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
end
|
||||||
|
|
||||||
|
context 'with specified configs' do
|
||||||
|
it { should contain_class('nova::deps') }
|
||||||
|
|
||||||
|
it {
|
||||||
|
should contain_nova_config('DEFAULT/foo').with_value('fooValue')
|
||||||
|
should contain_nova_config('DEFAULT/bar').with_value('barValue')
|
||||||
|
should contain_nova_config('DEFAULT/baz').with_ensure('absent')
|
||||||
|
}
|
||||||
|
|
||||||
|
it {
|
||||||
|
should contain_nova_paste_api_ini('DEFAULT/foo2').with_value('fooValue')
|
||||||
|
should contain_nova_paste_api_ini('DEFAULT/bar2').with_value('barValue')
|
||||||
|
should contain_nova_paste_api_ini('DEFAULT/baz2').with_ensure('absent')
|
||||||
|
}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to contain_class('nova::deps') }
|
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 'configures arbitrary nova configurations' do
|
it_behaves_like 'nova::config'
|
||||||
is_expected.to contain_nova_config('DEFAULT/foo').with_value('fooValue')
|
end
|
||||||
is_expected.to contain_nova_config('DEFAULT/bar').with_value('barValue')
|
|
||||||
is_expected.to contain_nova_config('DEFAULT/baz').with_ensure('absent')
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'configures arbitrary nova api-paste configurations' do
|
|
||||||
is_expected.to contain_nova_paste_api_ini('DEFAULT/foo2').with_value('fooValue')
|
|
||||||
is_expected.to contain_nova_paste_api_ini('DEFAULT/bar2').with_value('barValue')
|
|
||||||
is_expected.to contain_nova_paste_api_ini('DEFAULT/baz2').with_ensure('absent')
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,19 +1,6 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe 'nova::metadata::novajoin::api' do
|
describe 'nova::metadata::novajoin::api' do
|
||||||
|
|
||||||
let :facts do
|
|
||||||
@default_facts.merge(
|
|
||||||
{
|
|
||||||
:osfamily => 'RedHat',
|
|
||||||
:processorcount => '7',
|
|
||||||
:fqdn => "undercloud.example.com",
|
|
||||||
:operatingsystemrelease => '7.0',
|
|
||||||
:ipa_hostname => 'ipa.ipadomain'
|
|
||||||
}
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
let :default_params do
|
let :default_params do
|
||||||
{
|
{
|
||||||
:bind_address => '127.0.0.1',
|
:bind_address => '127.0.0.1',
|
||||||
|
@ -41,186 +28,171 @@ describe 'nova::metadata::novajoin::api' do
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
[{},
|
let :pre_condition do
|
||||||
{
|
"class { '::ipaclient': password => 'join_otp', }
|
||||||
:bind_address => '0.0.0.0',
|
class { '::nova::metadata::novajoin::authtoken':
|
||||||
:api_paste_config => '/etc/novajoin/join-api-paste.ini',
|
password => 'passw0rd',
|
||||||
:auth_strategy => 'noauth2',
|
}"
|
||||||
:auth_type => 'password',
|
end
|
||||||
:cacert => '/etc/ipa/ca.crt',
|
|
||||||
:connect_retries => 2,
|
|
||||||
:debug => true,
|
|
||||||
:enabled => false,
|
|
||||||
:enable_ipa_client_install => false,
|
|
||||||
:ensure_package => 'present',
|
|
||||||
:join_listen_port => '9921',
|
|
||||||
:keytab => '/etc/krb5.conf',
|
|
||||||
:log_dir => '/var/log/novajoin',
|
|
||||||
:manage_service => true,
|
|
||||||
:service_user => 'novajoin1',
|
|
||||||
:project_domain_name => 'default',
|
|
||||||
:project_name => 'service',
|
|
||||||
:user_domain_id => 'default',
|
|
||||||
:ipa_domain => 'EXAMPLE2.COM',
|
|
||||||
:keystone_auth_url => 'https://keystone2.example.com:5000',
|
|
||||||
:service_password => 'my_secret_password2',
|
|
||||||
:transport_url => 'rabbit:rabbit_pass2@rabbit_host',
|
|
||||||
}
|
|
||||||
].each do |param_set|
|
|
||||||
|
|
||||||
describe "when #{param_set == {} ? "using default" : "specifying"} class parameters" do
|
shared_examples 'nova::metadata::novajoin::api' do
|
||||||
|
[{},
|
||||||
let :param_hash do
|
{
|
||||||
default_params.merge(param_set)
|
:bind_address => '0.0.0.0',
|
||||||
end
|
:api_paste_config => '/etc/novajoin/join-api-paste.ini',
|
||||||
|
:auth_strategy => 'noauth2',
|
||||||
let :params do
|
:auth_type => 'password',
|
||||||
param_hash
|
:cacert => '/etc/ipa/ca.crt',
|
||||||
end
|
:connect_retries => 2,
|
||||||
|
:debug => true,
|
||||||
let :pre_condition do
|
:enabled => false,
|
||||||
"class { '::ipaclient':
|
:enable_ipa_client_install => false,
|
||||||
password => 'join_otp'
|
:ensure_package => 'present',
|
||||||
}
|
:join_listen_port => '9921',
|
||||||
class { '::nova::metadata::novajoin::authtoken':
|
:keytab => '/etc/krb5.conf',
|
||||||
password => 'passw0rd',
|
:log_dir => '/var/log/novajoin',
|
||||||
}
|
:manage_service => true,
|
||||||
"
|
:service_user => 'novajoin1',
|
||||||
end
|
:project_domain_name => 'default',
|
||||||
|
:project_name => 'service',
|
||||||
it { is_expected.to contain_class('nova::metadata::novajoin::authtoken') }
|
:user_domain_id => 'default',
|
||||||
|
:ipa_domain => 'EXAMPLE2.COM',
|
||||||
it { is_expected.to contain_service('novajoin-server').with(
|
:keystone_auth_url => 'https://keystone2.example.com:5000',
|
||||||
'ensure' => (param_hash[:manage_service] && param_hash[:enabled]) ? 'running': 'stopped',
|
:service_password => 'my_secret_password2',
|
||||||
'enable' => param_hash[:enabled],
|
:transport_url => 'rabbit:rabbit_pass2@rabbit_host',
|
||||||
'hasstatus' => true,
|
}
|
||||||
'hasrestart' => true,
|
].each do |param_set|
|
||||||
'tag' => 'openstack',
|
context "when #{param_set == {} ? "using default" : "specifying"} class parameters" do
|
||||||
) }
|
let :param_hash do
|
||||||
|
default_params.merge(param_set)
|
||||||
it { is_expected.to contain_service('novajoin-notify').with(
|
|
||||||
'ensure' => (param_hash[:manage_service] && param_hash[:enabled]) ? 'running': 'stopped',
|
|
||||||
'enable' => param_hash[:enabled],
|
|
||||||
'hasstatus' => true,
|
|
||||||
'hasrestart' => true,
|
|
||||||
'tag' => 'openstack',
|
|
||||||
) }
|
|
||||||
|
|
||||||
it 'is_expected.to configure default parameters' do
|
|
||||||
is_expected.to contain_novajoin_config('DEFAULT/join_listen').with_value(param_hash[:bind_address])
|
|
||||||
is_expected.to contain_novajoin_config('DEFAULT/api_paste_config').with_value(param_hash[:api_paste_config])
|
|
||||||
is_expected.to contain_novajoin_config('DEFAULT/auth_strategy').with_value(param_hash[:auth_strategy])
|
|
||||||
is_expected.to contain_novajoin_config('DEFAULT/cacert').with_value(param_hash[:cacert])
|
|
||||||
is_expected.to contain_novajoin_config('DEFAULT/connect_retries').with_value(param_hash[:connect_retries])
|
|
||||||
is_expected.to contain_novajoin_config('DEFAULT/debug').with_value(param_hash[:debug])
|
|
||||||
is_expected.to contain_novajoin_config('DEFAULT/join_listen_port').with_value(param_hash[:join_listen_port])
|
|
||||||
is_expected.to contain_novajoin_config('DEFAULT/keytab').with_value(param_hash[:keytab])
|
|
||||||
is_expected.to contain_novajoin_config('DEFAULT/log_dir').with_value(param_hash[:log_dir])
|
|
||||||
is_expected.to contain_novajoin_config('DEFAULT/domain').with_value(param_hash[:ipa_domain])
|
|
||||||
is_expected.to contain_novajoin_config('DEFAULT/transport_url').with_value(param_hash[:transport_url])
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'is_expected.to configure service credentials' do
|
|
||||||
is_expected.to contain_novajoin_config('service_credentials/auth_type').with_value(param_hash[:auth_type])
|
|
||||||
is_expected.to contain_novajoin_config('service_credentials/auth_url').with_value(param_hash[:keystone_auth_url])
|
|
||||||
is_expected.to contain_novajoin_config('service_credentials/password').with_value(param_hash[:service_password])
|
|
||||||
is_expected.to contain_novajoin_config('service_credentials/project_name').with_value(param_hash[:project_name])
|
|
||||||
is_expected.to contain_novajoin_config('service_credentials/user_domain_id').with_value(param_hash[:user_domain_id])
|
|
||||||
is_expected.to contain_novajoin_config('service_credentials/project_domain_name').with_value(param_hash[:project_domain_name])
|
|
||||||
is_expected.to contain_novajoin_config('service_credentials/username').with_value(param_hash[:service_user])
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'is_expected.to get service user keytab' do
|
|
||||||
if param_hash[:enable_ipa_client_install]
|
|
||||||
is_expected.to contain_exec('get-service-user-keytab').with(
|
|
||||||
'command' => "/usr/bin/kinit -kt /etc/krb5.keytab && ipa-getkeytab -s `grep xmlrpc_uri /etc/ipa/default.conf | cut -d/ -f3` \
|
|
||||||
-p nova/undercloud.example.com -k #{param_hash[:keytab]}",
|
|
||||||
)
|
|
||||||
else
|
|
||||||
is_expected.to contain_exec('get-service-user-keytab').with(
|
|
||||||
'command' => "/usr/bin/kinit -kt /etc/krb5.keytab && ipa-getkeytab -s ipa.ipadomain \
|
|
||||||
-p nova/undercloud.example.com -k #{param_hash[:keytab]}",
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
let :params do
|
||||||
|
param_hash
|
||||||
|
end
|
||||||
|
|
||||||
|
it { should contain_class('nova::metadata::novajoin::authtoken') }
|
||||||
|
|
||||||
|
it { should contain_service('novajoin-server').with(
|
||||||
|
'ensure' => (param_hash[:manage_service] && param_hash[:enabled]) ? 'running': 'stopped',
|
||||||
|
'enable' => param_hash[:enabled],
|
||||||
|
'hasstatus' => true,
|
||||||
|
'hasrestart' => true,
|
||||||
|
'tag' => 'openstack',
|
||||||
|
)}
|
||||||
|
|
||||||
|
it { should contain_service('novajoin-notify').with(
|
||||||
|
'ensure' => (param_hash[:manage_service] && param_hash[:enabled]) ? 'running': 'stopped',
|
||||||
|
'enable' => param_hash[:enabled],
|
||||||
|
'hasstatus' => true,
|
||||||
|
'hasrestart' => true,
|
||||||
|
'tag' => 'openstack',
|
||||||
|
)}
|
||||||
|
|
||||||
|
it {
|
||||||
|
should contain_novajoin_config('DEFAULT/join_listen').with_value(param_hash[:bind_address])
|
||||||
|
should contain_novajoin_config('DEFAULT/api_paste_config').with_value(param_hash[:api_paste_config])
|
||||||
|
should contain_novajoin_config('DEFAULT/auth_strategy').with_value(param_hash[:auth_strategy])
|
||||||
|
should contain_novajoin_config('DEFAULT/cacert').with_value(param_hash[:cacert])
|
||||||
|
should contain_novajoin_config('DEFAULT/connect_retries').with_value(param_hash[:connect_retries])
|
||||||
|
should contain_novajoin_config('DEFAULT/debug').with_value(param_hash[:debug])
|
||||||
|
should contain_novajoin_config('DEFAULT/join_listen_port').with_value(param_hash[:join_listen_port])
|
||||||
|
should contain_novajoin_config('DEFAULT/keytab').with_value(param_hash[:keytab])
|
||||||
|
should contain_novajoin_config('DEFAULT/log_dir').with_value(param_hash[:log_dir])
|
||||||
|
should contain_novajoin_config('DEFAULT/domain').with_value(param_hash[:ipa_domain])
|
||||||
|
should contain_novajoin_config('DEFAULT/transport_url').with_value(param_hash[:transport_url])
|
||||||
|
}
|
||||||
|
|
||||||
|
it {
|
||||||
|
should contain_novajoin_config('service_credentials/auth_type').with_value(param_hash[:auth_type])
|
||||||
|
should contain_novajoin_config('service_credentials/auth_url').with_value(param_hash[:keystone_auth_url])
|
||||||
|
should contain_novajoin_config('service_credentials/password').with_value(param_hash[:service_password])
|
||||||
|
should contain_novajoin_config('service_credentials/project_name').with_value(param_hash[:project_name])
|
||||||
|
should contain_novajoin_config('service_credentials/user_domain_id').with_value(param_hash[:user_domain_id])
|
||||||
|
should contain_novajoin_config('service_credentials/project_domain_name').with_value(param_hash[:project_domain_name])
|
||||||
|
should contain_novajoin_config('service_credentials/username').with_value(param_hash[:service_user])
|
||||||
|
}
|
||||||
|
|
||||||
|
it {
|
||||||
|
if param_hash[:enable_ipa_client_install]
|
||||||
|
should contain_exec('get-service-user-keytab').with(
|
||||||
|
'command' => "/usr/bin/kinit -kt /etc/krb5.keytab && ipa-getkeytab -s `grep xmlrpc_uri /etc/ipa/default.conf | cut -d/ -f3` \
|
||||||
|
-p nova/undercloud.example.com -k #{param_hash[:keytab]}",
|
||||||
|
)
|
||||||
|
else
|
||||||
|
should contain_exec('get-service-user-keytab').with(
|
||||||
|
'command' => "/usr/bin/kinit -kt /etc/krb5.keytab && ipa-getkeytab -s ipa.ipadomain \
|
||||||
|
-p nova/undercloud.example.com -k #{param_hash[:keytab]}",
|
||||||
|
)
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
it { should contain_file("/var/log/novajoin").with(
|
||||||
|
'ensure' => 'directory',
|
||||||
|
'owner' => "#{param_hash[:service_user]}",
|
||||||
|
'group' => "#{param_hash[:service_user]}",
|
||||||
|
'recurse' => true
|
||||||
|
)}
|
||||||
|
|
||||||
|
it { should contain_file("#{param_hash[:keytab]}").with(
|
||||||
|
'owner' => "#{param_hash[:service_user]}",
|
||||||
|
'require' => 'Exec[get-service-user-keytab]',
|
||||||
|
)}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with disabled service managing' do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:manage_service => false,
|
||||||
|
:enabled => false,
|
||||||
|
:ipa_domain => 'EXAMPLE.COM',
|
||||||
|
:service_password => 'my_secret_password',
|
||||||
|
:transport_url => 'rabbit:rabbit_pass@rabbit_host',
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to contain_file("/var/log/novajoin").with(
|
it { should contain_service('novajoin-server').with(
|
||||||
'ensure' => 'directory',
|
'ensure' => nil,
|
||||||
'owner' => "#{param_hash[:service_user]}",
|
'enable' => false,
|
||||||
'group' => "#{param_hash[:service_user]}",
|
'hasstatus' => true,
|
||||||
'recurse' => true
|
'hasrestart' => true,
|
||||||
|
'tag' => 'openstack',
|
||||||
)}
|
)}
|
||||||
|
|
||||||
it { is_expected.to contain_file("#{param_hash[:keytab]}").with(
|
it { should contain_service('novajoin-notify').with(
|
||||||
'owner' => "#{param_hash[:service_user]}",
|
'ensure' => nil,
|
||||||
'require' => 'Exec[get-service-user-keytab]',
|
'enable' => false,
|
||||||
|
'hasstatus' => true,
|
||||||
|
'hasrestart' => true,
|
||||||
|
'tag' => 'openstack',
|
||||||
)}
|
)}
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'with disabled service managing' do
|
shared_examples 'nova::metadata::novajoin::api on RedHat' do
|
||||||
let :facts do
|
|
||||||
OSDefaults.get_facts({
|
|
||||||
:osfamily => 'RedHat',
|
|
||||||
:operatingsystem => 'RedHat',
|
|
||||||
:operatingsystemrelease => '7.0',
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
let :params do
|
let :params do
|
||||||
{
|
default_params
|
||||||
:manage_service => false,
|
|
||||||
:enabled => false,
|
|
||||||
:ipa_domain => 'EXAMPLE.COM',
|
|
||||||
:service_password => 'my_secret_password',
|
|
||||||
:transport_url => 'rabbit:rabbit_pass@rabbit_host',
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
let :pre_condition do
|
it { should contain_package('python-novajoin').with(
|
||||||
"class { '::ipaclient': password => 'join_otp', }
|
|
||||||
class { '::nova::metadata::novajoin::authtoken':
|
|
||||||
password => 'passw0rd',
|
|
||||||
}"
|
|
||||||
end
|
|
||||||
|
|
||||||
it { is_expected.to contain_service('novajoin-server').with(
|
|
||||||
'ensure' => nil,
|
|
||||||
'enable' => false,
|
|
||||||
'hasstatus' => true,
|
|
||||||
'hasrestart' => true,
|
|
||||||
'tag' => 'openstack',
|
|
||||||
) }
|
|
||||||
|
|
||||||
it { is_expected.to contain_service('novajoin-notify').with(
|
|
||||||
'ensure' => nil,
|
|
||||||
'enable' => false,
|
|
||||||
'hasstatus' => true,
|
|
||||||
'hasrestart' => true,
|
|
||||||
'tag' => 'openstack',
|
|
||||||
) }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'on RedHat platforms' do
|
|
||||||
let :facts do
|
|
||||||
OSDefaults.get_facts({
|
|
||||||
:osfamily => 'RedHat',
|
|
||||||
:operatingsystem => 'RedHat',
|
|
||||||
:operatingsystemrelease => '7.0',
|
|
||||||
})
|
|
||||||
end
|
|
||||||
let(:params) { default_params }
|
|
||||||
|
|
||||||
let :pre_condition do
|
|
||||||
"class { '::ipaclient': password => 'join_otp', }
|
|
||||||
class { '::nova::metadata::novajoin::authtoken':
|
|
||||||
password => 'passw0rd',
|
|
||||||
}"
|
|
||||||
end
|
|
||||||
|
|
||||||
it { is_expected.to contain_package('python-novajoin').with(
|
|
||||||
:tag => ['openstack', 'novajoin-package'],
|
:tag => ['openstack', 'novajoin-package'],
|
||||||
)}
|
)}
|
||||||
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({ :ipa_hostname => 'ipa.ipadomain',
|
||||||
|
:fqdn => "undercloud.example.com" }))
|
||||||
|
end
|
||||||
|
|
||||||
|
if facts[:osfamily] == 'RedHat'
|
||||||
|
it_behaves_like 'nova::metadata::novajoin::api'
|
||||||
|
it_behaves_like 'nova::metadata::novajoin::api on RedHat'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,167 +3,176 @@ require 'spec_helper'
|
||||||
describe 'nova::metadata::novajoin::auth' do
|
describe 'nova::metadata::novajoin::auth' do
|
||||||
|
|
||||||
let :params do
|
let :params do
|
||||||
{:password => 'novajoin_password'}
|
{
|
||||||
|
:password => 'novajoin_password'
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
let :default_params do
|
let :default_params do
|
||||||
{ :auth_name => 'novajoin',
|
{
|
||||||
:service_name => 'novajoin',
|
:auth_name => 'novajoin',
|
||||||
:region => 'RegionOne',
|
:service_name => 'novajoin',
|
||||||
:tenant => 'services',
|
:region => 'RegionOne',
|
||||||
:email => 'novajoin@localhost',
|
:tenant => 'services',
|
||||||
:public_url => 'http://127.0.0.1:9090',
|
:email => 'novajoin@localhost',
|
||||||
:internal_url => 'http://127.0.0.1:9090',
|
|
||||||
:admin_url => 'http://127.0.0.1:9090' }
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'with default parameters' do
|
|
||||||
|
|
||||||
it { is_expected.to contain_keystone_user('novajoin').with(
|
|
||||||
:ensure => 'present',
|
|
||||||
:password => 'novajoin_password'
|
|
||||||
) }
|
|
||||||
|
|
||||||
it { is_expected.to contain_keystone_user_role('novajoin@services').with(
|
|
||||||
:ensure => 'present',
|
|
||||||
:roles => ['admin']
|
|
||||||
)}
|
|
||||||
|
|
||||||
it { is_expected.to contain_keystone_service('novajoin::compute-vendordata-plugin').with(
|
|
||||||
:ensure => 'present',
|
|
||||||
:description => 'Novajoin vendordata plugin'
|
|
||||||
)}
|
|
||||||
|
|
||||||
it { is_expected.to_not contain_keystone_endpoint('RegionOne/novajoin::compute-vendordata-plugin') }
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when setting auth name' do
|
|
||||||
before do
|
|
||||||
params.merge!( :auth_name => 'foo' )
|
|
||||||
end
|
|
||||||
|
|
||||||
it { is_expected.to contain_keystone_user('foo').with(
|
|
||||||
:ensure => 'present',
|
|
||||||
:password => 'novajoin_password'
|
|
||||||
) }
|
|
||||||
|
|
||||||
it { is_expected.to contain_keystone_user_role('foo@services').with(
|
|
||||||
:ensure => 'present',
|
|
||||||
:roles => ['admin']
|
|
||||||
)}
|
|
||||||
|
|
||||||
it { is_expected.to contain_keystone_service('novajoin::compute-vendordata-plugin').with(
|
|
||||||
:ensure => 'present',
|
|
||||||
:description => 'Novajoin vendordata plugin'
|
|
||||||
)}
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when creating endpoint with default parameters' do
|
|
||||||
before do
|
|
||||||
params.merge!( :configure_endpoint => true )
|
|
||||||
end
|
|
||||||
it { is_expected.to contain_keystone_endpoint('RegionOne/novajoin::compute-vendordata-plugin').with(
|
|
||||||
:ensure => 'present',
|
|
||||||
:public_url => 'http://127.0.0.1:9090',
|
:public_url => 'http://127.0.0.1:9090',
|
||||||
:admin_url => 'http://127.0.0.1:9090',
|
:internal_url => 'http://127.0.0.1:9090',
|
||||||
:internal_url => 'http://127.0.0.1:9090'
|
:admin_url => 'http://127.0.0.1:9090'
|
||||||
)}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when overriding endpoint parameters' do
|
shared_examples 'nova::metadata::novajoin::auth' do
|
||||||
before do
|
context 'with default parameters' do
|
||||||
params.merge!(
|
it { should contain_keystone_user('novajoin').with(
|
||||||
:configure_endpoint => true,
|
:ensure => 'present',
|
||||||
:region => 'RegionTwo',
|
:password => 'novajoin_password'
|
||||||
:public_url => 'https://10.0.0.1:9090',
|
)}
|
||||||
:internal_url => 'https://10.0.0.3:9090',
|
|
||||||
:admin_url => 'https://10.0.0.2:9090',
|
it { should contain_keystone_user_role('novajoin@services').with(
|
||||||
)
|
:ensure => 'present',
|
||||||
|
:roles => ['admin']
|
||||||
|
)}
|
||||||
|
|
||||||
|
it { should contain_keystone_service('novajoin::compute-vendordata-plugin').with(
|
||||||
|
:ensure => 'present',
|
||||||
|
:description => 'Novajoin vendordata plugin'
|
||||||
|
)}
|
||||||
|
|
||||||
|
it { should_not contain_keystone_endpoint('RegionOne/novajoin::compute-vendordata-plugin') }
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to contain_keystone_endpoint('RegionTwo/novajoin::compute-vendordata-plugin').with(
|
context 'when setting auth name' do
|
||||||
:ensure => 'present',
|
before do
|
||||||
:public_url => params[:public_url],
|
params.merge!( :auth_name => 'foo' )
|
||||||
:internal_url => params[:internal_url],
|
end
|
||||||
:admin_url => params[:admin_url]
|
|
||||||
)}
|
|
||||||
|
|
||||||
|
it { should contain_keystone_user('foo').with(
|
||||||
|
:ensure => 'present',
|
||||||
|
:password => 'novajoin_password'
|
||||||
|
)}
|
||||||
|
|
||||||
|
it { should contain_keystone_user_role('foo@services').with(
|
||||||
|
:ensure => 'present',
|
||||||
|
:roles => ['admin']
|
||||||
|
)}
|
||||||
|
|
||||||
|
it { should contain_keystone_service('novajoin::compute-vendordata-plugin').with(
|
||||||
|
:ensure => 'present',
|
||||||
|
:description => 'Novajoin vendordata plugin'
|
||||||
|
)}
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when creating endpoint with default parameters' do
|
||||||
|
before do
|
||||||
|
params.merge!( :configure_endpoint => true )
|
||||||
|
end
|
||||||
|
|
||||||
|
it { should contain_keystone_endpoint('RegionOne/novajoin::compute-vendordata-plugin').with(
|
||||||
|
:ensure => 'present',
|
||||||
|
:public_url => 'http://127.0.0.1:9090',
|
||||||
|
:admin_url => 'http://127.0.0.1:9090',
|
||||||
|
:internal_url => 'http://127.0.0.1:9090'
|
||||||
|
)}
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when overriding endpoint parameters' do
|
||||||
|
before do
|
||||||
|
params.merge!(
|
||||||
|
:configure_endpoint => true,
|
||||||
|
:region => 'RegionTwo',
|
||||||
|
:public_url => 'https://10.0.0.1:9090',
|
||||||
|
:internal_url => 'https://10.0.0.3:9090',
|
||||||
|
:admin_url => 'https://10.0.0.2:9090',
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
it { should contain_keystone_endpoint('RegionTwo/novajoin::compute-vendordata-plugin').with(
|
||||||
|
:ensure => 'present',
|
||||||
|
:public_url => params[:public_url],
|
||||||
|
:internal_url => params[:internal_url],
|
||||||
|
:admin_url => params[:admin_url]
|
||||||
|
)}
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when disabling user configuration' do
|
||||||
|
before do
|
||||||
|
params.merge!( :configure_user => false )
|
||||||
|
end
|
||||||
|
|
||||||
|
it { should_not contain_keystone_user('novajoin') }
|
||||||
|
it { should contain_keystone_user_role('novajoin@services') }
|
||||||
|
|
||||||
|
it { should contain_keystone_service('novajoin::compute-vendordata-plugin').with(
|
||||||
|
:ensure => 'present',
|
||||||
|
:description => 'Novajoin vendordata plugin'
|
||||||
|
)}
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when disabling user and user role configuration' do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:configure_user => false,
|
||||||
|
:configure_user_role => false,
|
||||||
|
:password => 'novajoin_password'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it { should_not contain_keystone_user('novajoin') }
|
||||||
|
it { should_not contain_keystone_user_role('novajoin@services') }
|
||||||
|
|
||||||
|
it { should contain_keystone_service('novajoin::compute-vendordata-plugin').with(
|
||||||
|
:ensure => 'present',
|
||||||
|
:description => 'Novajoin vendordata plugin'
|
||||||
|
)}
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when configuring novajoin and the keystone endpoint' do
|
||||||
|
let :pre_condition do
|
||||||
|
"class { '::nova::metadata::novajoin::authtoken':
|
||||||
|
password => 'secrete',
|
||||||
|
}
|
||||||
|
class { '::ipaclient': password => 'join_otp', }
|
||||||
|
class { '::nova::metadata::novajoin::api':
|
||||||
|
service_password => 'secrete',
|
||||||
|
transport_url => 'rabbit://127.0.0.1//',
|
||||||
|
}"
|
||||||
|
end
|
||||||
|
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:password => 'test',
|
||||||
|
:configure_endpoint => true,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it { should contain_keystone_endpoint('RegionOne/novajoin::compute-vendordata-plugin').with_notify(['Service[novajoin-server]', 'Service[novajoin-notify]']) }
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when overriding service names' do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:service_name => 'novajoin_service',
|
||||||
|
:password => 'novajoin_password'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it { should contain_keystone_user('novajoin') }
|
||||||
|
it { should contain_keystone_user_role('novajoin@services') }
|
||||||
|
it { should contain_keystone_service('novajoin_service::compute-vendordata-plugin') }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'when disabling user configuration' do
|
on_supported_os({
|
||||||
before do
|
:supported_os => OSDefaults.get_supported_os
|
||||||
params.merge!( :configure_user => false )
|
}).each do |os,facts|
|
||||||
end
|
context "on #{os}" do
|
||||||
|
let (:facts) do
|
||||||
|
facts.merge!(OSDefaults.get_facts())
|
||||||
|
end
|
||||||
|
|
||||||
it { is_expected.to_not contain_keystone_user('novajoin') }
|
if facts[:osfamily] == 'RedHat'
|
||||||
it { is_expected.to contain_keystone_user_role('novajoin@services') }
|
it_behaves_like 'nova::metadata::novajoin::auth'
|
||||||
it { is_expected.to contain_keystone_service('novajoin::compute-vendordata-plugin').with(
|
end
|
||||||
:ensure => 'present',
|
end
|
||||||
:description => 'Novajoin vendordata plugin'
|
|
||||||
)}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'when disabling user and user role configuration' do
|
|
||||||
let :params do
|
|
||||||
{
|
|
||||||
:configure_user => false,
|
|
||||||
:configure_user_role => false,
|
|
||||||
:password => 'novajoin_password'
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
it { is_expected.to_not contain_keystone_user('novajoin') }
|
|
||||||
it { is_expected.to_not contain_keystone_user_role('novajoin@services') }
|
|
||||||
it { is_expected.to contain_keystone_service('novajoin::compute-vendordata-plugin').with(
|
|
||||||
:ensure => 'present',
|
|
||||||
:description => 'Novajoin vendordata plugin'
|
|
||||||
)}
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'when configuring novajoin and the keystone endpoint' do
|
|
||||||
let :pre_condition do
|
|
||||||
"class { '::nova::metadata::novajoin::authtoken':
|
|
||||||
password => 'secrete',
|
|
||||||
}
|
|
||||||
class { '::ipaclient': password => 'join_otp', }
|
|
||||||
class { '::nova::metadata::novajoin::api':
|
|
||||||
service_password => 'secrete',
|
|
||||||
transport_url => 'rabbit://127.0.0.1//',
|
|
||||||
}"
|
|
||||||
end
|
|
||||||
|
|
||||||
let :facts do
|
|
||||||
@default_facts.merge({
|
|
||||||
:osfamily => 'RedHat',
|
|
||||||
:operatingsystem => 'RedHat',
|
|
||||||
:operatingsystemrelease => '7.0',
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
let :params do
|
|
||||||
{
|
|
||||||
:password => 'test',
|
|
||||||
:configure_endpoint => true,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
it { is_expected.to contain_keystone_endpoint('RegionOne/novajoin::compute-vendordata-plugin').with_notify(['Service[novajoin-server]', 'Service[novajoin-notify]']) }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'when overriding service names' do
|
|
||||||
|
|
||||||
let :params do
|
|
||||||
{
|
|
||||||
:service_name => 'novajoin_service',
|
|
||||||
:password => 'novajoin_password'
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
it { is_expected.to contain_keystone_user('novajoin') }
|
|
||||||
it { is_expected.to contain_keystone_user_role('novajoin@services') }
|
|
||||||
it { is_expected.to contain_keystone_service('novajoin_service::compute-vendordata-plugin') }
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue