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: I3c539f688e2c266b3b68050cf24a3136ba0c4faf
This commit is contained in:
Takashi Kajinami 2022-01-24 14:57:54 +09:00
parent b54c607b19
commit 80b1cf84ea
1 changed files with 47 additions and 95 deletions

View File

@ -5,112 +5,64 @@
require 'spec_helper'
describe 'tacker::keystone::auth' do
shared_examples_for 'tacker-keystone-auth' do
shared_examples_for 'tacker::keystone::auth' do
context 'with default class parameters' do
let :params do
{ :password => 'tacker_password',
:tenant => 'foobar' }
{ :password => 'tacker_password' }
end
it { is_expected.to contain_keystone_user('tacker').with(
:ensure => 'present',
:password => 'tacker_password',
) }
it { is_expected.to contain_keystone_user_role('tacker@foobar').with(
:ensure => 'present',
:roles => ['admin']
)}
it { is_expected.to contain_keystone_service('tacker::nfv-orchestration').with(
:ensure => 'present',
:description => 'tacker NFV orchestration Service'
) }
it { is_expected.to contain_keystone_endpoint('RegionOne/tacker::nfv-orchestration').with(
:ensure => 'present',
:public_url => 'http://127.0.0.1:9890',
:admin_url => 'http://127.0.0.1:9890',
:internal_url => 'http://127.0.0.1:9890',
it { is_expected.to contain_keystone__resource__service_identity('tacker').with(
:configure_user => true,
:configure_user_role => true,
:configure_endpoint => true,
:service_name => 'tacker',
:service_type => 'nfv-orchestration',
:service_description => 'tacker NFV orchestration Service',
:region => 'RegionOne',
:auth_name => 'tacker',
:password => 'tacker_password',
:email => 'tacker@localhost',
:tenant => 'services',
:public_url => 'http://127.0.0.1:9890',
:internal_url => 'http://127.0.0.1:9890',
:admin_url => 'http://127.0.0.1:9890',
) }
end
context 'when overriding URL parameters' do
context 'when overriding parameters' do
let :params do
{ :password => 'tacker_password',
:public_url => 'https://10.10.10.10:80',
:internal_url => 'http://10.10.10.11:81',
:admin_url => 'http://10.10.10.12:81', }
end
it { is_expected.to contain_keystone_endpoint('RegionOne/tacker::nfv-orchestration').with(
:ensure => 'present',
:public_url => 'https://10.10.10.10:80',
:internal_url => 'http://10.10.10.11:81',
:admin_url => 'http://10.10.10.12:81',
) }
end
context 'when overriding auth name' do
let :params do
{ :password => 'foo',
:auth_name => 'tackery' }
end
it { is_expected.to contain_keystone_user('tackery') }
it { is_expected.to contain_keystone_user_role('tackery@services') }
it { is_expected.to contain_keystone_service('tacker::nfv-orchestration') }
it { is_expected.to contain_keystone_endpoint('RegionOne/tacker::nfv-orchestration') }
end
context 'when overriding service name' do
let :params do
{ :service_name => 'tacker_service',
:auth_name => 'tacker',
:password => 'tacker_password' }
end
it { is_expected.to contain_keystone_user('tacker') }
it { is_expected.to contain_keystone_user_role('tacker@services') }
it { is_expected.to contain_keystone_service('tacker_service::nfv-orchestration') }
it { is_expected.to contain_keystone_endpoint('RegionOne/tacker_service::nfv-orchestration') }
end
context 'when disabling user configuration' do
let :params do
{
:password => 'tacker_password',
:configure_user => false
}
end
it { is_expected.not_to contain_keystone_user('tacker') }
it { is_expected.to contain_keystone_user_role('tacker@services') }
it { is_expected.to contain_keystone_service('tacker::nfv-orchestration').with(
:ensure => 'present',
:description => 'tacker NFV orchestration Service'
) }
end
context 'when disabling user and user role configuration' do
let :params do
{
:password => 'tacker_password',
{ :password => 'tacker_password',
:auth_name => 'alt_tacker',
:email => 'alt_tacker@alt_localhost',
:tenant => 'alt_service',
:configure_endpoint => false,
:configure_user => false,
:configure_user_role => false
}
:configure_user_role => false,
:service_description => 'Alternative tacker NFV orchestration Service',
:service_name => 'alt_service',
:service_type => 'alt_nfv-orchestration',
:region => 'RegionTwo',
:public_url => 'https://10.10.10.10:80',
:internal_url => 'http://10.10.10.11:81',
:admin_url => 'http://10.10.10.12:81' }
end
it { is_expected.not_to contain_keystone_user('tacker') }
it { is_expected.not_to contain_keystone_user_role('tacker@services') }
it { is_expected.to contain_keystone_service('tacker::nfv-orchestration').with(
:ensure => 'present',
:description => 'tacker NFV orchestration Service'
it { is_expected.to contain_keystone__resource__service_identity('tacker').with(
:configure_user => false,
:configure_user_role => false,
:configure_endpoint => false,
:service_name => 'alt_service',
:service_type => 'alt_nfv-orchestration',
:service_description => 'Alternative tacker NFV orchestration Service',
:region => 'RegionTwo',
:auth_name => 'alt_tacker',
:password => 'tacker_password',
:email => 'alt_tacker@alt_localhost',
:tenant => 'alt_service',
:public_url => 'https://10.10.10.10:80',
:internal_url => 'http://10.10.10.11:81',
:admin_url => 'http://10.10.10.12:81',
) }
end
end
@ -122,7 +74,7 @@ describe 'tacker::keystone::auth' do
facts.merge!(OSDefaults.get_facts())
end
it_behaves_like 'tacker-keystone-auth'
it_behaves_like 'tacker::keystone::auth'
end
end
end