try again, with puppetforge modules, correctly included now
[mirror/dsa-puppet.git] / 3rdparty / modules / cinder / spec / classes / cinder_keystone_auth_spec.rb
1 require 'spec_helper'
2
3 describe 'cinder::keystone::auth' do
4
5   let :req_params do
6     {:password => 'pw'}
7   end
8
9   describe 'with only required params' do
10
11     let :params do
12       req_params
13     end
14
15     it 'should contain auth info' do
16
17       should contain_keystone_user('cinder').with(
18         :ensure   => 'present',
19         :password => 'pw',
20         :email    => 'cinder@localhost',
21         :tenant   => 'services'
22       )
23       should contain_keystone_user_role('cinder@services').with(
24         :ensure  => 'present',
25         :roles   => 'admin'
26       )
27       should contain_keystone_service('cinder').with(
28         :ensure      => 'present',
29         :type        => 'volume',
30         :description => 'Cinder Service'
31       )
32       should contain_keystone_service('cinderv2').with(
33         :ensure      => 'present',
34         :type        => 'volumev2',
35         :description => 'Cinder Service v2'
36       )
37
38     end
39     it { should contain_keystone_endpoint('RegionOne/cinder').with(
40       :ensure       => 'present',
41       :public_url   => 'http://127.0.0.1:8776/v1/%(tenant_id)s',
42       :admin_url    => 'http://127.0.0.1:8776/v1/%(tenant_id)s',
43       :internal_url => 'http://127.0.0.1:8776/v1/%(tenant_id)s'
44     ) }
45     it { should contain_keystone_endpoint('RegionOne/cinderv2').with(
46       :ensure       => 'present',
47       :public_url   => 'http://127.0.0.1:8776/v2/%(tenant_id)s',
48       :admin_url    => 'http://127.0.0.1:8776/v2/%(tenant_id)s',
49       :internal_url => 'http://127.0.0.1:8776/v2/%(tenant_id)s'
50     ) }
51
52   end
53
54   context 'when overriding endpoint params' do
55      let :params do
56        req_params.merge(
57         :public_address    => '10.0.42.1',
58         :admin_address     => '10.0.42.2',
59         :internal_address  => '10.0.42.3',
60         :region            => 'RegionThree',
61         :port              => '4242',
62         :admin_protocol    => 'https',
63         :internal_protocol => 'https',
64         :public_protocol   => 'https',
65         :volume_version    => 'v42'
66       )
67      end
68
69     it { should contain_keystone_endpoint('RegionThree/cinder').with(
70       :ensure       => 'present',
71       :public_url   => 'https://10.0.42.1:4242/v42/%(tenant_id)s',
72       :admin_url    => 'https://10.0.42.2:4242/v42/%(tenant_id)s',
73       :internal_url => 'https://10.0.42.3:4242/v42/%(tenant_id)s'
74     )}
75
76     it { should contain_keystone_endpoint('RegionThree/cinderv2').with(
77       :ensure       => 'present',
78       :public_url   => 'https://10.0.42.1:4242/v2/%(tenant_id)s',
79       :admin_url    => 'https://10.0.42.2:4242/v2/%(tenant_id)s',
80       :internal_url => 'https://10.0.42.3:4242/v2/%(tenant_id)s'
81     )}
82   end
83
84
85   describe 'when endpoint should not be configured' do
86     let :params do
87       req_params.merge(
88         :configure_endpoint    => false,
89         :configure_endpoint_v2 => false
90       )
91     end
92     it { should_not contain_keystone_endpoint('RegionOne/cinder') }
93     it { should_not contain_keystone_endpoint('RegionOne/cinderv2') }
94   end
95
96   describe 'when user should not be configured' do
97     let :params do
98       req_params.merge(
99         :configure_user => false
100       )
101     end
102
103     it { should_not contain_keystone_user('cinder') }
104
105     it { should contain_keystone_user_role('cinder@services') }
106
107     it { should contain_keystone_service('cinder').with(
108         :ensure      => 'present',
109         :type        => 'volume',
110         :description => 'Cinder Service'
111     ) }
112
113   end
114
115   describe 'when user and user role should not be configured' do
116     let :params do
117       req_params.merge(
118         :configure_user      => false,
119         :configure_user_role => false
120       )
121     end
122
123     it { should_not contain_keystone_user('cinder') }
124
125     it { should_not contain_keystone_user_role('cinder@services') }
126
127     it { should contain_keystone_service('cinder').with(
128         :ensure      => 'present',
129         :type        => 'volume',
130         :description => 'Cinder Service'
131     ) }
132
133   end
134
135 end