Merge "Do not test detail of keystone::resource::service_identity"

This commit is contained in:
Zuul 2021-10-02 11:40:02 +00:00 committed by Gerrit Code Review
commit efdaf91e88
2 changed files with 98 additions and 212 deletions

View File

@ -5,140 +5,78 @@
require 'spec_helper'
describe 'zaqar::keystone::auth' do
shared_examples_for 'zaqar::keystone::auth' do
describe 'with default class parameters' do
context 'with default class parameters' do
let :params do
{ :password => 'zaqar_password',
:tenant => 'foobar' }
{ :password => 'zaqar_password' }
end
it { is_expected.to contain_keystone_user('zaqar').with(
:ensure => 'present',
:password => 'zaqar_password',
) }
it { is_expected.to contain_keystone_user_role('zaqar@foobar').with(
:ensure => 'present',
:roles => ['admin']
)}
it { is_expected.to contain_keystone_service('zaqar::messaging').with(
:ensure => 'present',
:description => 'Openstack messaging Service'
) }
it { is_expected.to contain_keystone_endpoint('RegionOne/zaqar::messaging').with(
:ensure => 'present',
:public_url => "http://127.0.0.1:8888",
:admin_url => "http://127.0.0.1:8888",
:internal_url => "http://127.0.0.1:8888"
it { is_expected.to contain_keystone__resource__service_identity('zaqar').with(
:configure_user => true,
:configure_user_role => true,
:configure_endpoint => true,
:service_name => 'zaqar',
:service_type => 'messaging',
:service_description => 'Openstack messaging Service',
:region => 'RegionOne',
:auth_name => 'zaqar',
:password => 'zaqar_password',
:email => 'zaqar@localhost',
:tenant => 'services',
:public_url => 'http://127.0.0.1:8888',
:internal_url => 'http://127.0.0.1:8888',
:admin_url => 'http://127.0.0.1:8888',
) }
end
describe 'when overriding public_url, internal_url and admin_url' do
context 'when overriding parameters' do
let :params do
{ :password => 'zaqar_password',
:public_url => 'https://10.10.10.10:8080',
:admin_url => 'http://10.10.10.10:8080',
:internal_url => 'http://10.10.10.10:8080'
}
end
it { is_expected.to contain_keystone_endpoint('RegionOne/zaqar::messaging').with(
:ensure => 'present',
:public_url => "https://10.10.10.10:8080",
:internal_url => "http://10.10.10.10:8080",
:admin_url => "http://10.10.10.10:8080"
) }
end
describe 'when overriding auth name' do
let :params do
{ :password => 'foo',
:auth_name => 'zaqary' }
end
it { is_expected.to contain_keystone_user('zaqary') }
it { is_expected.to contain_keystone_user_role('zaqary@services') }
it { is_expected.to contain_keystone_service('zaqar::messaging') }
it { is_expected.to contain_keystone_endpoint('RegionOne/zaqar::messaging') }
end
describe 'when overriding service name' do
let :params do
{ :service_name => 'zaqar_service',
:auth_name => 'zaqar',
:password => 'zaqar_password' }
end
it { is_expected.to contain_keystone_user('zaqar') }
it { is_expected.to contain_keystone_user_role('zaqar@services') }
it { is_expected.to contain_keystone_service('zaqar_service::messaging') }
it { is_expected.to contain_keystone_endpoint('RegionOne/zaqar_service::messaging') }
end
describe 'when disabling user configuration' do
let :params do
{
:password => 'zaqar_password',
:configure_user => false
}
end
it { is_expected.not_to contain_keystone_user('zaqar') }
it { is_expected.to contain_keystone_user_role('zaqar@services') }
it { is_expected.to contain_keystone_service('zaqar::messaging').with(
:ensure => 'present',
:description => 'Openstack messaging Service'
) }
end
describe 'when disabling user and user role configuration' do
let :params do
{
:password => 'zaqar_password',
{ :password => 'zaqar_password',
:auth_name => 'alt_zaqar',
:email => 'alt_zaqar@alt_localhost',
:tenant => 'alt_service',
:configure_endpoint => false,
:configure_user => false,
:configure_user_role => false
}
:configure_user_role => false,
:service_description => 'Alternative Openstack messaging Service',
:service_name => 'alt_service',
:service_type => 'alt_messaging',
: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',
:roles => ['admin', 'ResellerAdmin'] }
end
it { is_expected.not_to contain_keystone_user('zaqar') }
it { is_expected.not_to contain_keystone_user_role('zaqar@services') }
it { is_expected.to contain_keystone_service('zaqar::messaging').with(
:ensure => 'present',
:description => 'Openstack messaging Service'
it { is_expected.to contain_keystone__resource__service_identity('zaqar').with(
:configure_user => false,
:configure_user_role => false,
:configure_endpoint => false,
:service_name => 'alt_service',
:service_type => 'alt_messaging',
:service_description => 'Alternative Openstack messaging Service',
:region => 'RegionTwo',
:auth_name => 'alt_zaqar',
:password => 'zaqar_password',
:email => 'alt_zaqar@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',
:roles => ['admin', 'ResellerAdmin'],
) }
end
describe 'when setting roles' do
let :params do
{ :password => 'zaqar_password',
:roles => ['admin', 'ResellerAdmin'] }
end
it { is_expected.to contain_keystone_user_role('zaqar@services').with(
:ensure => 'present',
:roles => ['admin', 'ResellerAdmin']
)}
end
end
on_supported_os({
:supported_os => OSDefaults.get_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 'zaqar::keystone::auth'
it_behaves_like 'zaqar::keystone::auth'
end
end
end

View File

@ -5,128 +5,76 @@
require 'spec_helper'
describe 'zaqar::keystone::auth_websocket' do
shared_examples_for 'zaqar::keystone::auth_websocket' do
describe 'with default class parameters' do
context 'with default class parameters' do
let :params do
{ :password => 'zaqar_password',
:tenant => 'foobar' }
{ :password => 'zaqar-websocket_password' }
end
it { is_expected.to contain_keystone_user('zaqar-websocket').with(
:ensure => 'present',
:password => 'zaqar_password',
) }
it { is_expected.to contain_keystone_user_role('zaqar-websocket@foobar').with(
:ensure => 'present',
:roles => ['admin']
)}
it { is_expected.to contain_keystone_service('zaqar-websocket::messaging-websocket').with(
:ensure => 'present',
:description => 'Openstack messaging websocket Service'
) }
it { is_expected.to contain_keystone_endpoint('RegionOne/zaqar-websocket::messaging-websocket').with(
:ensure => 'present',
:public_url => "ws://127.0.0.1:9000",
:admin_url => "ws://127.0.0.1:9000",
:internal_url => "ws://127.0.0.1:9000"
it { is_expected.to contain_keystone__resource__service_identity('zaqar-websocket').with(
:configure_user => true,
:configure_user_role => true,
:configure_endpoint => true,
:service_name => 'zaqar-websocket',
:service_type => 'messaging-websocket',
:service_description => 'Openstack messaging websocket Service',
:region => 'RegionOne',
:auth_name => 'zaqar-websocket',
:password => 'zaqar-websocket_password',
:email => 'zaqar-websocket@localhost',
:tenant => 'services',
:public_url => 'ws://127.0.0.1:9000',
:internal_url => 'ws://127.0.0.1:9000',
:admin_url => 'ws://127.0.0.1:9000',
) }
end
describe 'when overriding public_url, internal_url and admin_url' do
context 'when overriding parameters' do
let :params do
{ :password => 'zaqar_password',
:public_url => 'ws://10.10.10.10:9000',
:admin_url => 'ws://10.10.10.10:9000',
:internal_url => 'ws://10.10.10.10:9000'
}
end
it { is_expected.to contain_keystone_endpoint('RegionOne/zaqar-websocket::messaging-websocket').with(
:ensure => 'present',
:public_url => "ws://10.10.10.10:9000",
:internal_url => "ws://10.10.10.10:9000",
:admin_url => "ws://10.10.10.10:9000"
) }
end
describe 'when overriding auth name' do
let :params do
{ :password => 'foo',
:auth_name => 'zaqary' }
end
it { is_expected.to contain_keystone_user('zaqary') }
it { is_expected.to contain_keystone_user_role('zaqary@services') }
it { is_expected.to contain_keystone_service('zaqar-websocket::messaging-websocket') }
it { is_expected.to contain_keystone_endpoint('RegionOne/zaqar-websocket::messaging-websocket') }
end
describe 'when overriding service name' do
let :params do
{ :service_name => 'zaqar_service',
:auth_name => 'zaqar-websocket',
:password => 'zaqar_password' }
end
it { is_expected.to contain_keystone_user('zaqar-websocket') }
it { is_expected.to contain_keystone_user_role('zaqar-websocket@services') }
it { is_expected.to contain_keystone_service('zaqar_service::messaging-websocket') }
it { is_expected.to contain_keystone_endpoint('RegionOne/zaqar_service::messaging-websocket') }
end
describe 'when disabling user configuration' do
let :params do
{
:password => 'zaqar_password',
:configure_user => false
}
end
it { is_expected.not_to contain_keystone_user('zaqar-websocket') }
it { is_expected.to contain_keystone_user_role('zaqar-websocket@services') }
it { is_expected.to contain_keystone_service('zaqar-websocket::messaging-websocket').with(
:ensure => 'present',
:description => 'Openstack messaging websocket Service'
) }
end
describe 'when disabling user and user role configuration' do
let :params do
{
:password => 'zaqar_password',
{ :password => 'zaqar-websocket_password',
:auth_name => 'alt_zaqar-websocket',
:email => 'alt_zaqar-websocket@alt_localhost',
:tenant => 'alt_service',
:configure_endpoint => false,
:configure_user => false,
:configure_user_role => false
}
:configure_user_role => false,
:service_description => 'Alternative Openstack messaging websocket Service',
:service_name => 'alt_service',
:service_type => 'alt_messaging-websocket',
:region => 'RegionTwo',
:public_url => 'wss://10.10.10.10:80',
:internal_url => 'ws://10.10.10.11:81',
:admin_url => 'ws://10.10.10.12:81' }
end
it { is_expected.not_to contain_keystone_user('zaqar-websocket') }
it { is_expected.not_to contain_keystone_user_role('zaqar-websocket@services') }
it { is_expected.to contain_keystone_service('zaqar-websocket::messaging-websocket').with(
:ensure => 'present',
:description => 'Openstack messaging websocket Service'
it { is_expected.to contain_keystone__resource__service_identity('zaqar-websocket').with(
:configure_user => false,
:configure_user_role => false,
:configure_endpoint => false,
:service_name => 'alt_service',
:service_type => 'alt_messaging-websocket',
:service_description => 'Alternative Openstack messaging websocket Service',
:region => 'RegionTwo',
:auth_name => 'alt_zaqar-websocket',
:password => 'zaqar-websocket_password',
:email => 'alt_zaqar-websocket@alt_localhost',
:tenant => 'alt_service',
:public_url => 'wss://10.10.10.10:80',
:internal_url => 'ws://10.10.10.11:81',
:admin_url => 'ws://10.10.10.12:81',
) }
end
end
on_supported_os({
:supported_os => OSDefaults.get_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 'zaqar::keystone::auth_websocket'
it_behaves_like 'zaqar::keystone::auth_websocket'
end
end
end