| 1 |
require 'spec_helper' |
| 2 |
|
| 3 |
describe 'cloudkitty::fetcher::keystone' do |
| 4 |
|
| 5 |
shared_examples_for 'cloudkitty::fetcher::keystone' do |
| 6 |
context 'with defaults' do |
| 7 |
let :params do |
| 8 |
{} |
| 9 |
end |
| 10 |
|
| 11 |
it 'configures the fetcher_keystone parameters' do |
| 12 |
is_expected.to contain_cloudkitty_config('fetcher_keystone/auth_section').with_value('<SERVICE DEFAULT>') |
| 13 |
is_expected.to contain_cloudkitty_config('fetcher_keystone/username').with_value('<SERVICE DEFAULT>') |
| 14 |
is_expected.to contain_cloudkitty_config('fetcher_keystone/password').with_value('<SERVICE DEFAULT>').with_secret(true) |
| 15 |
is_expected.to contain_cloudkitty_config('fetcher_keystone/project_name').with_value('<SERVICE DEFAULT>') |
| 16 |
is_expected.to contain_cloudkitty_config('fetcher_keystone/user_domain_name').with_value('<SERVICE DEFAULT>') |
| 17 |
is_expected.to contain_cloudkitty_config('fetcher_keystone/project_domain_name').with_value('<SERVICE DEFAULT>') |
| 18 |
is_expected.to contain_cloudkitty_config('fetcher_keystone/system_scope').with_value('<SERVICE DEFAULT>') |
| 19 |
is_expected.to contain_cloudkitty_config('fetcher_keystone/auth_url').with_value('<SERVICE DEFAULT>') |
| 20 |
is_expected.to contain_cloudkitty_config('fetcher_keystone/auth_type').with_value('<SERVICE DEFAULT>') |
| 21 |
is_expected.to contain_cloudkitty_config('fetcher_keystone/keystone_version').with_value('<SERVICE DEFAULT>') |
| 22 |
is_expected.to contain_cloudkitty_config('fetcher_keystone/ignore_rating_role').with_value('<SERVICE DEFAULT>') |
| 23 |
is_expected.to contain_cloudkitty_config('fetcher_keystone/ignore_disabled_tenants').with_value('<SERVICE DEFAULT>') |
| 24 |
end |
| 25 |
end |
| 26 |
|
| 27 |
context 'with parameters set' do |
| 28 |
let :params do |
| 29 |
{ |
| 30 |
:auth_section => 'keystone_authtoken', |
| 31 |
:username => 'cloudkitty', |
| 32 |
:password => 'cloudkitty_password', |
| 33 |
:project_name => 'service', |
| 34 |
:user_domain_name => 'Default', |
| 35 |
:project_domain_name => 'Default', |
| 36 |
:auth_url => 'http://127.0.0.1:5000', |
| 37 |
:auth_type => 'password', |
| 38 |
:keystone_version => 3, |
| 39 |
:ignore_rating_role => false, |
| 40 |
:ignore_disabled_tenants => true, |
| 41 |
} |
| 42 |
end |
| 43 |
|
| 44 |
it 'configures the fetcher_keystone parameters' do |
| 45 |
is_expected.to contain_cloudkitty_config('fetcher_keystone/auth_section').with_value('keystone_authtoken') |
| 46 |
is_expected.to contain_cloudkitty_config('fetcher_keystone/username').with_value('cloudkitty') |
| 47 |
is_expected.to contain_cloudkitty_config('fetcher_keystone/password').with_value('cloudkitty_password').with_secret(true) |
| 48 |
is_expected.to contain_cloudkitty_config('fetcher_keystone/project_name').with_value('service') |
| 49 |
is_expected.to contain_cloudkitty_config('fetcher_keystone/user_domain_name').with_value('Default') |
| 50 |
is_expected.to contain_cloudkitty_config('fetcher_keystone/project_domain_name').with_value('Default') |
| 51 |
is_expected.to contain_cloudkitty_config('fetcher_keystone/system_scope').with_value('<SERVICE DEFAULT>') |
| 52 |
is_expected.to contain_cloudkitty_config('fetcher_keystone/auth_url').with_value('http://127.0.0.1:5000') |
| 53 |
is_expected.to contain_cloudkitty_config('fetcher_keystone/auth_type').with_value('password') |
| 54 |
is_expected.to contain_cloudkitty_config('fetcher_keystone/keystone_version').with_value(3) |
| 55 |
is_expected.to contain_cloudkitty_config('fetcher_keystone/ignore_rating_role').with_value(false) |
| 56 |
is_expected.to contain_cloudkitty_config('fetcher_keystone/ignore_disabled_tenants').with_value(true) |
| 57 |
end |
| 58 |
end |
| 59 |
|
| 60 |
context 'when system_scope is set' do |
| 61 |
let :params do |
| 62 |
{ |
| 63 |
:project_name => 'service', |
| 64 |
:project_domain_name => 'Default', |
| 65 |
:system_scope => 'all' |
| 66 |
} |
| 67 |
end |
| 68 |
it 'configures system-scoped credential' do |
| 69 |
is_expected.to contain_cloudkitty_config('fetcher_keystone/project_name').with_value('<SERVICE DEFAULT>') |
| 70 |
is_expected.to contain_cloudkitty_config('fetcher_keystone/project_domain_name').with_value('<SERVICE DEFAULT>') |
| 71 |
is_expected.to contain_cloudkitty_config('fetcher_keystone/system_scope').with_value('all') |
| 72 |
end |
| 73 |
end |
| 74 |
end |
| 75 |
|
| 76 |
on_supported_os({ |
| 77 |
:supported_os => OSDefaults.get_supported_os |
| 78 |
}).each do |os,facts| |
| 79 |
context "on #{os}" do |
| 80 |
let (:facts) do |
| 81 |
facts.merge!(OSDefaults.get_facts()) |
| 82 |
end |
| 83 |
|
| 84 |
context 'with default parameters' do |
| 85 |
it_behaves_like 'cloudkitty::fetcher::keystone' |
| 86 |
end |
| 87 |
end |
| 88 |
end |
| 89 |
end |