| 1 |
require 'spec_helper' |
| 2 |
|
| 3 |
describe 'nova::keystone' do |
| 4 |
|
| 5 |
shared_examples 'nova::keystone' do |
| 6 |
|
| 7 |
let :params do |
| 8 |
{ |
| 9 |
:password => 's3cr3t' |
| 10 |
} |
| 11 |
end |
| 12 |
|
| 13 |
context 'with required parameters' do |
| 14 |
it 'configures keystone in nova.conf' do |
| 15 |
should contain_nova_config('keystone/password').with_value('s3cr3t').with_secret(true) |
| 16 |
should contain_nova_config('keystone/auth_type').with_value('password') |
| 17 |
should contain_nova_config('keystone/auth_url').with_value('http://127.0.0.1:5000') |
| 18 |
should contain_nova_config('keystone/timeout').with_value('<SERVICE DEFAULT>') |
| 19 |
should contain_nova_config('keystone/service_type').with_value('<SERVICE DEFAULT>') |
| 20 |
should contain_nova_config('keystone/valid_interfaces').with_value('<SERVICE DEFAULT>') |
| 21 |
should contain_nova_config('keystone/endpoint_override').with_value('<SERVICE DEFAULT>') |
| 22 |
should contain_nova_config('keystone/region_name').with_value('<SERVICE DEFAULT>') |
| 23 |
should contain_nova_config('keystone/project_name').with_value('services') |
| 24 |
should contain_nova_config('keystone/project_domain_name').with_value('Default') |
| 25 |
should contain_nova_config('keystone/username').with_value('nova') |
| 26 |
should contain_nova_config('keystone/user_domain_name').with_value('Default') |
| 27 |
end |
| 28 |
|
| 29 |
end |
| 30 |
|
| 31 |
context 'with parameters' do |
| 32 |
before do |
| 33 |
params.merge!({ |
| 34 |
:auth_type => 'v3password', |
| 35 |
:auth_url => 'http://10.0.0.10:5000/', |
| 36 |
:timeout => 60, |
| 37 |
:service_type => 'identity', |
| 38 |
:valid_interfaces => ['internal', 'public'], |
| 39 |
:endpoint_override => 'http://10.0.0.11:5000/', |
| 40 |
:region_name => 'RegionOne', |
| 41 |
:project_name => 'alt_service', |
| 42 |
:project_domain_name => 'DomainX', |
| 43 |
:username => 'alt_nova', |
| 44 |
:user_domain_name => 'DomainY', |
| 45 |
}) |
| 46 |
end |
| 47 |
|
| 48 |
it 'configures keystone in nova.conf' do |
| 49 |
should contain_nova_config('keystone/password').with_value('s3cr3t').with_secret(true) |
| 50 |
should contain_nova_config('keystone/auth_type').with_value('v3password') |
| 51 |
should contain_nova_config('keystone/auth_url').with_value('http://10.0.0.10:5000/') |
| 52 |
should contain_nova_config('keystone/timeout').with_value(60) |
| 53 |
should contain_nova_config('keystone/service_type').with_value('identity') |
| 54 |
should contain_nova_config('keystone/valid_interfaces').with_value('internal,public') |
| 55 |
should contain_nova_config('keystone/endpoint_override').with_value('http://10.0.0.11:5000/') |
| 56 |
should contain_nova_config('keystone/region_name').with_value('RegionOne') |
| 57 |
should contain_nova_config('keystone/system_scope').with_value('<SERVICE DEFAULT>') |
| 58 |
should contain_nova_config('keystone/project_name').with_value('alt_service') |
| 59 |
should contain_nova_config('keystone/project_domain_name').with_value('DomainX') |
| 60 |
should contain_nova_config('keystone/username').with_value('alt_nova') |
| 61 |
should contain_nova_config('keystone/user_domain_name').with_value('DomainY') |
| 62 |
end |
| 63 |
end |
| 64 |
|
| 65 |
context 'when specified parameters' do |
| 66 |
before do |
| 67 |
params.merge!({ |
| 68 |
:system_scope => 'all', |
| 69 |
:project_name => 'alt_service', |
| 70 |
:project_domain_name => 'DomainX', |
| 71 |
}) |
| 72 |
end |
| 73 |
|
| 74 |
it 'configures system_scope' do |
| 75 |
should contain_nova_config('keystone/system_scope').with_value('all') |
| 76 |
should contain_nova_config('keystone/project_name').with_value('<SERVICE DEFAULT>') |
| 77 |
should contain_nova_config('keystone/project_domain_name').with_value('<SERVICE DEFAULT>') |
| 78 |
end |
| 79 |
end |
| 80 |
end |
| 81 |
|
| 82 |
on_supported_os({ |
| 83 |
:supported_os => OSDefaults.get_supported_os |
| 84 |
}).each do |os,facts| |
| 85 |
context "on #{os}" do |
| 86 |
let (:facts) do |
| 87 |
facts.merge(OSDefaults.get_facts()) |
| 88 |
end |
| 89 |
|
| 90 |
it_behaves_like 'nova::keystone' |
| 91 |
end |
| 92 |
end |
| 93 |
end |