Do not test detail of keystone::auth::service_identity
... but test interfaces of that resource type. This helps us avoid direct breakage caused by any change in puppet-keystone. Change-Id: If1172824c6f446602632632ad749aed48fb5abfa
This commit is contained in:
parent
8ff2661983
commit
bcb4265b2b
@ -1,100 +1,63 @@
|
|||||||
|
#
|
||||||
|
# Unit tests for ceilometer::keystone::auth
|
||||||
|
#
|
||||||
|
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe 'ceilometer::keystone::auth' do
|
describe 'ceilometer::keystone::auth' do
|
||||||
|
shared_examples_for 'ceilometer::keystone::auth' do
|
||||||
|
context 'with default class parameters' do
|
||||||
|
let :params do
|
||||||
|
{ :password => 'ceilometer_password' }
|
||||||
|
end
|
||||||
|
|
||||||
let :default_params do
|
it { is_expected.to contain_keystone__resource__service_identity('ceilometer').with(
|
||||||
{
|
:configure_user => true,
|
||||||
:email => 'ceilometer@localhost',
|
:configure_user_role => true,
|
||||||
:auth_name => 'ceilometer',
|
:configure_endpoint => false,
|
||||||
:region => 'RegionOne',
|
:configure_service => false,
|
||||||
:tenant => 'services',
|
:region => 'RegionOne',
|
||||||
}
|
:auth_name => 'ceilometer',
|
||||||
end
|
:password => 'ceilometer_password',
|
||||||
|
:email => 'ceilometer@localhost',
|
||||||
shared_examples_for 'ceilometer keystone auth' do
|
:tenant => 'services',
|
||||||
|
) }
|
||||||
context 'without the required password parameter' do
|
|
||||||
it { expect { is_expected.to raise_error(Puppet::Error) } }
|
|
||||||
end
|
end
|
||||||
|
|
||||||
let :params do
|
context 'when overriding parameters' do
|
||||||
{ :password => 'ceil0met3r-passZord' }
|
let :params do
|
||||||
|
{ :password => 'ceilometer_password',
|
||||||
|
:auth_name => 'alt_ceilometer',
|
||||||
|
:email => 'alt_ceilometer@alt_localhost',
|
||||||
|
:tenant => 'alt_service',
|
||||||
|
:configure_user => false,
|
||||||
|
:configure_user_role => false,
|
||||||
|
:region => 'RegionTwo' }
|
||||||
|
end
|
||||||
|
|
||||||
|
it { is_expected.to contain_keystone__resource__service_identity('ceilometer').with(
|
||||||
|
:configure_user => false,
|
||||||
|
:configure_user_role => false,
|
||||||
|
:configure_endpoint => false,
|
||||||
|
:configure_service => false,
|
||||||
|
:region => 'RegionTwo',
|
||||||
|
:auth_name => 'alt_ceilometer',
|
||||||
|
:password => 'ceilometer_password',
|
||||||
|
:email => 'alt_ceilometer@alt_localhost',
|
||||||
|
:tenant => 'alt_service',
|
||||||
|
) }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with the required parameters' do
|
|
||||||
it 'configures ceilometer user' do
|
|
||||||
is_expected.to contain_keystone_user( default_params[:auth_name] ).with(
|
|
||||||
:ensure => 'present',
|
|
||||||
:password => params[:password],
|
|
||||||
:email => default_params[:email],
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'configures ceilometer user roles' do
|
|
||||||
is_expected.to contain_keystone_user_role("#{default_params[:auth_name]}@#{default_params[:tenant]}").with(
|
|
||||||
:ensure => 'present',
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'with overridden parameters' do
|
|
||||||
before do
|
|
||||||
params.merge!({
|
|
||||||
:email => 'mighty-ceilometer@remotehost',
|
|
||||||
:auth_name => 'mighty-ceilometer',
|
|
||||||
:region => 'RegionFortyTwo',
|
|
||||||
:tenant => 'mighty-services',
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'configures ceilometer user' do
|
|
||||||
is_expected.to contain_keystone_user( params[:auth_name] ).with(
|
|
||||||
:ensure => 'present',
|
|
||||||
:password => params[:password],
|
|
||||||
:email => params[:email],
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'configures ceilometer user roles' do
|
|
||||||
is_expected.to contain_keystone_user_role("#{params[:auth_name]}@#{params[:tenant]}").with(
|
|
||||||
:ensure => 'present',
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when disabling user configuration' do
|
|
||||||
before do
|
|
||||||
params.merge!( :configure_user => false )
|
|
||||||
end
|
|
||||||
|
|
||||||
it { is_expected.to_not contain_keystone_user('ceilometer') }
|
|
||||||
it { is_expected.to contain_keystone_user_role('ceilometer@services') }
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when disabling user and role configuration' do
|
|
||||||
before do
|
|
||||||
params.merge!(
|
|
||||||
:configure_user => false,
|
|
||||||
:configure_user_role => false
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
it { is_expected.to_not contain_keystone_user('ceilometer') }
|
|
||||||
it { is_expected.to_not contain_keystone_user_role('ceilometer@services') }
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
on_supported_os({
|
on_supported_os({
|
||||||
:supported_os => OSDefaults.get_supported_os
|
:supported_os => OSDefaults.get_supported_os
|
||||||
}).each do |os,facts|
|
}).each do |os,facts|
|
||||||
context "on #{os}" do
|
context "on #{os}" do
|
||||||
let (:facts) do
|
let (:facts) do
|
||||||
facts.merge(OSDefaults.get_facts())
|
facts.merge!(OSDefaults.get_facts())
|
||||||
end
|
end
|
||||||
|
|
||||||
it_behaves_like 'ceilometer keystone auth'
|
it_behaves_like 'ceilometer::keystone::auth'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user