Files
puppet-mistral/spec/classes/mistral_keystone_auth_spec.rb
Limor Stotland 3b0bc55c5b puppet-mistral: initial commit
Change-Id: I07c22568ca6c6d1155626fff7cf1d3ca3c6fd5c5
Implements: blueprint add-puppet-mistral
2015-08-09 10:00:45 +00:00

109 lines
3.0 KiB
Ruby

#
# Unit tests for mistral::keystone::auth
#
require 'spec_helper'
describe 'mistral::keystone::auth' do
let :facts do
{ :osfamily => 'Debian' }
end
describe 'with default class parameters' do
let :params do
{ :password => 'mistral_password',
:tenant => 'services' }
end
it { is_expected.to contain_keystone_user('mistral').with(
:ensure => 'present',
:password => 'mistral_password',
:tenant => 'services'
) }
it { is_expected.to contain_keystone_user_role('mistral@services').with(
:ensure => 'present',
:roles => ['admin']
)}
it { is_expected.to contain_keystone_service('mistral').with(
:ensure => 'present',
:type => 'workflow',
:description => 'Openstack workflow Service'
) }
it { is_expected.to contain_keystone_endpoint('RegionOne/mistral').with(
:ensure => 'present',
:public_url => "http://127.0.0.1:8989/v2",
:admin_url => "http://127.0.0.1:8989/v2",
:internal_url => "http://127.0.0.1:8989/v2"
) }
end
describe 'when overriding auth name' do
let :params do
{ :password => 'foo',
:auth_name => 'mistraly' }
end
it { is_expected.to contain_keystone_user('mistraly') }
it { is_expected.to contain_keystone_user_role('mistraly@services') }
it { is_expected.to contain_keystone_service('mistraly') }
it { is_expected.to contain_keystone_endpoint('RegionOne/mistraly') }
end
describe 'when overriding service name' do
let :params do
{ :service_name => 'mistral_service',
:auth_name => 'mistral',
:password => 'mistral_password' }
end
it { is_expected.to contain_keystone_user('mistral') }
it { is_expected.to contain_keystone_user_role('mistral@services') }
it { is_expected.to contain_keystone_service('mistral_service') }
it { is_expected.to contain_keystone_endpoint('RegionOne/mistral_service') }
end
describe 'when disabling user configuration' do
let :params do
{
:password => 'mistral_password',
:configure_user => false
}
end
it { is_expected.not_to contain_keystone_user('mistral') }
it { is_expected.to contain_keystone_user_role('mistral@services') }
it { is_expected.to contain_keystone_service('mistral').with(
:ensure => 'present',
:type => 'workflow',
:description => 'Openstack workflow Service'
) }
end
describe 'when disabling user and user role configuration' do
let :params do
{
:password => 'mistral_password',
:configure_user => false,
:configure_user_role => false
}
end
it { is_expected.not_to contain_keystone_user('mistral') }
it { is_expected.not_to contain_keystone_user_role('mistral@services') }
it { is_expected.to contain_keystone_service('mistral').with(
:ensure => 'present',
:type => 'workflow',
:description => 'Openstack workflow Service'
) }
end
end