Merge "Convert spec testing to use rspec-puppet-facts"
This commit is contained in:
commit
345e2191ed
|
@ -20,116 +20,130 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe 'barbican::keystone::auth' do
|
describe 'barbican::keystone::auth' do
|
||||||
|
shared_examples 'barbican::keystone::auth' do
|
||||||
|
context 'with default class parameters' do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:password => 'barbican_password',
|
||||||
|
:tenant => 'foobar'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
let :facts do
|
it { should contain_keystone_user('barbican').with(
|
||||||
@default_facts.merge({ :osfamily => 'Debian' })
|
:ensure => 'present',
|
||||||
end
|
:password => 'barbican_password',
|
||||||
|
)}
|
||||||
|
|
||||||
describe 'with default class parameters' do
|
it { should contain_keystone_user_role('barbican@foobar').with(
|
||||||
let :params do
|
:ensure => 'present',
|
||||||
{ :password => 'barbican_password',
|
:roles => ['admin']
|
||||||
:tenant => 'foobar' }
|
)}
|
||||||
|
|
||||||
|
it { should contain_keystone_service('barbican::key-manager').with(
|
||||||
|
:ensure => 'present',
|
||||||
|
:description => 'Key management Service'
|
||||||
|
)}
|
||||||
|
|
||||||
|
it { should contain_keystone_endpoint('RegionOne/barbican::key-manager').with(
|
||||||
|
:ensure => 'present',
|
||||||
|
:public_url => 'http://127.0.0.1:9311',
|
||||||
|
:admin_url => 'http://127.0.0.1:9311',
|
||||||
|
:internal_url => 'http://127.0.0.1:9311',
|
||||||
|
)}
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to contain_keystone_user('barbican').with(
|
context 'when overriding URL parameters' do
|
||||||
:ensure => 'present',
|
let :params do
|
||||||
:password => 'barbican_password',
|
{
|
||||||
) }
|
:password => 'barbican_password',
|
||||||
|
:public_url => 'https://10.10.10.10:80',
|
||||||
|
:internal_url => 'http://10.10.10.11:81',
|
||||||
|
:admin_url => 'http://10.10.10.12:81'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
it { is_expected.to contain_keystone_user_role('barbican@foobar').with(
|
it { should contain_keystone_endpoint('RegionOne/barbican::key-manager').with(
|
||||||
:ensure => 'present',
|
:ensure => 'present',
|
||||||
:roles => ['admin']
|
|
||||||
)}
|
|
||||||
|
|
||||||
it { is_expected.to contain_keystone_service('barbican::key-manager').with(
|
|
||||||
:ensure => 'present',
|
|
||||||
:description => 'Key management Service'
|
|
||||||
) }
|
|
||||||
|
|
||||||
it { is_expected.to contain_keystone_endpoint('RegionOne/barbican::key-manager').with(
|
|
||||||
:ensure => 'present',
|
|
||||||
:public_url => 'http://127.0.0.1:9311',
|
|
||||||
:admin_url => 'http://127.0.0.1:9311',
|
|
||||||
:internal_url => 'http://127.0.0.1:9311',
|
|
||||||
) }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'when overriding URL parameters' do
|
|
||||||
let :params do
|
|
||||||
{ :password => 'barbican_password',
|
|
||||||
:public_url => 'https://10.10.10.10:80',
|
:public_url => 'https://10.10.10.10:80',
|
||||||
:internal_url => 'http://10.10.10.11:81',
|
:internal_url => 'http://10.10.10.11:81',
|
||||||
:admin_url => 'http://10.10.10.12:81' }
|
:admin_url => 'http://10.10.10.12:81'
|
||||||
|
)}
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to contain_keystone_endpoint('RegionOne/barbican::key-manager').with(
|
context 'when overriding auth name' do
|
||||||
:ensure => 'present',
|
let :params do
|
||||||
:public_url => 'https://10.10.10.10:80',
|
{
|
||||||
:internal_url => 'http://10.10.10.11:81',
|
:password => 'foo',
|
||||||
:admin_url => 'http://10.10.10.12:81'
|
:auth_name => 'barbicany'
|
||||||
) }
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'when overriding auth name' do
|
it { should contain_keystone_user('barbicany') }
|
||||||
let :params do
|
it { should contain_keystone_user_role('barbicany@services') }
|
||||||
{ :password => 'foo',
|
it { should contain_keystone_service('barbican::key-manager') }
|
||||||
:auth_name => 'barbicany' }
|
it { should contain_keystone_endpoint('RegionOne/barbican::key-manager') }
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to contain_keystone_user('barbicany') }
|
context 'when overriding service name' do
|
||||||
it { is_expected.to contain_keystone_user_role('barbicany@services') }
|
let :params do
|
||||||
it { is_expected.to contain_keystone_service('barbican::key-manager') }
|
{
|
||||||
it { is_expected.to contain_keystone_endpoint('RegionOne/barbican::key-manager') }
|
:service_name => 'barbican_service',
|
||||||
end
|
:auth_name => 'barbican',
|
||||||
|
:password => 'barbican_password'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
describe 'when overriding service name' do
|
it { should contain_keystone_user('barbican') }
|
||||||
let :params do
|
it { should contain_keystone_user_role('barbican@services') }
|
||||||
{ :service_name => 'barbican_service',
|
it { should contain_keystone_service('barbican_service::key-manager') }
|
||||||
:auth_name => 'barbican',
|
it { should contain_keystone_endpoint('RegionOne/barbican_service::key-manager') }
|
||||||
:password => 'barbican_password' }
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to contain_keystone_user('barbican') }
|
context 'when disabling user configuration' do
|
||||||
it { is_expected.to contain_keystone_user_role('barbican@services') }
|
let :params do
|
||||||
it { is_expected.to contain_keystone_service('barbican_service::key-manager') }
|
{
|
||||||
it { is_expected.to contain_keystone_endpoint('RegionOne/barbican_service::key-manager') }
|
:password => 'barbican_password',
|
||||||
end
|
:configure_user => false
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
describe 'when disabling user configuration' do
|
it { should_not contain_keystone_user('barbican') }
|
||||||
|
it { should contain_keystone_user_role('barbican@services') }
|
||||||
|
|
||||||
let :params do
|
it { should contain_keystone_service('barbican::key-manager').with(
|
||||||
{
|
:ensure => 'present',
|
||||||
:password => 'barbican_password',
|
:description => 'Key management Service'
|
||||||
:configure_user => false
|
)}
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.not_to contain_keystone_user('barbican') }
|
context 'when disabling user and user role configuration' do
|
||||||
it { is_expected.to contain_keystone_user_role('barbican@services') }
|
let :params do
|
||||||
it { is_expected.to contain_keystone_service('barbican::key-manager').with(
|
{
|
||||||
:ensure => 'present',
|
:password => 'barbican_password',
|
||||||
:description => 'Key management Service'
|
:configure_user => false,
|
||||||
) }
|
:configure_user_role => false
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
end
|
it { should_not contain_keystone_user('barbican') }
|
||||||
|
it { should_not contain_keystone_user_role('barbican@services') }
|
||||||
|
|
||||||
describe 'when disabling user and user role configuration' do
|
it { should contain_keystone_service('barbican::key-manager').with(
|
||||||
|
:ensure => 'present',
|
||||||
let :params do
|
:description => 'Key management Service'
|
||||||
{
|
)}
|
||||||
:password => 'barbican_password',
|
|
||||||
:configure_user => false,
|
|
||||||
:configure_user_role => false
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.not_to contain_keystone_user('barbican') }
|
|
||||||
it { is_expected.not_to contain_keystone_user_role('barbican@services') }
|
|
||||||
it { is_expected.to contain_keystone_service('barbican::key-manager').with(
|
|
||||||
:ensure => 'present',
|
|
||||||
:description => 'Key management Service'
|
|
||||||
) }
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
on_supported_os({
|
||||||
|
:supported_os => OSDefaults.get_supported_os
|
||||||
|
}).each do |os,facts|
|
||||||
|
context "on #{os}" do
|
||||||
|
let (:facts) do
|
||||||
|
facts.merge!(OSDefaults.get_facts())
|
||||||
|
end
|
||||||
|
|
||||||
|
it_behaves_like 'barbican::keystone::auth'
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -20,86 +20,76 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe 'barbican::plugins::dogtag' do
|
describe 'barbican::plugins::dogtag' do
|
||||||
|
|
||||||
let :facts do
|
|
||||||
@default_facts.merge(
|
|
||||||
{
|
|
||||||
:osfamily => 'RedHat',
|
|
||||||
:os_workers => '7',
|
|
||||||
}
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
let :default_params do
|
let :default_params do
|
||||||
{
|
{
|
||||||
:dogtag_plugin_ensure_package => 'present',
|
:dogtag_plugin_ensure_package => 'present',
|
||||||
:dogtag_plugin_pem_path => '<SERVICE DEFAULT>',
|
:dogtag_plugin_pem_path => '<SERVICE DEFAULT>',
|
||||||
:dogtag_plugin_dogtag_host => '<SERVICE DEFAULT>',
|
:dogtag_plugin_dogtag_host => '<SERVICE DEFAULT>',
|
||||||
:dogtag_plugin_dogtag_port => '<SERVICE DEFAULT>',
|
:dogtag_plugin_dogtag_port => '<SERVICE DEFAULT>',
|
||||||
:dogtag_plugin_nss_db_path => '<SERVICE DEFAULT>',
|
:dogtag_plugin_nss_db_path => '<SERVICE DEFAULT>',
|
||||||
:dogtag_plugin_simple_cmc_profile => '<SERVICE DEFAULT>',
|
:dogtag_plugin_simple_cmc_profile => '<SERVICE DEFAULT>',
|
||||||
:dogtag_plugin_ca_expiration_time => '<SERVICE DEFAULT>',
|
:dogtag_plugin_ca_expiration_time => '<SERVICE DEFAULT>',
|
||||||
:dogtag_plugin_plugin_working_dir => '<SERVICE DEFAULT>',
|
:dogtag_plugin_plugin_working_dir => '<SERVICE DEFAULT>',
|
||||||
:global_default => false,
|
:global_default => false,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
[{
|
shared_examples 'barbican::plugins::dogtag' do
|
||||||
:dogtag_plugin_nss_password => 'password',
|
[{
|
||||||
},
|
:dogtag_plugin_nss_password => 'password',
|
||||||
{
|
},
|
||||||
:dogtag_plugin_pem_path => 'path_to_pem_file',
|
{
|
||||||
:dogtag_plugin_dogtag_host => 'dogtag_host',
|
:dogtag_plugin_pem_path => 'path_to_pem_file',
|
||||||
:dogtag_plugin_dogtag_port => '1234',
|
:dogtag_plugin_dogtag_host => 'dogtag_host',
|
||||||
:dogtag_plugin_nss_db_path => 'path_to_nss_db',
|
:dogtag_plugin_dogtag_port => '1234',
|
||||||
:dogtag_plugin_nss_password => 'password',
|
:dogtag_plugin_nss_db_path => 'path_to_nss_db',
|
||||||
:dogtag_plugin_simple_cmc_profile => 'caServerCert',
|
:dogtag_plugin_nss_password => 'password',
|
||||||
:dogtag_plugin_ca_expiration_time => '100',
|
:dogtag_plugin_simple_cmc_profile => 'caServerCert',
|
||||||
:dogtag_plugin_plugin_working_dir => 'path_to_working_dir',
|
:dogtag_plugin_ca_expiration_time => '100',
|
||||||
:global_default => true,
|
:dogtag_plugin_plugin_working_dir => 'path_to_working_dir',
|
||||||
}
|
:global_default => true,
|
||||||
].each do |param_set|
|
}
|
||||||
|
].each do |param_set|
|
||||||
|
context "when #{param_set == {} ? "using default" : "specifying"} class parameters" do
|
||||||
|
let :param_hash do
|
||||||
|
default_params.merge(param_set)
|
||||||
|
end
|
||||||
|
|
||||||
describe "when #{param_set == {} ? "using default" : "specifying"} class parameters" do
|
let :params do
|
||||||
|
param_set
|
||||||
|
end
|
||||||
|
|
||||||
let :param_hash do
|
it { should contain_package('dogtag-client').with(
|
||||||
default_params.merge(param_set)
|
:ensure => param_hash[:dogtag_plugin_ensure_package],
|
||||||
end
|
:name => 'pki-base',
|
||||||
|
:tag => ['openstack', 'barbican-package'],
|
||||||
|
)}
|
||||||
|
|
||||||
let :params do
|
it {
|
||||||
param_set
|
should contain_barbican_config('dogtag_plugin/pem_path').with_value(param_hash[:dogtag_plugin_pem_path])
|
||||||
end
|
should contain_barbican_config('dogtag_plugin/dogtag_host').with_value(param_hash[:dogtag_plugin_dogtag_host])
|
||||||
|
should contain_barbican_config('dogtag_plugin/dogtag_port').with_value(param_hash[:dogtag_plugin_dogtag_port])
|
||||||
it { is_expected.to contain_package('dogtag-client').with(
|
should contain_barbican_config('dogtag_plugin/nss_db_path').with_value(param_hash[:dogtag_plugin_nss_db_path])
|
||||||
'ensure' => param_hash[:dogtag_plugin_ensure_package],
|
should contain_barbican_config('dogtag_plugin/nss_password').with_value(param_hash[:dogtag_plugin_nss_password]).with_secret(true)
|
||||||
'tag' => ['openstack', 'barbican-package'],
|
should contain_barbican_config('dogtag_plugin/simple_cmc_profile').with_value(param_hash[:dogtag_plugin_simple_cmc_profile])
|
||||||
) }
|
should contain_barbican_config('dogtag_plugin/ca_expiration_time').with_value(param_hash[:dogtag_plugin_ca_expiration_time])
|
||||||
|
should contain_barbican_config('dogtag_plugin/plugin_working_dir').with_value(param_hash[:dogtag_plugin_plugin_working_dir])
|
||||||
it 'is_expected.to set dogtag parameters' do
|
should contain_barbican_config('secretstore:dogtag/secret_store_plugin').with_value('dogtag_plugin')
|
||||||
is_expected.to contain_barbican_config('dogtag_plugin/pem_path')\
|
should contain_barbican_config('secretstore:dogtag/global_default').with_value(param_hash[:global_default])
|
||||||
.with_value(param_hash[:dogtag_plugin_pem_path])
|
}
|
||||||
is_expected.to contain_barbican_config('dogtag_plugin/dogtag_host')\
|
|
||||||
.with_value(param_hash[:dogtag_plugin_dogtag_host])
|
|
||||||
is_expected.to contain_barbican_config('dogtag_plugin/dogtag_port')\
|
|
||||||
.with_value(param_hash[:dogtag_plugin_dogtag_port])
|
|
||||||
is_expected.to contain_barbican_config('dogtag_plugin/nss_db_path')\
|
|
||||||
.with_value(param_hash[:dogtag_plugin_nss_db_path])
|
|
||||||
is_expected.to contain_barbican_config('dogtag_plugin/nss_password')\
|
|
||||||
.with_value(param_hash[:dogtag_plugin_nss_password]).with_secret(true)
|
|
||||||
is_expected.to contain_barbican_config('dogtag_plugin/simple_cmc_profile')\
|
|
||||||
.with_value(param_hash[:dogtag_plugin_simple_cmc_profile])
|
|
||||||
is_expected.to contain_barbican_config('dogtag_plugin/ca_expiration_time')\
|
|
||||||
.with_value(param_hash[:dogtag_plugin_ca_expiration_time])
|
|
||||||
is_expected.to contain_barbican_config('dogtag_plugin/plugin_working_dir')\
|
|
||||||
.with_value(param_hash[:dogtag_plugin_plugin_working_dir])
|
|
||||||
is_expected.to contain_barbican_config(
|
|
||||||
'secretstore:dogtag/secret_store_plugin') \
|
|
||||||
.with_value('dogtag_plugin')
|
|
||||||
is_expected.to contain_barbican_config(
|
|
||||||
'secretstore:dogtag/global_default') \
|
|
||||||
.with_value(param_hash[:global_default])
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
|
on_supported_os({
|
||||||
|
:supported_os => OSDefaults.get_supported_os
|
||||||
|
}).each do |os,facts|
|
||||||
|
context "on #{os}" do
|
||||||
|
let (:facts) do
|
||||||
|
facts.merge!(OSDefaults.get_facts( :os_workers => '7' ))
|
||||||
|
end
|
||||||
|
|
||||||
|
it_behaves_like 'barbican::plugins::dogtag'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
Loading…
Reference in New Issue