Debian Codegraph @

spec/classes/cloudkitty_keystone_auth_spec.rb

raw
1 #
2 # Unit tests for cloudkitty::keystone::auth
3 #
4
5 require 'spec_helper'
6
7 describe 'cloudkitty::keystone::auth' do
8 shared_examples_for 'cloudkitty::keystone::auth' do
9 context 'with default class parameters' do
10 let :params do
11 { :password => 'cloudkitty_password' }
12 end
13
14 it { is_expected.to contain_keystone__resource__service_identity('cloudkitty').with(
15 :configure_user => true,
16 :configure_user_role => true,
17 :configure_endpoint => true,
18 :configure_service => true,
19 :service_name => 'cloudkitty',
20 :service_type => 'rating',
21 :service_description => 'OpenStack Rating Service',
22 :region => 'RegionOne',
23 :auth_name => 'cloudkitty',
24 :password => 'cloudkitty_password',
25 :email => 'cloudkitty@localhost',
26 :tenant => 'services',
27 :roles => ['admin'],
28 :system_scope => 'all',
29 :system_roles => [],
30 :public_url => 'http://127.0.0.1:8889',
31 :internal_url => 'http://127.0.0.1:8889',
32 :admin_url => 'http://127.0.0.1:8889',
33 ) }
34
35 it { is_expected.to contain_keystone_role('rating').with_ensure('present') }
36 end
37
38 context 'when overriding parameters' do
39 let :params do
40 { :password => 'cloudkitty_password',
41 :auth_name => 'alt_cloudkitty',
42 :email => 'alt_cloudkitty@alt_localhost',
43 :tenant => 'alt_service',
44 :roles => ['admin', 'service'],
45 :system_scope => 'alt_all',
46 :system_roles => ['admin', 'member', 'reader'],
47 :configure_endpoint => false,
48 :configure_user => false,
49 :configure_user_role => false,
50 :configure_service => false,
51 :service_description => 'Alternative OpenStack Rating Service',
52 :service_name => 'alt_service',
53 :service_type => 'alt_rating',
54 :region => 'RegionTwo',
55 :public_url => 'https://10.10.10.10:80',
56 :internal_url => 'http://10.10.10.11:81',
57 :admin_url => 'http://10.10.10.12:81',
58 :rating_role => 'alt_rating' }
59 end
60
61 it { is_expected.to contain_keystone__resource__service_identity('cloudkitty').with(
62 :configure_user => false,
63 :configure_user_role => false,
64 :configure_endpoint => false,
65 :configure_service => false,
66 :service_name => 'alt_service',
67 :service_type => 'alt_rating',
68 :service_description => 'Alternative OpenStack Rating Service',
69 :region => 'RegionTwo',
70 :auth_name => 'alt_cloudkitty',
71 :password => 'cloudkitty_password',
72 :email => 'alt_cloudkitty@alt_localhost',
73 :tenant => 'alt_service',
74 :roles => ['admin', 'service'],
75 :system_scope => 'alt_all',
76 :system_roles => ['admin', 'member', 'reader'],
77 :public_url => 'https://10.10.10.10:80',
78 :internal_url => 'http://10.10.10.11:81',
79 :admin_url => 'http://10.10.10.12:81',
80 ) }
81 it { is_expected.to contain_keystone_role('alt_rating').with_ensure('present') }
82 end
83
84 context 'when disabling rating role management' do
85 let :params do
86 { :password => 'cloudkitty_password',
87 :manage_rating_role => false }
88 end
89
90 it { is_expected.to_not contain_keystone_role('rating') }
91 end
92 end
93
94 on_supported_os({
95 :supported_os => OSDefaults.get_supported_os
96 }).each do |os,facts|
97 context "on #{os}" do
98 let (:facts) do
99 facts.merge!(OSDefaults.get_facts())
100 end
101
102 it_behaves_like 'cloudkitty::keystone::auth'
103 end
104 end
105 end