puppet-sahara/spec/classes/sahara_keystone_auth_spec.rb
Emilien Macchi a8dc766476 unit tests: make Keystone_endpoint match service by name/type
Since a chance in puppet-keystone (1], we now match an endpoint with a
service name/type.
)
[1] http://git.openstack.org/cgit/openstack/puppet-keystone/commit/?id=0a4e06abb0f5b3f324464ff5219d2885816311ce

Closes-Bug: #1528308

Change-Id: Ie86edd5807b8aa50a03d34145fefa09c193c34d3
2015-12-22 18:11:57 +01:00

80 lines
2.4 KiB
Ruby

#
# Unit tests for sahara::keystone::auth
#
require 'spec_helper'
describe 'sahara::keystone::auth' do
let :facts do
{ :osfamily => 'Debian' }
end
describe 'with default class parameters' do
let :params do
{ :password => 'sahara_password',
:tenant => 'foobar' }
end
it { is_expected.to contain_keystone_user('sahara').with(
:ensure => 'present',
:password => 'sahara_password',
) }
it { is_expected.to contain_keystone_user_role('sahara@foobar').with(
:ensure => 'present',
:roles => ['admin']
)}
it { is_expected.to contain_keystone_service('sahara::data-processing').with(
:ensure => 'present',
:description => 'Sahara Data Processing'
) }
it { is_expected.to contain_keystone_endpoint('RegionOne/sahara::data-processing').with(
:ensure => 'present',
:public_url => "http://127.0.0.1:8386/v1.1/%(tenant_id)s",
:admin_url => "http://127.0.0.1:8386/v1.1/%(tenant_id)s",
:internal_url => "http://127.0.0.1:8386/v1.1/%(tenant_id)s"
) }
end
describe 'when configuring sahara-server' do
let :pre_condition do
"class { 'sahara::server': auth_password => 'test' }"
end
let :params do
{ :password => 'sahara_password',
:tenant => 'foobar' }
end
end
describe 'with endpoint parameters' do
let :params do
{ :password => 'sahara_password',
:public_url => 'https://10.10.10.10:80/v1.1/%(tenant_id)s',
:internal_url => 'http://10.10.10.11:81/v1.1/%(tenant_id)s',
:admin_url => 'http://10.10.10.12:81/v1.1/%(tenant_id)s' }
end
it { is_expected.to contain_keystone_endpoint('RegionOne/sahara::data-processing').with(
:ensure => 'present',
:public_url => 'https://10.10.10.10:80/v1.1/%(tenant_id)s',
:internal_url => 'http://10.10.10.11:81/v1.1/%(tenant_id)s',
:admin_url => 'http://10.10.10.12:81/v1.1/%(tenant_id)s'
) }
end
describe 'when overriding auth name' do
let :params do
{ :password => 'foo',
:auth_name => 'saharay' }
end
it { is_expected.to contain_keystone_user('saharay') }
it { is_expected.to contain_keystone_user_role('saharay@services') }
it { is_expected.to contain_keystone_service('saharay::data-processing') }
it { is_expected.to contain_keystone_endpoint('RegionOne/saharay::data-processing') }
end
end