]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/nova/spec/classes/nova_keystone_endpoint_spec.rb
try again, with puppetforge modules, correctly included now
[dsa-puppet.git] / 3rdparty / modules / nova / spec / classes / nova_keystone_endpoint_spec.rb
1 require 'spec_helper'
2
3 describe 'nova::keystone::auth' do
4
5   let :params do
6     {:password => 'nova_password'}
7   end
8
9   context 'with default parameters' do
10
11     it { should contain_keystone_user('nova').with(
12       :ensure   => 'present',
13       :password => 'nova_password'
14     ) }
15
16     it { should contain_keystone_user_role('nova@services').with(
17       :ensure => 'present',
18       :roles  => 'admin'
19     )}
20
21     it { should contain_keystone_service('nova').with(
22       :ensure => 'present',
23       :type        => 'compute',
24       :description => 'Openstack Compute Service'
25     )}
26
27     it { should contain_keystone_service('novav3').with(
28       :ensure => 'present',
29       :type        => 'computev3',
30       :description => 'Openstack Compute Service v3'
31     )}
32
33     it { should contain_keystone_service('nova_ec2').with(
34       :ensure => 'present',
35       :type        => 'ec2',
36       :description => 'EC2 Service'
37     )}
38
39     it { should contain_keystone_endpoint('RegionOne/nova').with(
40       :ensure       => 'present',
41       :public_url   => 'http://127.0.0.1:8774/v2/%(tenant_id)s',
42       :admin_url    => 'http://127.0.0.1:8774/v2/%(tenant_id)s',
43       :internal_url => 'http://127.0.0.1:8774/v2/%(tenant_id)s'
44     )}
45
46     it { should contain_keystone_endpoint('RegionOne/novav3').with(
47       :ensure       => 'present',
48       :public_url   => 'http://127.0.0.1:8774/v3',
49       :admin_url    => 'http://127.0.0.1:8774/v3',
50       :internal_url => 'http://127.0.0.1:8774/v3'
51     )}
52
53     it { should contain_keystone_endpoint('RegionOne/nova_ec2').with(
54       :ensure       => 'present',
55       :public_url   => 'http://127.0.0.1:8773/services/Cloud',
56       :admin_url    => 'http://127.0.0.1:8773/services/Admin',
57       :internal_url => 'http://127.0.0.1:8773/services/Cloud'
58     )}
59
60   end
61
62   context 'when setting auth name' do
63     before do
64       params.merge!( :auth_name => 'foo' )
65     end
66
67     it { should contain_keystone_user('foo').with(
68       :ensure   => 'present',
69       :password => 'nova_password'
70     ) }
71
72     it { should contain_keystone_user_role('foo@services').with(
73       :ensure => 'present',
74       :roles  => 'admin'
75     )}
76
77     it { should contain_keystone_service('foo').with(
78       :ensure      => 'present',
79       :type        => 'compute',
80       :description => 'Openstack Compute Service'
81     )}
82
83     it { should contain_keystone_service('foo_ec2').with(
84       :ensure     => 'present',
85       :type        => 'ec2',
86       :description => 'EC2 Service'
87     )}
88
89   end
90
91   context 'when overriding endpoint params' do
92     before do
93       params.merge!(
94         :public_address    => '10.0.0.1',
95         :admin_address     => '10.0.0.2',
96         :internal_address  => '10.0.0.3',
97         :compute_port      => '9774',
98         :ec2_port          => '9773',
99         :compute_version   => 'v2.2',
100         :region            => 'RegionTwo',
101         :admin_protocol    => 'https',
102         :internal_protocol => 'https',
103         :public_protocol   => 'https'
104       )
105     end
106
107     it { should contain_keystone_endpoint('RegionTwo/nova').with(
108       :ensure       => 'present',
109       :public_url   => 'https://10.0.0.1:9774/v2.2/%(tenant_id)s',
110       :admin_url    => 'https://10.0.0.2:9774/v2.2/%(tenant_id)s',
111       :internal_url => 'https://10.0.0.3:9774/v2.2/%(tenant_id)s'
112     )}
113
114     it { should contain_keystone_endpoint('RegionTwo/nova_ec2').with(
115       :ensure       => 'present',
116       :public_url   => 'https://10.0.0.1:9773/services/Cloud',
117       :admin_url    => 'https://10.0.0.2:9773/services/Admin',
118       :internal_url => 'https://10.0.0.3:9773/services/Cloud'
119     )}
120
121   end
122
123   describe 'when disabling endpoint configuration' do
124     before do
125       params.merge!( :configure_endpoint => false )
126     end
127
128     it { should_not contain_keystone_endpoint('RegionOne/nova') }
129   end
130
131   describe 'when disabling EC2 endpoint' do
132     before do
133       params.merge!( :configure_ec2_endpoint => false )
134     end
135
136     it { should_not contain_keystone_service('nova_ec2') }
137     it { should_not contain_keystone_endpoint('RegionOne/nova_ec2') }
138   end
139
140   describe 'when disabling user configuration' do
141     before do
142       params.merge!( :configure_user => false )
143     end
144
145     it { should_not contain_keystone_user('nova') }
146
147     it { should contain_keystone_user_role('nova@services') }
148
149     it { should contain_keystone_service('nova').with(
150       :ensure => 'present',
151       :type        => 'compute',
152       :description => 'Openstack Compute Service'
153     )}
154   end
155
156   describe 'when disabling user and user role configuration' do
157     let :params do
158       {
159         :configure_user      => false,
160         :configure_user_role => false,
161         :password            => 'nova_password'
162       }
163     end
164
165     it { should_not contain_keystone_user('nova') }
166
167     it { should_not contain_keystone_user_role('nova@services') }
168
169     it { should contain_keystone_service('nova').with(
170       :ensure => 'present',
171       :type        => 'compute',
172       :description => 'Openstack Compute Service'
173     )}
174   end
175
176   describe 'when configuring nova-api and the keystone endpoint' do
177     let :pre_condition do
178       "class { 'nova::api': admin_password => 'test' }
179       include nova"
180     end
181
182     let :facts do
183       { :osfamily => "Debian"}
184     end
185
186     let :params do
187       {
188         :password => 'test'
189       }
190     end
191
192     it { should contain_keystone_endpoint('RegionOne/nova').with_notify('Service[nova-api]') }
193   end
194
195   describe 'when overriding service names' do
196
197     let :params do
198       {
199         :service_name    => 'nova_service',
200         :service_name_v3 => 'nova_service_v3',
201         :password        => 'nova_password'
202       }
203     end
204
205     it { should contain_keystone_user('nova') }
206     it { should contain_keystone_user_role('nova@services') }
207     it { should contain_keystone_service('nova_service') }
208     it { should contain_keystone_service('nova_service_v3') }
209     it { should contain_keystone_service('nova_service_ec2') }
210     it { should contain_keystone_endpoint('RegionOne/nova_service') }
211     it { should contain_keystone_endpoint('RegionOne/nova_service_v3') }
212     it { should contain_keystone_endpoint('RegionOne/nova_service_ec2') }
213
214   end
215
216 end