| 1 |
# |
| 2 |
# Copyright (C) 2014 Catalyst IT Limited. |
| 3 |
# |
| 4 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 |
# you may not use this file except in compliance with the License. |
| 6 |
# You may obtain a copy of the License at |
| 7 |
# |
| 8 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 |
# |
| 10 |
# Unless required by applicable law or agreed to in writing, software |
| 11 |
# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 |
# See the License for the specific language governing permissions and |
| 14 |
# limitations under the License. |
| 15 |
# |
| 16 |
# Author: Ricardo Rocha <[email protected]> |
| 17 |
# |
| 18 |
|
| 19 |
require 'spec_helper' |
| 20 |
|
| 21 |
describe 'ceph::rgw::keystone' do |
| 22 |
shared_examples 'ceph::rgw::keystone' do |
| 23 |
context 'create with default params' do |
| 24 |
let :pre_condition do |
| 25 |
"include ceph::params |
| 26 |
class { 'ceph': fsid => 'd5252e7d-75bc-4083-85ed-fe51fa83f62b' } |
| 27 |
class { 'ceph::repo': } |
| 28 |
include ceph |
| 29 |
ceph::rgw { 'radosgw.gateway': }" |
| 30 |
end |
| 31 |
|
| 32 |
let :title do |
| 33 |
'radosgw.gateway' |
| 34 |
end |
| 35 |
|
| 36 |
let :params do |
| 37 |
{ |
| 38 |
:rgw_keystone_admin_domain => 'default', |
| 39 |
:rgw_keystone_admin_project => 'openstack', |
| 40 |
:rgw_keystone_admin_user => 'rgwuser', |
| 41 |
:rgw_keystone_admin_password => '123456', |
| 42 |
} |
| 43 |
end |
| 44 |
|
| 45 |
it { should contain_ceph_config('client.radosgw.gateway/rgw_keystone_api_version').with_value(3) } |
| 46 |
it { should contain_ceph_config('client.radosgw.gateway/rgw_keystone_admin_domain').with_value('default') } |
| 47 |
it { should contain_ceph_config('client.radosgw.gateway/rgw_keystone_admin_project').with_value('openstack') } |
| 48 |
it { should contain_ceph_config('client.radosgw.gateway/rgw_keystone_admin_user').with_value('rgwuser') } |
| 49 |
it { should contain_ceph_config('client.radosgw.gateway/rgw_keystone_admin_password').with_value('123456') } |
| 50 |
it { should contain_ceph_config('client.radosgw.gateway/rgw_keystone_url').with_value('http://127.0.0.1:5000') } |
| 51 |
it { should contain_ceph_config('client.radosgw.gateway/rgw_keystone_accepted_roles').with_value('member') } |
| 52 |
it { should contain_ceph_config('client.radosgw.gateway/rgw_keystone_token_cache_size').with_value(500) } |
| 53 |
it { should contain_ceph_config('client.radosgw.gateway/rgw_s3_auth_use_keystone').with_value(true) } |
| 54 |
it { should contain_ceph_config('client.radosgw.gateway/rgw_keystone_implicit_tenants').with_value(true) } |
| 55 |
end |
| 56 |
|
| 57 |
context 'create with custom params' do |
| 58 |
let :pre_condition do |
| 59 |
"include ceph::params |
| 60 |
class { 'ceph': fsid => 'd5252e7d-75bc-4083-85ed-fe51fa83f62b' } |
| 61 |
class { 'ceph::repo': } |
| 62 |
ceph::rgw { 'radosgw.custom': }" |
| 63 |
end |
| 64 |
|
| 65 |
let :title do |
| 66 |
'radosgw.custom' |
| 67 |
end |
| 68 |
|
| 69 |
let :params do |
| 70 |
{ |
| 71 |
:rgw_keystone_admin_domain => 'default', |
| 72 |
:rgw_keystone_admin_project => 'openstack', |
| 73 |
:rgw_keystone_admin_user => 'rgwuser', |
| 74 |
:rgw_keystone_admin_password => '123456', |
| 75 |
:rgw_keystone_url => 'http://keystone.custom:5000', |
| 76 |
:rgw_keystone_accepted_roles => '_role1_,role2', |
| 77 |
:rgw_keystone_token_cache_size => 100, |
| 78 |
:rgw_s3_auth_use_keystone => false, |
| 79 |
:rgw_keystone_implicit_tenants => false, |
| 80 |
} |
| 81 |
end |
| 82 |
|
| 83 |
it { should contain_ceph_config('client.radosgw.custom/rgw_keystone_api_version').with_value(3) } |
| 84 |
it { should contain_ceph_config('client.radosgw.custom/rgw_keystone_admin_domain').with_value('default') } |
| 85 |
it { should contain_ceph_config('client.radosgw.custom/rgw_keystone_admin_project').with_value('openstack') } |
| 86 |
it { should contain_ceph_config('client.radosgw.custom/rgw_keystone_admin_user').with_value('rgwuser') } |
| 87 |
it { should contain_ceph_config('client.radosgw.custom/rgw_keystone_admin_password').with_value('123456') } |
| 88 |
it { should contain_ceph_config('client.radosgw.custom/rgw_keystone_url').with_value('http://keystone.custom:5000') } |
| 89 |
it { should contain_ceph_config('client.radosgw.custom/rgw_keystone_accepted_roles').with_value('_role1_,role2') } |
| 90 |
it { should contain_ceph_config('client.radosgw.custom/rgw_keystone_token_cache_size').with_value(100) } |
| 91 |
it { should contain_ceph_config('client.radosgw.custom/rgw_s3_auth_use_keystone').with_value(false) } |
| 92 |
it { should contain_ceph_config('client.radosgw.custom/rgw_keystone_implicit_tenants').with_value(false) } |
| 93 |
end |
| 94 |
end |
| 95 |
|
| 96 |
on_supported_os({ |
| 97 |
:supported_os => OSDefaults.get_supported_os |
| 98 |
}).each do |os,facts| |
| 99 |
context "on #{os}" do |
| 100 |
let (:facts) do |
| 101 |
facts.merge!(OSDefaults.get_facts()) |
| 102 |
end |
| 103 |
|
| 104 |
it_behaves_like 'ceph::rgw::keystone' |
| 105 |
end |
| 106 |
end |
| 107 |
end |