]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/neutron/spec/classes/neutron_keystone_auth_spec.rb
db2ed2bea81f73df530add16db1a631535681788
[dsa-puppet.git] / 3rdparty / modules / neutron / spec / classes / neutron_keystone_auth_spec.rb
1 require 'spec_helper'
2
3 describe 'neutron::keystone::auth' do
4
5   describe 'with default class parameters' do
6     let :params do
7       {
8         :password => 'neutron_password',
9         :tenant   => 'foobar'
10       }
11     end
12
13     it { should contain_keystone_user('neutron').with(
14       :ensure   => 'present',
15       :password => 'neutron_password',
16       :tenant   => 'foobar'
17     ) }
18
19     it { should contain_keystone_user_role('neutron@foobar').with(
20       :ensure  => 'present',
21       :roles   => 'admin'
22     )}
23
24     it { should contain_keystone_service('neutron').with(
25       :ensure      => 'present',
26       :type        => 'network',
27       :description => 'Neutron Networking Service'
28     ) }
29
30     it { should contain_keystone_endpoint('RegionOne/neutron').with(
31       :ensure       => 'present',
32       :public_url   => "http://127.0.0.1:9696/",
33       :admin_url    => "http://127.0.0.1:9696/",
34       :internal_url => "http://127.0.0.1:9696/"
35     ) }
36
37   end
38
39   describe 'when configuring neutron-server' do
40     let :pre_condition do
41       "class { 'neutron::server': auth_password => 'test' }"
42     end
43
44     let :facts do
45       { :osfamily => 'Debian' }
46     end
47
48     let :params do
49       {
50         :password => 'neutron_password',
51         :tenant   => 'foobar'
52       }
53     end
54
55     it { should contain_keystone_endpoint('RegionOne/neutron').with_notify('Service[neutron-server]') }
56   end
57
58   describe 'when overriding public_protocol, public_port and public address' do
59
60     let :params do
61       {
62         :password         => 'neutron_password',
63         :public_protocol  => 'https',
64         :public_port      => '80',
65         :public_address   => '10.10.10.10',
66         :port             => '81',
67         :internal_address => '10.10.10.11',
68         :admin_address    => '10.10.10.12'
69       }
70     end
71
72     it { should contain_keystone_endpoint('RegionOne/neutron').with(
73       :ensure       => 'present',
74       :public_url   => "https://10.10.10.10:80/",
75       :internal_url => "http://10.10.10.11:81/",
76       :admin_url    => "http://10.10.10.12:81/"
77     ) }
78
79   end
80
81   describe 'when overriding admin_protocol and internal_protocol' do
82
83     let :params do
84       {
85         :password          => 'neutron_password',
86         :admin_protocol    => 'https',
87         :internal_protocol => 'https',
88       }
89     end
90
91     it { should contain_keystone_endpoint('RegionOne/neutron').with(
92       :ensure       => 'present',
93       :public_url   => "http://127.0.0.1:9696/",
94       :admin_url    => "https://127.0.0.1:9696/",
95       :internal_url => "https://127.0.0.1:9696/"
96     ) }
97
98   end
99
100   describe 'when overriding auth name' do
101
102     let :params do
103       {
104         :password => 'foo',
105         :auth_name => 'neutrony'
106       }
107     end
108
109     it { should contain_keystone_user('neutrony') }
110
111     it { should contain_keystone_user_role('neutrony@services') }
112
113     it { should contain_keystone_service('neutrony') }
114
115     it { should contain_keystone_endpoint('RegionOne/neutrony') }
116
117   end
118
119   describe 'when overriding service name' do
120
121     let :params do
122       {
123         :service_name => 'neutron_service',
124         :password     => 'neutron_password'
125       }
126     end
127
128     it { should contain_keystone_user('neutron') }
129     it { should contain_keystone_user_role('neutron@services') }
130     it { should contain_keystone_service('neutron_service') }
131     it { should contain_keystone_endpoint('RegionOne/neutron_service') }
132
133   end
134
135   describe 'when disabling user configuration' do
136
137     let :params do
138       {
139         :password       => 'neutron_password',
140         :configure_user => false
141       }
142     end
143
144     it { should_not contain_keystone_user('neutron') }
145
146     it { should contain_keystone_user_role('neutron@services') }
147
148     it { should contain_keystone_service('neutron').with(
149       :ensure      => 'present',
150       :type        => 'network',
151       :description => 'Neutron Networking Service'
152     ) }
153
154   end
155
156   describe 'when disabling user and user role configuration' do
157
158     let :params do
159       {
160         :password            => 'neutron_password',
161         :configure_user      => false,
162         :configure_user_role => false
163       }
164     end
165
166     it { should_not contain_keystone_user('neutron') }
167
168     it { should_not contain_keystone_user_role('neutron@services') }
169
170     it { should contain_keystone_service('neutron').with(
171       :ensure      => 'present',
172       :type        => 'network',
173       :description => 'Neutron Networking Service'
174     ) }
175
176   end
177
178 end