Switch glance to rspec-puppet-facts
This change updates the glance tests to use rspec-puppet-facts to test multiple operating systems. Change-Id: I75fd8970ba8335cb4ffa09a7d600415056e9f889
This commit is contained in:
parent
624f522e71
commit
cda71192de
|
@ -52,13 +52,7 @@ describe 'glance::api::db' do
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'on Debian platforms' do
|
shared_examples_for 'glance::api::db Debian' do
|
||||||
let :facts do
|
|
||||||
@default_facts.merge({ :osfamily => 'Debian' })
|
|
||||||
end
|
|
||||||
|
|
||||||
it_configures 'glance::api::db'
|
|
||||||
|
|
||||||
context 'using pymysql driver' do
|
context 'using pymysql driver' do
|
||||||
let :params do
|
let :params do
|
||||||
{ :database_connection => 'mysql+pymysql://glance_api:glance@localhost/glance', }
|
{ :database_connection => 'mysql+pymysql://glance_api:glance@localhost/glance', }
|
||||||
|
@ -74,16 +68,7 @@ describe 'glance::api::db' do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'on Redhat platforms' do
|
shared_examples_for 'glance::api::db RedHat' do
|
||||||
let :facts do
|
|
||||||
@default_facts.merge({
|
|
||||||
:osfamily => 'RedHat',
|
|
||||||
:operatingsystemrelease => '7',
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
it_configures 'glance::api::db'
|
|
||||||
|
|
||||||
context 'using pymysql driver' do
|
context 'using pymysql driver' do
|
||||||
let :params do
|
let :params do
|
||||||
{ :database_connection => 'mysql+pymysql://glance_api:glance@localhost/glance', }
|
{ :database_connection => 'mysql+pymysql://glance_api:glance@localhost/glance', }
|
||||||
|
@ -93,5 +78,18 @@ describe 'glance::api::db' do
|
||||||
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())
|
||||||
|
end
|
||||||
|
|
||||||
|
it_configures 'glance::api::db'
|
||||||
|
it_configures "glance::api::db #{facts[:osfamily]}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -127,24 +127,16 @@ describe 'glance::api::logging' do
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'on Debian platforms' do
|
on_supported_os({
|
||||||
let :facts do
|
:supported_os => OSDefaults.get_supported_os
|
||||||
@default_facts.merge({
|
}).each do |os,facts|
|
||||||
:osfamily => 'Debian',
|
context "on #{os}" do
|
||||||
})
|
let (:facts) do
|
||||||
|
facts.merge!(OSDefaults.get_facts())
|
||||||
|
end
|
||||||
|
|
||||||
|
it_configures 'glance-api-logging'
|
||||||
end
|
end
|
||||||
|
|
||||||
it_configures 'glance-api-logging'
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'on RedHat platforms' do
|
|
||||||
let :facts do
|
|
||||||
@default_facts.merge({
|
|
||||||
:osfamily => 'RedHat',
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
it_configures 'glance-api-logging'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,13 +2,6 @@ require 'spec_helper'
|
||||||
|
|
||||||
describe 'glance::api' do
|
describe 'glance::api' do
|
||||||
|
|
||||||
let :facts do
|
|
||||||
@default_facts.merge({
|
|
||||||
:osfamily => 'Debian',
|
|
||||||
:processorcount => '7',
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
let :default_params do
|
let :default_params do
|
||||||
{
|
{
|
||||||
:verbose => false,
|
:verbose => false,
|
||||||
|
@ -50,280 +43,277 @@ describe 'glance::api' do
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
[{:keystone_password => 'ChangeMe'},
|
shared_examples_for 'glance::api' do
|
||||||
{
|
[{:keystone_password => 'ChangeMe'},
|
||||||
:verbose => true,
|
{
|
||||||
:debug => true,
|
:verbose => true,
|
||||||
:bind_host => '127.0.0.1',
|
:debug => true,
|
||||||
:bind_port => '9222',
|
:bind_host => '127.0.0.1',
|
||||||
:registry_host => '127.0.0.1',
|
:bind_port => '9222',
|
||||||
:registry_port => '9111',
|
:registry_host => '127.0.0.1',
|
||||||
:registry_client_protocol => 'https',
|
:registry_port => '9111',
|
||||||
:auth_type => 'not_keystone',
|
:registry_client_protocol => 'https',
|
||||||
:auth_region => 'RegionOne2',
|
:auth_type => 'not_keystone',
|
||||||
:enabled => false,
|
:auth_region => 'RegionOne2',
|
||||||
:backlog => '4095',
|
:enabled => false,
|
||||||
:workers => '5',
|
:backlog => '4095',
|
||||||
:keystone_tenant => 'admin2',
|
:workers => '5',
|
||||||
:keystone_user => 'admin2',
|
:keystone_tenant => 'admin2',
|
||||||
:keystone_password => 'ChangeMe2',
|
:keystone_user => 'admin2',
|
||||||
:token_cache_time => '300',
|
:keystone_password => 'ChangeMe2',
|
||||||
:show_image_direct_url => true,
|
:token_cache_time => '300',
|
||||||
:show_multiple_locations => true,
|
:show_image_direct_url => true,
|
||||||
:location_strategy => 'store_type',
|
:show_multiple_locations => true,
|
||||||
:delayed_delete => 'true',
|
:location_strategy => 'store_type',
|
||||||
:scrub_time => '10',
|
:delayed_delete => 'true',
|
||||||
:image_cache_dir => '/tmp/glance',
|
:scrub_time => '10',
|
||||||
:image_cache_stall_time => '10',
|
:image_cache_dir => '/tmp/glance',
|
||||||
:image_cache_max_size => '10737418240',
|
:image_cache_stall_time => '10',
|
||||||
:os_region_name => 'RegionOne2',
|
:image_cache_max_size => '10737418240',
|
||||||
:signing_dir => '/path/to/dir',
|
:os_region_name => 'RegionOne2',
|
||||||
:pipeline => 'keystone2',
|
:signing_dir => '/path/to/dir',
|
||||||
:auth_uri => 'http://127.0.0.1:5000/v2.0',
|
:pipeline => 'keystone2',
|
||||||
:identity_uri => 'http://127.0.0.1:35357/v2.0',
|
:auth_uri => 'http://127.0.0.1:5000/v2.0',
|
||||||
}
|
:identity_uri => 'http://127.0.0.1:35357/v2.0',
|
||||||
].each do |param_set|
|
}
|
||||||
|
].each do |param_set|
|
||||||
|
|
||||||
describe "when #{param_set == {:keystone_password => 'ChangeMe'} ? "using default" : "specifying"} class parameters" do
|
describe "when #{param_set == {:keystone_password => 'ChangeMe'} ? "using default" : "specifying"} class parameters" do
|
||||||
|
|
||||||
let :param_hash do
|
let :param_hash do
|
||||||
default_params.merge(param_set)
|
default_params.merge(param_set)
|
||||||
end
|
|
||||||
|
|
||||||
let :params do
|
|
||||||
param_set
|
|
||||||
end
|
|
||||||
|
|
||||||
it { is_expected.to contain_class 'glance' }
|
|
||||||
it { is_expected.to contain_class 'glance::policy' }
|
|
||||||
it { is_expected.to contain_class 'glance::api::logging' }
|
|
||||||
it { is_expected.to contain_class 'glance::api::db' }
|
|
||||||
|
|
||||||
it { is_expected.to contain_service('glance-api').with(
|
|
||||||
'ensure' => (param_hash[:manage_service] && param_hash[:enabled]) ? 'running': 'stopped',
|
|
||||||
'enable' => param_hash[:enabled],
|
|
||||||
'hasstatus' => true,
|
|
||||||
'hasrestart' => true,
|
|
||||||
'tag' => 'glance-service',
|
|
||||||
) }
|
|
||||||
|
|
||||||
it { is_expected.to_not contain_exec('validate_nova_api') }
|
|
||||||
it { is_expected.to contain_glance_api_config("paste_deploy/flavor").with_value(param_hash[:pipeline]) }
|
|
||||||
|
|
||||||
it 'is_expected.to lay down default api config' do
|
|
||||||
[
|
|
||||||
'use_stderr',
|
|
||||||
'bind_host',
|
|
||||||
'bind_port',
|
|
||||||
'registry_host',
|
|
||||||
'registry_port',
|
|
||||||
'registry_client_protocol',
|
|
||||||
'show_image_direct_url',
|
|
||||||
'show_multiple_locations',
|
|
||||||
'location_strategy',
|
|
||||||
'delayed_delete',
|
|
||||||
'scrub_time',
|
|
||||||
'image_cache_dir',
|
|
||||||
'auth_region'
|
|
||||||
].each do |config|
|
|
||||||
is_expected.to contain_glance_api_config("DEFAULT/#{config}").with_value(param_hash[config.intern])
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
it 'is_expected.to lay down default cache config' do
|
let :params do
|
||||||
[
|
param_set
|
||||||
'registry_host',
|
|
||||||
'registry_port',
|
|
||||||
'image_cache_stall_time',
|
|
||||||
'image_cache_max_size',
|
|
||||||
].each do |config|
|
|
||||||
is_expected.to contain_glance_cache_config("DEFAULT/#{config}").with_value(param_hash[config.intern])
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
it 'is_expected.to lay down default glance_store api and cache config' do
|
it { is_expected.to contain_class 'glance' }
|
||||||
[
|
it { is_expected.to contain_class 'glance::policy' }
|
||||||
'os_region_name',
|
it { is_expected.to contain_class 'glance::api::logging' }
|
||||||
].each do |config|
|
it { is_expected.to contain_class 'glance::api::db' }
|
||||||
is_expected.to contain_glance_cache_config("glance_store/#{config}").with_value(param_hash[config.intern])
|
|
||||||
is_expected.to contain_glance_api_config("glance_store/#{config}").with_value(param_hash[config.intern])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'is_expected.to have no ssl options' do
|
it { is_expected.to contain_service('glance-api').with(
|
||||||
is_expected.to contain_glance_api_config('DEFAULT/ca_file').with_ensure('absent')
|
'ensure' => (param_hash[:manage_service] && param_hash[:enabled]) ? 'running': 'stopped',
|
||||||
is_expected.to contain_glance_api_config('DEFAULT/cert_file').with_ensure('absent')
|
'enable' => param_hash[:enabled],
|
||||||
is_expected.to contain_glance_api_config('DEFAULT/key_file').with_ensure('absent')
|
'hasstatus' => true,
|
||||||
end
|
'hasrestart' => true,
|
||||||
|
'tag' => 'glance-service',
|
||||||
|
) }
|
||||||
|
|
||||||
it 'is_expected.to configure itself for keystone if that is the auth_type' do
|
it { is_expected.to_not contain_exec('validate_nova_api') }
|
||||||
if params[:auth_type] == 'keystone'
|
it { is_expected.to contain_glance_api_config("paste_deploy/flavor").with_value(param_hash[:pipeline]) }
|
||||||
is_expected.to contain('paste_deploy/flavor').with_value('keystone+cachemanagement')
|
|
||||||
is_expected.to contain_glance_api_config('keystone_authtoken/memcached_servers').with_value(param_hash[:memcached_servers])
|
it 'is_expected.to lay down default api config' do
|
||||||
['admin_tenant_name', 'admin_user', 'admin_password', 'token_cache_time', 'signing_dir', 'auth_uri', 'identity_uri'].each do |config|
|
[
|
||||||
is_expected.to contain_glance_api_config("keystone_authtoken/#{config}").with_value(param_hash[config.intern])
|
'use_stderr',
|
||||||
|
'bind_host',
|
||||||
|
'bind_port',
|
||||||
|
'registry_host',
|
||||||
|
'registry_port',
|
||||||
|
'registry_client_protocol',
|
||||||
|
'show_image_direct_url',
|
||||||
|
'show_multiple_locations',
|
||||||
|
'location_strategy',
|
||||||
|
'delayed_delete',
|
||||||
|
'scrub_time',
|
||||||
|
'image_cache_dir',
|
||||||
|
'auth_region'
|
||||||
|
].each do |config|
|
||||||
|
is_expected.to contain_glance_api_config("DEFAULT/#{config}").with_value(param_hash[config.intern])
|
||||||
end
|
end
|
||||||
is_expected.to contain_glance_api_config('keystone_authtoken/admin_password').with_value(param_hash[:keystone_password]).with_secret(true)
|
end
|
||||||
|
|
||||||
['admin_tenant_name', 'admin_user', 'admin_password'].each do |config|
|
it 'is_expected.to lay down default cache config' do
|
||||||
is_expected.to contain_glance_cache_config("keystone_authtoken/#{config}").with_value(param_hash[config.intern])
|
[
|
||||||
|
'registry_host',
|
||||||
|
'registry_port',
|
||||||
|
'image_cache_stall_time',
|
||||||
|
'image_cache_max_size',
|
||||||
|
].each do |config|
|
||||||
|
is_expected.to contain_glance_cache_config("DEFAULT/#{config}").with_value(param_hash[config.intern])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'is_expected.to lay down default glance_store api and cache config' do
|
||||||
|
[
|
||||||
|
'os_region_name',
|
||||||
|
].each do |config|
|
||||||
|
is_expected.to contain_glance_cache_config("glance_store/#{config}").with_value(param_hash[config.intern])
|
||||||
|
is_expected.to contain_glance_api_config("glance_store/#{config}").with_value(param_hash[config.intern])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'is_expected.to have no ssl options' do
|
||||||
|
is_expected.to contain_glance_api_config('DEFAULT/ca_file').with_ensure('absent')
|
||||||
|
is_expected.to contain_glance_api_config('DEFAULT/cert_file').with_ensure('absent')
|
||||||
|
is_expected.to contain_glance_api_config('DEFAULT/key_file').with_ensure('absent')
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'is_expected.to configure itself for keystone if that is the auth_type' do
|
||||||
|
if params[:auth_type] == 'keystone'
|
||||||
|
is_expected.to contain('paste_deploy/flavor').with_value('keystone+cachemanagement')
|
||||||
|
is_expected.to contain_glance_api_config('keystone_authtoken/memcached_servers').with_value(param_hash[:memcached_servers])
|
||||||
|
['admin_tenant_name', 'admin_user', 'admin_password', 'token_cache_time', 'signing_dir', 'auth_uri', 'identity_uri'].each do |config|
|
||||||
|
is_expected.to contain_glance_api_config("keystone_authtoken/#{config}").with_value(param_hash[config.intern])
|
||||||
|
end
|
||||||
|
is_expected.to contain_glance_api_config('keystone_authtoken/admin_password').with_value(param_hash[:keystone_password]).with_secret(true)
|
||||||
|
|
||||||
|
['admin_tenant_name', 'admin_user', 'admin_password'].each do |config|
|
||||||
|
is_expected.to contain_glance_cache_config("keystone_authtoken/#{config}").with_value(param_hash[config.intern])
|
||||||
|
end
|
||||||
|
is_expected.to contain_glance_cache_config('keystone_authtoken/admin_password').with_value(param_hash[:keystone_password]).with_secret(true)
|
||||||
end
|
end
|
||||||
is_expected.to contain_glance_cache_config('keystone_authtoken/admin_password').with_value(param_hash[:keystone_password]).with_secret(true)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
describe 'with disabled service managing' do
|
||||||
|
|
||||||
describe 'with disabled service managing' do
|
|
||||||
let :params do
|
|
||||||
{
|
|
||||||
:keystone_password => 'ChangeMe',
|
|
||||||
:manage_service => false,
|
|
||||||
:enabled => false,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
it { is_expected.to contain_service('glance-api').with(
|
|
||||||
'ensure' => nil,
|
|
||||||
'enable' => false,
|
|
||||||
'hasstatus' => true,
|
|
||||||
'hasrestart' => true,
|
|
||||||
'tag' => 'glance-service',
|
|
||||||
) }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'with overridden pipeline' do
|
|
||||||
let :params do
|
|
||||||
{
|
|
||||||
:keystone_password => 'ChangeMe',
|
|
||||||
:pipeline => 'something',
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
it { is_expected.to contain_glance_api_config('paste_deploy/flavor').with_value('something') }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'with blank pipeline' do
|
|
||||||
let :params do
|
|
||||||
{
|
|
||||||
:keystone_password => 'ChangeMe',
|
|
||||||
:pipeline => '',
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
it { is_expected.to contain_glance_api_config('paste_deploy/flavor').with_ensure('absent') }
|
|
||||||
end
|
|
||||||
|
|
||||||
[
|
|
||||||
'keystone/',
|
|
||||||
'keystone+',
|
|
||||||
'+keystone',
|
|
||||||
'keystone+cachemanagement+',
|
|
||||||
'+'
|
|
||||||
].each do |pipeline|
|
|
||||||
describe "with pipeline incorrect value #{pipeline}" do
|
|
||||||
let :params do
|
let :params do
|
||||||
{
|
{
|
||||||
:keystone_password => 'ChangeMe',
|
:keystone_password => 'ChangeMe',
|
||||||
:pipeline => pipeline
|
:manage_service => false,
|
||||||
|
:enabled => false,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect { is_expected.to contain_glance_api_config('filter:paste_deploy/flavor') }.to\
|
it { is_expected.to contain_service('glance-api').with(
|
||||||
raise_error(Puppet::Error, /validate_re\(\): .* does not match/) }
|
'ensure' => nil,
|
||||||
|
'enable' => false,
|
||||||
|
'hasstatus' => true,
|
||||||
|
'hasrestart' => true,
|
||||||
|
'tag' => 'glance-service',
|
||||||
|
) }
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'with overridden pipeline' do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:keystone_password => 'ChangeMe',
|
||||||
|
:pipeline => 'something',
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it { is_expected.to contain_glance_api_config('paste_deploy/flavor').with_value('something') }
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'with blank pipeline' do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:keystone_password => 'ChangeMe',
|
||||||
|
:pipeline => '',
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it { is_expected.to contain_glance_api_config('paste_deploy/flavor').with_ensure('absent') }
|
||||||
|
end
|
||||||
|
|
||||||
|
[
|
||||||
|
'keystone/',
|
||||||
|
'keystone+',
|
||||||
|
'+keystone',
|
||||||
|
'keystone+cachemanagement+',
|
||||||
|
'+'
|
||||||
|
].each do |pipeline|
|
||||||
|
describe "with pipeline incorrect value #{pipeline}" do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:keystone_password => 'ChangeMe',
|
||||||
|
:pipeline => pipeline
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it { expect { is_expected.to contain_glance_api_config('filter:paste_deploy/flavor') }.to\
|
||||||
|
raise_error(Puppet::Error, /validate_re\(\): .* does not match/) }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'with ssl options' do
|
||||||
|
let :params do
|
||||||
|
default_params.merge({
|
||||||
|
:ca_file => '/tmp/ca_file',
|
||||||
|
:cert_file => '/tmp/cert_file',
|
||||||
|
:key_file => '/tmp/key_file'
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with ssl options' do
|
||||||
|
it { is_expected.to contain_glance_api_config('DEFAULT/ca_file').with_value('/tmp/ca_file') }
|
||||||
|
it { is_expected.to contain_glance_api_config('DEFAULT/cert_file').with_value('/tmp/cert_file') }
|
||||||
|
it { is_expected.to contain_glance_api_config('DEFAULT/key_file').with_value('/tmp/key_file') }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
describe 'with known_stores by default' do
|
||||||
|
let :params do
|
||||||
|
default_params
|
||||||
|
end
|
||||||
|
|
||||||
|
it { is_expected.to_not contain_glance_api_config('glance_store/stores').with_value('false') }
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'with known_stores override' do
|
||||||
|
let :params do
|
||||||
|
default_params.merge({
|
||||||
|
:known_stores => ['glance.store.filesystem.Store','glance.store.http.Store'],
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
it { is_expected.to contain_glance_api_config('glance_store/stores').with_value("glance.store.filesystem.Store,glance.store.http.Store") }
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'while validating the service with default command' do
|
||||||
|
let :params do
|
||||||
|
default_params.merge({
|
||||||
|
:validate => true,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
it { is_expected.to contain_exec('execute glance-api validation').with(
|
||||||
|
:path => '/usr/bin:/bin:/usr/sbin:/sbin',
|
||||||
|
:provider => 'shell',
|
||||||
|
:tries => '10',
|
||||||
|
:try_sleep => '2',
|
||||||
|
:command => 'glance --os-auth-url http://127.0.0.1:5000/ --os-tenant-name services --os-username glance --os-password ChangeMe image-list',
|
||||||
|
)}
|
||||||
|
|
||||||
|
it { is_expected.to contain_anchor('create glance-api anchor').with(
|
||||||
|
:require => 'Exec[execute glance-api validation]',
|
||||||
|
)}
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'Support IPv6' do
|
||||||
|
let :params do
|
||||||
|
default_params.merge({
|
||||||
|
:registry_host => '2001::1',
|
||||||
|
})
|
||||||
|
end
|
||||||
|
it { is_expected.to contain_glance_api_config('DEFAULT/registry_host').with(
|
||||||
|
:value => '[2001::1]'
|
||||||
|
)}
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'while validating the service with custom command' do
|
||||||
|
let :params do
|
||||||
|
default_params.merge({
|
||||||
|
:validate => true,
|
||||||
|
:validation_options => { 'glance-api' => { 'command' => 'my-script' } }
|
||||||
|
})
|
||||||
|
end
|
||||||
|
it { is_expected.to contain_exec('execute glance-api validation').with(
|
||||||
|
:path => '/usr/bin:/bin:/usr/sbin:/sbin',
|
||||||
|
:provider => 'shell',
|
||||||
|
:tries => '10',
|
||||||
|
:try_sleep => '2',
|
||||||
|
:command => 'my-script',
|
||||||
|
)}
|
||||||
|
|
||||||
|
it { is_expected.to contain_anchor('create glance-api anchor').with(
|
||||||
|
:require => 'Exec[execute glance-api validation]',
|
||||||
|
)}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'with ssl options' do
|
shared_examples_for 'glance::api Debian' do
|
||||||
let :params do
|
|
||||||
default_params.merge({
|
|
||||||
:ca_file => '/tmp/ca_file',
|
|
||||||
:cert_file => '/tmp/cert_file',
|
|
||||||
:key_file => '/tmp/key_file'
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'with ssl options' do
|
|
||||||
it { is_expected.to contain_glance_api_config('DEFAULT/ca_file').with_value('/tmp/ca_file') }
|
|
||||||
it { is_expected.to contain_glance_api_config('DEFAULT/cert_file').with_value('/tmp/cert_file') }
|
|
||||||
it { is_expected.to contain_glance_api_config('DEFAULT/key_file').with_value('/tmp/key_file') }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
describe 'with known_stores by default' do
|
|
||||||
let :params do
|
|
||||||
default_params
|
|
||||||
end
|
|
||||||
|
|
||||||
it { is_expected.to_not contain_glance_api_config('glance_store/stores').with_value('false') }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'with known_stores override' do
|
|
||||||
let :params do
|
|
||||||
default_params.merge({
|
|
||||||
:known_stores => ['glance.store.filesystem.Store','glance.store.http.Store'],
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
it { is_expected.to contain_glance_api_config('glance_store/stores').with_value("glance.store.filesystem.Store,glance.store.http.Store") }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'while validating the service with default command' do
|
|
||||||
let :params do
|
|
||||||
default_params.merge({
|
|
||||||
:validate => true,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
it { is_expected.to contain_exec('execute glance-api validation').with(
|
|
||||||
:path => '/usr/bin:/bin:/usr/sbin:/sbin',
|
|
||||||
:provider => 'shell',
|
|
||||||
:tries => '10',
|
|
||||||
:try_sleep => '2',
|
|
||||||
:command => 'glance --os-auth-url http://127.0.0.1:5000/ --os-tenant-name services --os-username glance --os-password ChangeMe image-list',
|
|
||||||
)}
|
|
||||||
|
|
||||||
it { is_expected.to contain_anchor('create glance-api anchor').with(
|
|
||||||
:require => 'Exec[execute glance-api validation]',
|
|
||||||
)}
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'while validating the service with custom command' do
|
|
||||||
let :params do
|
|
||||||
default_params.merge({
|
|
||||||
:validate => true,
|
|
||||||
:validation_options => { 'glance-api' => { 'command' => 'my-script' } }
|
|
||||||
})
|
|
||||||
end
|
|
||||||
it { is_expected.to contain_exec('execute glance-api validation').with(
|
|
||||||
:path => '/usr/bin:/bin:/usr/sbin:/sbin',
|
|
||||||
:provider => 'shell',
|
|
||||||
:tries => '10',
|
|
||||||
:try_sleep => '2',
|
|
||||||
:command => 'my-script',
|
|
||||||
)}
|
|
||||||
|
|
||||||
it { is_expected.to contain_anchor('create glance-api anchor').with(
|
|
||||||
:require => 'Exec[execute glance-api validation]',
|
|
||||||
)}
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'Support IPv6' do
|
|
||||||
let :params do
|
|
||||||
default_params.merge({
|
|
||||||
:registry_host => '2001::1',
|
|
||||||
})
|
|
||||||
end
|
|
||||||
it { is_expected.to contain_glance_api_config('DEFAULT/registry_host').with(
|
|
||||||
:value => '[2001::1]'
|
|
||||||
)}
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'on Debian platforms' do
|
|
||||||
let :facts do
|
|
||||||
@default_facts.merge({
|
|
||||||
:osfamily => 'Debian',
|
|
||||||
})
|
|
||||||
end
|
|
||||||
let(:params) { default_params }
|
let(:params) { default_params }
|
||||||
|
|
||||||
# We only test this on Debian platforms, since on RedHat there isn't a
|
# We only test this on Debian platforms, since on RedHat there isn't a
|
||||||
|
@ -339,13 +329,7 @@ describe 'glance::api' do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'on RedHat platforms' do
|
shared_examples_for 'glance::api RedHat' do
|
||||||
let :facts do
|
|
||||||
@default_facts.merge({
|
|
||||||
:osfamily => 'RedHat',
|
|
||||||
:operatingsystemrelease => '7',
|
|
||||||
})
|
|
||||||
end
|
|
||||||
let(:params) { default_params }
|
let(:params) { default_params }
|
||||||
|
|
||||||
it { is_expected.to contain_package('openstack-glance').with(
|
it { is_expected.to contain_package('openstack-glance').with(
|
||||||
|
@ -353,6 +337,19 @@ describe 'glance::api' do
|
||||||
)}
|
)}
|
||||||
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_configures 'glance::api'
|
||||||
|
it_configures "glance::api #{facts[:osfamily]}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe 'on unknown platforms' do
|
describe 'on unknown platforms' do
|
||||||
let :facts do
|
let :facts do
|
||||||
{ :osfamily => 'unknown' }
|
{ :osfamily => 'unknown' }
|
||||||
|
|
|
@ -76,24 +76,16 @@ describe 'glance::backend::cinder' do
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'on Debian platforms' do
|
|
||||||
let :facts do
|
on_supported_os({
|
||||||
@default_facts.merge({
|
:supported_os => OSDefaults.get_supported_os
|
||||||
:osfamily => 'Debian',
|
}).each do |os,facts|
|
||||||
})
|
context "on #{os}" do
|
||||||
|
let (:facts) do
|
||||||
|
facts.merge!(OSDefaults.get_facts())
|
||||||
|
end
|
||||||
|
|
||||||
|
it_configures 'glance with cinder backend'
|
||||||
end
|
end
|
||||||
|
|
||||||
it_configures 'glance with cinder backend'
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'on RedHat platforms' do
|
|
||||||
let :facts do
|
|
||||||
@default_facts.merge({
|
|
||||||
:osfamily => 'RedHat',
|
|
||||||
:operatingsystemrelease => '7',
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
it_configures 'glance with cinder backend'
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,32 +1,41 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe 'glance::backend::file' do
|
describe 'glance::backend::file' do
|
||||||
let :facts do
|
|
||||||
@default_facts.merge({
|
|
||||||
:osfamily => 'Debian',
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'configures glance-api.conf' do
|
|
||||||
is_expected.to contain_glance_api_config('glance_store/default_store').with_value('file')
|
|
||||||
is_expected.to contain_glance_api_config('glance_store/filesystem_store_datadir').with_value('/var/lib/glance/images/')
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'configures glance-cache.conf' do
|
|
||||||
is_expected.to contain_glance_cache_config('glance_store/filesystem_store_datadir').with_value('/var/lib/glance/images/')
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'when overriding datadir' do
|
|
||||||
let :params do
|
|
||||||
{:filesystem_store_datadir => '/tmp/'}
|
|
||||||
end
|
|
||||||
|
|
||||||
|
shared_examples_for 'glance::backend::file' do
|
||||||
it 'configures glance-api.conf' do
|
it 'configures glance-api.conf' do
|
||||||
is_expected.to contain_glance_api_config('glance_store/filesystem_store_datadir').with_value('/tmp/')
|
is_expected.to contain_glance_api_config('glance_store/default_store').with_value('file')
|
||||||
|
is_expected.to contain_glance_api_config('glance_store/filesystem_store_datadir').with_value('/var/lib/glance/images/')
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'configures glance-cache.conf' do
|
it 'configures glance-cache.conf' do
|
||||||
is_expected.to contain_glance_cache_config('glance_store/filesystem_store_datadir').with_value('/tmp/')
|
is_expected.to contain_glance_cache_config('glance_store/filesystem_store_datadir').with_value('/var/lib/glance/images/')
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'when overriding datadir' do
|
||||||
|
let :params do
|
||||||
|
{:filesystem_store_datadir => '/tmp/'}
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'configures glance-api.conf' do
|
||||||
|
is_expected.to contain_glance_api_config('glance_store/filesystem_store_datadir').with_value('/tmp/')
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'configures glance-cache.conf' do
|
||||||
|
is_expected.to contain_glance_cache_config('glance_store/filesystem_store_datadir').with_value('/tmp/')
|
||||||
|
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())
|
||||||
|
end
|
||||||
|
|
||||||
|
it_configures 'glance::backend::file'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,117 +1,125 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe 'glance::backend::s3' do
|
describe 'glance::backend::s3' do
|
||||||
let :facts do
|
shared_examples_for 'glance::backend::s3' do
|
||||||
@default_facts.merge({
|
|
||||||
:osfamily => 'Debian',
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
let :params do
|
|
||||||
{
|
|
||||||
:access_key => 'access',
|
|
||||||
:secret_key => 'secret',
|
|
||||||
:host => 'host',
|
|
||||||
:bucket => 'bucket'
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'when default parameters' do
|
|
||||||
|
|
||||||
it 'configures glance-api.conf' do
|
|
||||||
is_expected.to contain_glance_api_config('glance_store/default_store').with_value('s3')
|
|
||||||
is_expected.to contain_glance_api_config('glance_store/s3_store_access_key').with_value('access')
|
|
||||||
is_expected.to contain_glance_api_config('glance_store/s3_store_secret_key').with_value('secret')
|
|
||||||
is_expected.to contain_glance_api_config('glance_store/s3_store_host').with_value('host')
|
|
||||||
is_expected.to contain_glance_api_config('glance_store/s3_store_bucket').with_value('bucket')
|
|
||||||
is_expected.to contain_glance_api_config('glance_store/s3_store_bucket_url_format').with_value('subdomain')
|
|
||||||
is_expected.to contain_glance_api_config('glance_store/s3_store_create_bucket_on_put').with_value('false')
|
|
||||||
is_expected.to contain_glance_api_config('glance_store/s3_store_large_object_size').with_value('100')
|
|
||||||
is_expected.to contain_glance_api_config('glance_store/s3_store_large_object_chunk_size').with_value('10')
|
|
||||||
is_expected.to contain_glance_api_config('glance_store/s3_store_object_buffer_dir').with_value(nil)
|
|
||||||
is_expected.to contain_glance_api_config('glance_store/s3_store_thread_pools').with_value('10')
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'when overriding parameters' do
|
|
||||||
let :params do
|
let :params do
|
||||||
{
|
{
|
||||||
:access_key => 'access2',
|
:access_key => 'access',
|
||||||
:secret_key => 'secret2',
|
:secret_key => 'secret',
|
||||||
:host => 'host2',
|
:host => 'host',
|
||||||
:bucket => 'bucket2',
|
:bucket => 'bucket'
|
||||||
:bucket_url_format => 'path',
|
|
||||||
:create_bucket_on_put => true,
|
|
||||||
:large_object_size => 200,
|
|
||||||
:large_object_chunk_size => 20,
|
|
||||||
:object_buffer_dir => '/tmp',
|
|
||||||
:thread_pools => 20,
|
|
||||||
:default_store => false
|
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'configures glance-api.conf' do
|
describe 'when default parameters' do
|
||||||
is_expected.to contain_glance_api_config('glance_store/s3_store_access_key').with_value('access2')
|
|
||||||
is_expected.to contain_glance_api_config('glance_store/s3_store_secret_key').with_value('secret2')
|
it 'configures glance-api.conf' do
|
||||||
is_expected.to contain_glance_api_config('glance_store/s3_store_host').with_value('host2')
|
is_expected.to contain_glance_api_config('glance_store/default_store').with_value('s3')
|
||||||
is_expected.to contain_glance_api_config('glance_store/s3_store_bucket').with_value('bucket2')
|
is_expected.to contain_glance_api_config('glance_store/s3_store_access_key').with_value('access')
|
||||||
is_expected.to contain_glance_api_config('glance_store/s3_store_bucket_url_format').with_value('path')
|
is_expected.to contain_glance_api_config('glance_store/s3_store_secret_key').with_value('secret')
|
||||||
is_expected.to contain_glance_api_config('glance_store/s3_store_create_bucket_on_put').with_value('true')
|
is_expected.to contain_glance_api_config('glance_store/s3_store_host').with_value('host')
|
||||||
is_expected.to contain_glance_api_config('glance_store/s3_store_large_object_size').with_value('200')
|
is_expected.to contain_glance_api_config('glance_store/s3_store_bucket').with_value('bucket')
|
||||||
is_expected.to contain_glance_api_config('glance_store/s3_store_large_object_chunk_size').with_value('20')
|
is_expected.to contain_glance_api_config('glance_store/s3_store_bucket_url_format').with_value('subdomain')
|
||||||
is_expected.to contain_glance_api_config('glance_store/s3_store_object_buffer_dir').with_value('/tmp')
|
is_expected.to contain_glance_api_config('glance_store/s3_store_create_bucket_on_put').with_value('false')
|
||||||
is_expected.to contain_glance_api_config('glance_store/s3_store_thread_pools').with_value('20')
|
is_expected.to contain_glance_api_config('glance_store/s3_store_large_object_size').with_value('100')
|
||||||
is_expected.to_not contain_glance_api_config('glance_store/default_store')
|
is_expected.to contain_glance_api_config('glance_store/s3_store_large_object_chunk_size').with_value('10')
|
||||||
|
is_expected.to contain_glance_api_config('glance_store/s3_store_object_buffer_dir').with_value(nil)
|
||||||
|
is_expected.to contain_glance_api_config('glance_store/s3_store_thread_pools').with_value('10')
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
describe 'when overriding parameters' do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:access_key => 'access2',
|
||||||
|
:secret_key => 'secret2',
|
||||||
|
:host => 'host2',
|
||||||
|
:bucket => 'bucket2',
|
||||||
|
:bucket_url_format => 'path',
|
||||||
|
:create_bucket_on_put => true,
|
||||||
|
:large_object_size => 200,
|
||||||
|
:large_object_chunk_size => 20,
|
||||||
|
:object_buffer_dir => '/tmp',
|
||||||
|
:thread_pools => 20,
|
||||||
|
:default_store => false
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'configures glance-api.conf' do
|
||||||
|
is_expected.to contain_glance_api_config('glance_store/s3_store_access_key').with_value('access2')
|
||||||
|
is_expected.to contain_glance_api_config('glance_store/s3_store_secret_key').with_value('secret2')
|
||||||
|
is_expected.to contain_glance_api_config('glance_store/s3_store_host').with_value('host2')
|
||||||
|
is_expected.to contain_glance_api_config('glance_store/s3_store_bucket').with_value('bucket2')
|
||||||
|
is_expected.to contain_glance_api_config('glance_store/s3_store_bucket_url_format').with_value('path')
|
||||||
|
is_expected.to contain_glance_api_config('glance_store/s3_store_create_bucket_on_put').with_value('true')
|
||||||
|
is_expected.to contain_glance_api_config('glance_store/s3_store_large_object_size').with_value('200')
|
||||||
|
is_expected.to contain_glance_api_config('glance_store/s3_store_large_object_chunk_size').with_value('20')
|
||||||
|
is_expected.to contain_glance_api_config('glance_store/s3_store_object_buffer_dir').with_value('/tmp')
|
||||||
|
is_expected.to contain_glance_api_config('glance_store/s3_store_thread_pools').with_value('20')
|
||||||
|
is_expected.to_not contain_glance_api_config('glance_store/default_store')
|
||||||
|
end
|
||||||
|
|
||||||
describe 'with invalid bucket_url_format' do
|
|
||||||
let :params do
|
|
||||||
{
|
|
||||||
:access_key => 'access',
|
|
||||||
:secret_key => 'secret',
|
|
||||||
:host => 'host',
|
|
||||||
:bucket => 'bucket',
|
|
||||||
:bucket_url_format => 'invalid'
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'throws errors' do
|
describe 'with invalid bucket_url_format' do
|
||||||
is_expected.to raise_error(Puppet::Error, /glance::backend::s3::bucket_url_format must be either "subdomain" or "path"/)
|
let :params do
|
||||||
|
{
|
||||||
|
:access_key => 'access',
|
||||||
|
:secret_key => 'secret',
|
||||||
|
:host => 'host',
|
||||||
|
:bucket => 'bucket',
|
||||||
|
:bucket_url_format => 'invalid'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'throws errors' do
|
||||||
|
is_expected.to raise_error(Puppet::Error, /glance::backend::s3::bucket_url_format must be either "subdomain" or "path"/)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'with invalid large_object_chunk_size' do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:access_key => 'access',
|
||||||
|
:secret_key => 'secret',
|
||||||
|
:host => 'host',
|
||||||
|
:bucket => 'bucket',
|
||||||
|
:large_object_chunk_size => 1
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'throws error' do
|
||||||
|
is_expected.to raise_error(Puppet::Error, /glance::backend::s3::large_object_chunk_size must be an integer >= 5/)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'with non-integer large_object_chunk_size' do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:access_key => 'access',
|
||||||
|
:secret_key => 'secret',
|
||||||
|
:host => 'host',
|
||||||
|
:bucket => 'bucket',
|
||||||
|
:large_object_chunk_size => 'string'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'throws error' do
|
||||||
|
is_expected.to raise_error(Puppet::Error, /glance::backend::s3::large_object_chunk_size must be an integer >= 5/)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'with invalid large_object_chunk_size' do
|
on_supported_os({
|
||||||
let :params do
|
:supported_os => OSDefaults.get_supported_os
|
||||||
{
|
}).each do |os,facts|
|
||||||
:access_key => 'access',
|
context "on #{os}" do
|
||||||
:secret_key => 'secret',
|
let (:facts) do
|
||||||
:host => 'host',
|
facts.merge!(OSDefaults.get_facts())
|
||||||
:bucket => 'bucket',
|
end
|
||||||
:large_object_chunk_size => 1
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'throws error' do
|
it_configures 'glance::backend::s3'
|
||||||
is_expected.to raise_error(Puppet::Error, /glance::backend::s3::large_object_chunk_size must be an integer >= 5/)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'with non-integer large_object_chunk_size' do
|
|
||||||
let :params do
|
|
||||||
{
|
|
||||||
:access_key => 'access',
|
|
||||||
:secret_key => 'secret',
|
|
||||||
:host => 'host',
|
|
||||||
:bucket => 'bucket',
|
|
||||||
:large_object_chunk_size => 'string'
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'throws error' do
|
|
||||||
is_expected.to raise_error(Puppet::Error, /glance::backend::s3::large_object_chunk_size must be an integer >= 5/)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,70 +1,77 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe 'glance::backend::swift' do
|
describe 'glance::backend::swift' do
|
||||||
let :facts do
|
shared_examples_for 'glance::backend::swift' do
|
||||||
@default_facts.merge({
|
|
||||||
:osfamily => 'Debian',
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
let :params do
|
|
||||||
{
|
|
||||||
:swift_store_user => 'user',
|
|
||||||
:swift_store_key => 'key',
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
let :pre_condition do
|
|
||||||
'class { "glance::api": keystone_password => "pass" }'
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'when default parameters' do
|
|
||||||
|
|
||||||
it 'configures glance-api.conf' do
|
|
||||||
is_expected.to contain_glance_api_config('glance_store/default_store').with_value('swift')
|
|
||||||
is_expected.to contain_glance_api_config('glance_store/swift_store_large_object_size').with_value('5120')
|
|
||||||
is_expected.to contain_glance_api_config('glance_store/swift_store_container').with_value('glance')
|
|
||||||
is_expected.to contain_glance_api_config('glance_store/swift_store_create_container_on_put').with_value(false)
|
|
||||||
is_expected.to contain_glance_api_config('glance_store/swift_store_endpoint_type').with_value('internalURL')
|
|
||||||
is_expected.to contain_glance_api_config('glance_store/swift_store_region').with_value(nil)
|
|
||||||
is_expected.to contain_glance_api_config('glance_store/swift_store_config_file').with_value('/etc/glance/glance-swift.conf')
|
|
||||||
is_expected.to contain_glance_api_config('glance_store/default_swift_reference').with_value('ref1')
|
|
||||||
is_expected.to contain_glance_swift_config('ref1/key').with_value('key')
|
|
||||||
is_expected.to contain_glance_swift_config('ref1/user').with_value('user')
|
|
||||||
is_expected.to contain_glance_swift_config('ref1/auth_version').with_value('2')
|
|
||||||
is_expected.to contain_glance_swift_config('ref1/auth_address').with_value('http://127.0.0.1:5000/v2.0/')
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'when overriding parameters' do
|
|
||||||
let :params do
|
let :params do
|
||||||
{
|
{
|
||||||
:swift_store_user => 'user2',
|
:swift_store_user => 'user',
|
||||||
:swift_store_key => 'key2',
|
:swift_store_key => 'key',
|
||||||
:swift_store_auth_version => '1',
|
|
||||||
:swift_store_large_object_size => '100',
|
|
||||||
:swift_store_auth_address => '127.0.0.2:8080/v1.0/',
|
|
||||||
:swift_store_container => 'swift',
|
|
||||||
:swift_store_create_container_on_put => true,
|
|
||||||
:swift_store_endpoint_type => 'publicURL',
|
|
||||||
:swift_store_region => 'RegionTwo',
|
|
||||||
:default_swift_reference => 'swift_creds',
|
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'configures glance-api.conf' do
|
let :pre_condition do
|
||||||
is_expected.to contain_glance_api_config('glance_store/swift_store_container').with_value('swift')
|
'class { "glance::api": keystone_password => "pass" }'
|
||||||
is_expected.to contain_glance_api_config('glance_store/swift_store_create_container_on_put').with_value(true)
|
|
||||||
is_expected.to contain_glance_api_config('glance_store/swift_store_large_object_size').with_value('100')
|
|
||||||
is_expected.to contain_glance_api_config('glance_store/swift_store_endpoint_type').with_value('publicURL')
|
|
||||||
is_expected.to contain_glance_api_config('glance_store/swift_store_region').with_value('RegionTwo')
|
|
||||||
is_expected.to contain_glance_api_config('glance_store/default_swift_reference').with_value('swift_creds')
|
|
||||||
is_expected.to contain_glance_swift_config('swift_creds/key').with_value('key2')
|
|
||||||
is_expected.to contain_glance_swift_config('swift_creds/user').with_value('user2')
|
|
||||||
is_expected.to contain_glance_swift_config('swift_creds/auth_version').with_value('1')
|
|
||||||
is_expected.to contain_glance_swift_config('swift_creds/auth_address').with_value('127.0.0.2:8080/v1.0/')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'when default parameters' do
|
||||||
|
|
||||||
|
it 'configures glance-api.conf' do
|
||||||
|
is_expected.to contain_glance_api_config('glance_store/default_store').with_value('swift')
|
||||||
|
is_expected.to contain_glance_api_config('glance_store/swift_store_large_object_size').with_value('5120')
|
||||||
|
is_expected.to contain_glance_api_config('glance_store/swift_store_container').with_value('glance')
|
||||||
|
is_expected.to contain_glance_api_config('glance_store/swift_store_create_container_on_put').with_value(false)
|
||||||
|
is_expected.to contain_glance_api_config('glance_store/swift_store_endpoint_type').with_value('internalURL')
|
||||||
|
is_expected.to contain_glance_api_config('glance_store/swift_store_region').with_value(nil)
|
||||||
|
is_expected.to contain_glance_api_config('glance_store/swift_store_config_file').with_value('/etc/glance/glance-swift.conf')
|
||||||
|
is_expected.to contain_glance_api_config('glance_store/default_swift_reference').with_value('ref1')
|
||||||
|
is_expected.to contain_glance_swift_config('ref1/key').with_value('key')
|
||||||
|
is_expected.to contain_glance_swift_config('ref1/user').with_value('user')
|
||||||
|
is_expected.to contain_glance_swift_config('ref1/auth_version').with_value('2')
|
||||||
|
is_expected.to contain_glance_swift_config('ref1/auth_address').with_value('http://127.0.0.1:5000/v2.0/')
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'when overriding parameters' do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:swift_store_user => 'user2',
|
||||||
|
:swift_store_key => 'key2',
|
||||||
|
:swift_store_auth_version => '1',
|
||||||
|
:swift_store_large_object_size => '100',
|
||||||
|
:swift_store_auth_address => '127.0.0.2:8080/v1.0/',
|
||||||
|
:swift_store_container => 'swift',
|
||||||
|
:swift_store_create_container_on_put => true,
|
||||||
|
:swift_store_endpoint_type => 'publicURL',
|
||||||
|
:swift_store_region => 'RegionTwo',
|
||||||
|
:default_swift_reference => 'swift_creds',
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'configures glance-api.conf' do
|
||||||
|
is_expected.to contain_glance_api_config('glance_store/swift_store_container').with_value('swift')
|
||||||
|
is_expected.to contain_glance_api_config('glance_store/swift_store_create_container_on_put').with_value(true)
|
||||||
|
is_expected.to contain_glance_api_config('glance_store/swift_store_large_object_size').with_value('100')
|
||||||
|
is_expected.to contain_glance_api_config('glance_store/swift_store_endpoint_type').with_value('publicURL')
|
||||||
|
is_expected.to contain_glance_api_config('glance_store/swift_store_region').with_value('RegionTwo')
|
||||||
|
is_expected.to contain_glance_api_config('glance_store/default_swift_reference').with_value('swift_creds')
|
||||||
|
is_expected.to contain_glance_swift_config('swift_creds/key').with_value('key2')
|
||||||
|
is_expected.to contain_glance_swift_config('swift_creds/user').with_value('user2')
|
||||||
|
is_expected.to contain_glance_swift_config('swift_creds/auth_version').with_value('1')
|
||||||
|
is_expected.to contain_glance_swift_config('swift_creds/auth_address').with_value('127.0.0.2:8080/v1.0/')
|
||||||
|
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())
|
||||||
|
end
|
||||||
|
|
||||||
|
it_configures 'glance::backend::swift'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -73,27 +73,17 @@ describe 'glance::backend::vsphere' do
|
||||||
is_expected.to contain_glance_api_config('glance_store/vmware_api_retry_count').with_value('11')
|
is_expected.to contain_glance_api_config('glance_store/vmware_api_retry_count').with_value('11')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'on Debian platforms' do
|
on_supported_os({
|
||||||
let :facts do
|
:supported_os => OSDefaults.get_supported_os
|
||||||
@default_facts.merge({
|
}).each do |os,facts|
|
||||||
:osfamily => 'Debian',
|
context "on #{os}" do
|
||||||
})
|
let (:facts) do
|
||||||
|
facts.merge!(OSDefaults.get_facts())
|
||||||
|
end
|
||||||
|
|
||||||
|
it_configures 'glance with vsphere backend'
|
||||||
end
|
end
|
||||||
|
|
||||||
it_configures 'glance with vsphere backend'
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'on RedHat platforms' do
|
|
||||||
let :facts do
|
|
||||||
@default_facts.merge({
|
|
||||||
:osfamily => 'RedHat',
|
|
||||||
:operatingsystemrelease => '7',
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
it_configures 'glance with vsphere backend'
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -17,6 +17,10 @@ describe 'glance::cache::cleaner' do
|
||||||
:month => '*',
|
:month => '*',
|
||||||
:weekday => '*'
|
:weekday => '*'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
is_expected.to contain_cron('glance-cache-cleaner').with(
|
||||||
|
:require => "Package[#{platform_params[:api_package_name]}]"
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -46,25 +50,25 @@ describe 'glance::cache::cleaner' do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'on Debian platforms' do
|
on_supported_os({
|
||||||
let :facts do
|
:supported_os => OSDefaults.get_supported_os
|
||||||
@default_facts.merge({
|
}).each do |os,facts|
|
||||||
:osfamily => 'Debian',
|
context "on #{os}" do
|
||||||
})
|
let (:facts) do
|
||||||
end
|
facts.merge!(OSDefaults.get_facts())
|
||||||
include_examples 'glance cache cleaner'
|
end
|
||||||
it { is_expected.to contain_cron('glance-cache-cleaner').with(:require => 'Package[glance-api]')}
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'on RedHat platforms' do
|
let(:platform_params) do
|
||||||
let :facts do
|
case facts[:osfamily]
|
||||||
@default_facts.merge({
|
when 'Debian'
|
||||||
:osfamily => 'RedHat',
|
{ :api_package_name => 'glance-api' }
|
||||||
:operatingsystemrelease => '7',
|
when 'RedHat'
|
||||||
})
|
{ :api_package_name => 'openstack-glance' }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
it_configures 'glance cache cleaner'
|
||||||
end
|
end
|
||||||
include_examples 'glance cache cleaner'
|
|
||||||
it { is_expected.to contain_cron('glance-cache-cleaner').with(:require => 'Package[openstack-glance]')}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -127,20 +127,15 @@ describe 'glance::cache::logging' do
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'on Debian platforms' do
|
on_supported_os({
|
||||||
let :facts do
|
:supported_os => OSDefaults.get_supported_os
|
||||||
@default_facts.merge({ :osfamily => 'Debian' })
|
}).each do |os,facts|
|
||||||
|
context "on #{os}" do
|
||||||
|
let (:facts) do
|
||||||
|
facts.merge!(OSDefaults.get_facts())
|
||||||
|
end
|
||||||
|
|
||||||
|
it_configures 'glance-cache-logging'
|
||||||
end
|
end
|
||||||
|
|
||||||
it_configures 'glance-cache-logging'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'on RedHat platforms' do
|
|
||||||
let :facts do
|
|
||||||
@default_facts.merge({ :osfamily => 'RedHat' })
|
|
||||||
end
|
|
||||||
|
|
||||||
it_configures 'glance-cache-logging'
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -17,6 +17,9 @@ describe 'glance::cache::pruner' do
|
||||||
:month => '*',
|
:month => '*',
|
||||||
:weekday => '*'
|
:weekday => '*'
|
||||||
)
|
)
|
||||||
|
is_expected.to contain_cron('glance-cache-pruner').with(
|
||||||
|
:require => "Package[#{platform_params[:api_package_name]}]"
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -46,25 +49,24 @@ describe 'glance::cache::pruner' do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'on Debian platforms' do
|
on_supported_os({
|
||||||
let :facts do
|
:supported_os => OSDefaults.get_supported_os
|
||||||
@default_facts.merge({
|
}).each do |os,facts|
|
||||||
:osfamily => 'Debian',
|
context "on #{os}" do
|
||||||
})
|
let (:facts) do
|
||||||
end
|
facts.merge!(OSDefaults.get_facts())
|
||||||
include_examples 'glance cache pruner'
|
end
|
||||||
it { is_expected.to contain_cron('glance-cache-pruner').with(:require => 'Package[glance-api]')}
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'on RedHat platforms' do
|
let(:platform_params) do
|
||||||
let :facts do
|
case facts[:osfamily]
|
||||||
@default_facts.merge({
|
when 'Debian'
|
||||||
:osfamily => 'RedHat',
|
{ :api_package_name => 'glance-api' }
|
||||||
:operatingsystemrelease => '7',
|
when 'RedHat'
|
||||||
})
|
{ :api_package_name => 'openstack-glance' }
|
||||||
end
|
end
|
||||||
include_examples 'glance cache pruner'
|
end
|
||||||
it { is_expected.to contain_cron('glance-cache-pruner').with(:require => 'Package[openstack-glance]')}
|
|
||||||
end
|
|
||||||
|
|
||||||
|
it_configures 'glance cache pruner'
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -12,22 +12,15 @@ describe 'glance::client' do
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'on Debian platforms' do
|
on_supported_os({
|
||||||
let :facts do
|
:supported_os => OSDefaults.get_supported_os
|
||||||
@default_facts.merge({
|
}).each do |os,facts|
|
||||||
:osfamily => 'Debian',
|
context "on #{os}" do
|
||||||
})
|
let (:facts) do
|
||||||
end
|
facts.merge!(OSDefaults.get_facts())
|
||||||
include_examples 'glance client'
|
end
|
||||||
end
|
|
||||||
|
|
||||||
context 'on RedHat platforms' do
|
it_configures 'glance client'
|
||||||
let :facts do
|
|
||||||
@default_facts.merge({
|
|
||||||
:osfamily => 'RedHat',
|
|
||||||
:operatingsystemrelease => '7',
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
include_examples 'glance client'
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,79 +1,85 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe 'glance::db::mysql' do
|
describe 'glance::db::mysql' do
|
||||||
let :facts do
|
shared_examples_for 'glance::db::mysql' do
|
||||||
@default_facts.merge({
|
let :pre_condition do
|
||||||
:osfamily => 'Debian',
|
'include mysql::server'
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
let :pre_condition do
|
|
||||||
'include mysql::server'
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "with default params" do
|
|
||||||
let :params do
|
|
||||||
{
|
|
||||||
:password => 'glancepass1',
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to contain_openstacklib__db__mysql('glance').with(
|
describe "with default params" do
|
||||||
:password_hash => '*41C910F70EB213CF4CB7B2F561B4995503C0A87B',
|
let :params do
|
||||||
:charset => 'utf8',
|
{
|
||||||
:collate => 'utf8_general_ci',
|
:password => 'glancepass1',
|
||||||
)}
|
}
|
||||||
|
end
|
||||||
|
|
||||||
end
|
it { is_expected.to contain_openstacklib__db__mysql('glance').with(
|
||||||
|
:password_hash => '*41C910F70EB213CF4CB7B2F561B4995503C0A87B',
|
||||||
|
:charset => 'utf8',
|
||||||
|
:collate => 'utf8_general_ci',
|
||||||
|
)}
|
||||||
|
|
||||||
describe "overriding default params" do
|
|
||||||
let :params do
|
|
||||||
{
|
|
||||||
:password => 'glancepass2',
|
|
||||||
:dbname => 'glancedb2',
|
|
||||||
:charset => 'utf8',
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to contain_openstacklib__db__mysql('glance').with(
|
describe "overriding default params" do
|
||||||
:password_hash => '*6F9A1CB9BD83EE06F3903BDFF9F4188764E694CA',
|
let :params do
|
||||||
:dbname => 'glancedb2',
|
{
|
||||||
:charset => 'utf8'
|
:password => 'glancepass2',
|
||||||
)}
|
:dbname => 'glancedb2',
|
||||||
|
:charset => 'utf8',
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
end
|
it { is_expected.to contain_openstacklib__db__mysql('glance').with(
|
||||||
|
:password_hash => '*6F9A1CB9BD83EE06F3903BDFF9F4188764E694CA',
|
||||||
|
:dbname => 'glancedb2',
|
||||||
|
:charset => 'utf8'
|
||||||
|
)}
|
||||||
|
|
||||||
describe "overriding allowed_hosts param to array" do
|
|
||||||
let :params do
|
|
||||||
{
|
|
||||||
:password => 'glancepass2',
|
|
||||||
:dbname => 'glancedb2',
|
|
||||||
:allowed_hosts => ['127.0.0.1','%']
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
describe "overriding allowed_hosts param to array" do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:password => 'glancepass2',
|
||||||
|
:dbname => 'glancedb2',
|
||||||
|
:allowed_hosts => ['127.0.0.1','%']
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
describe "overriding allowed_hosts param to string" do
|
|
||||||
let :params do
|
|
||||||
{
|
|
||||||
:password => 'glancepass2',
|
|
||||||
:dbname => 'glancedb2',
|
|
||||||
:allowed_hosts => '192.168.1.1'
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
describe "overriding allowed_hosts param to string" do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:password => 'glancepass2',
|
||||||
|
:dbname => 'glancedb2',
|
||||||
|
:allowed_hosts => '192.168.1.1'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
describe "overriding allowed_hosts param equals to host param " do
|
|
||||||
let :params do
|
|
||||||
{
|
|
||||||
:password => 'glancepass2',
|
|
||||||
:dbname => 'glancedb2',
|
|
||||||
:allowed_hosts => '127.0.0.1'
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "overriding allowed_hosts param equals to host param " do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:password => 'glancepass2',
|
||||||
|
:dbname => 'glancedb2',
|
||||||
|
:allowed_hosts => '127.0.0.1'
|
||||||
|
}
|
||||||
|
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())
|
||||||
|
end
|
||||||
|
|
||||||
|
it_configures 'glance::db::mysql'
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,21 +2,13 @@ require 'spec_helper'
|
||||||
|
|
||||||
describe 'glance::db::postgresql' do
|
describe 'glance::db::postgresql' do
|
||||||
|
|
||||||
let :req_params do
|
shared_examples_for 'glance::db::postgresql' do
|
||||||
{ :password => 'pw' }
|
let :req_params do
|
||||||
end
|
{ :password => 'pw' }
|
||||||
|
end
|
||||||
|
|
||||||
let :pre_condition do
|
let :pre_condition do
|
||||||
'include postgresql::server'
|
'include postgresql::server'
|
||||||
end
|
|
||||||
|
|
||||||
context 'on a RedHat osfamily' do
|
|
||||||
let :facts do
|
|
||||||
@default_facts.merge({
|
|
||||||
:osfamily => 'RedHat',
|
|
||||||
:operatingsystemrelease => '7.0',
|
|
||||||
:concat_basedir => '/var/lib/puppet/concat'
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with only required parameters' do
|
context 'with only required parameters' do
|
||||||
|
@ -29,30 +21,17 @@ describe 'glance::db::postgresql' do
|
||||||
:password => 'md56c7c03b193c2c1e0667bc5bd891703db'
|
:password => 'md56c7c03b193c2c1e0667bc5bd891703db'
|
||||||
)}
|
)}
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'on a Debian osfamily' do
|
on_supported_os({
|
||||||
let :facts do
|
:supported_os => OSDefaults.get_supported_os
|
||||||
@default_facts.merge({
|
}).each do |os,facts|
|
||||||
:operatingsystemrelease => '7.8',
|
context "on #{os}" do
|
||||||
:operatingsystem => 'Debian',
|
let (:facts) do
|
||||||
:osfamily => 'Debian',
|
facts.merge!(OSDefaults.get_facts({ :concat_basedir => '/var/lib/puppet/concat' }))
|
||||||
:concat_basedir => '/var/lib/puppet/concat'
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'with only required parameters' do
|
|
||||||
let :params do
|
|
||||||
req_params
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to contain_postgresql__server__db('glance').with(
|
it_configures 'glance::db::postgresql'
|
||||||
:user => 'glance',
|
|
||||||
:password => 'md56c7c03b193c2c1e0667bc5bd891703db'
|
|
||||||
)}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -30,33 +30,18 @@ describe 'glance::db::sync' do
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'on a RedHat osfamily' do
|
on_supported_os({
|
||||||
let :facts do
|
:supported_os => OSDefaults.get_supported_os
|
||||||
@default_facts.merge({
|
}).each do |os,facts|
|
||||||
:osfamily => 'RedHat',
|
context "on #{os}" do
|
||||||
:operatingsystemrelease => '7.0',
|
let (:facts) do
|
||||||
:concat_basedir => '/var/lib/puppet/concat'
|
facts.merge!(OSDefaults.get_facts({ :concat_basedir => '/var/lib/puppet/concat' }))
|
||||||
})
|
end
|
||||||
|
|
||||||
|
it_configures 'glance-dbsync'
|
||||||
end
|
end
|
||||||
|
|
||||||
it_configures 'glance-dbsync'
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'on a Debian osfamily' do
|
|
||||||
let :facts do
|
|
||||||
@default_facts.merge({
|
|
||||||
:operatingsystemrelease => '7.8',
|
|
||||||
:operatingsystem => 'Debian',
|
|
||||||
:osfamily => 'Debian',
|
|
||||||
:concat_basedir => '/var/lib/puppet/concat'
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
it_configures 'glance-dbsync'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,189 +2,196 @@ require 'spec_helper'
|
||||||
|
|
||||||
describe 'glance::keystone::auth' do
|
describe 'glance::keystone::auth' do
|
||||||
|
|
||||||
describe 'with defaults' do
|
shared_examples_for 'glance::keystone::auth' do
|
||||||
|
describe 'with defaults' do
|
||||||
|
|
||||||
|
let :params do
|
||||||
|
{:password => 'pass'}
|
||||||
|
end
|
||||||
|
|
||||||
|
it { is_expected.to contain_keystone_user('glance').with(
|
||||||
|
:ensure => 'present',
|
||||||
|
:password => 'pass'
|
||||||
|
)}
|
||||||
|
|
||||||
|
it { is_expected.to contain_keystone_user_role('glance@services').with(
|
||||||
|
:ensure => 'present',
|
||||||
|
:roles => ['admin']
|
||||||
|
) }
|
||||||
|
|
||||||
|
it { is_expected.to contain_keystone_service('Image Service::image').with(
|
||||||
|
:ensure => 'present',
|
||||||
|
:description => 'OpenStack Image Service'
|
||||||
|
) }
|
||||||
|
|
||||||
|
it { is_expected.to contain_keystone_endpoint('RegionOne/Image Service::image').with(
|
||||||
|
:ensure => 'present',
|
||||||
|
:public_url => 'http://127.0.0.1:9292',
|
||||||
|
:admin_url => 'http://127.0.0.1:9292',
|
||||||
|
:internal_url => 'http://127.0.0.1:9292'
|
||||||
|
)}
|
||||||
|
|
||||||
let :params do
|
|
||||||
{:password => 'pass'}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to contain_keystone_user('glance').with(
|
describe 'when auth_type, password, and service_type are overridden' do
|
||||||
:ensure => 'present',
|
|
||||||
:password => 'pass'
|
|
||||||
)}
|
|
||||||
|
|
||||||
it { is_expected.to contain_keystone_user_role('glance@services').with(
|
let :params do
|
||||||
:ensure => 'present',
|
{
|
||||||
:roles => ['admin']
|
:auth_name => 'glancey',
|
||||||
) }
|
:password => 'password',
|
||||||
|
:service_type => 'imagey'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
it { is_expected.to contain_keystone_service('Image Service::image').with(
|
it { is_expected.to contain_keystone_user('glancey').with(
|
||||||
:ensure => 'present',
|
:ensure => 'present',
|
||||||
:description => 'OpenStack Image Service'
|
:password => 'password'
|
||||||
) }
|
)}
|
||||||
|
|
||||||
it { is_expected.to contain_keystone_endpoint('RegionOne/Image Service::image').with(
|
it { is_expected.to contain_keystone_user_role('glancey@services').with(
|
||||||
:ensure => 'present',
|
:ensure => 'present',
|
||||||
:public_url => 'http://127.0.0.1:9292',
|
:roles => ['admin']
|
||||||
:admin_url => 'http://127.0.0.1:9292',
|
) }
|
||||||
:internal_url => 'http://127.0.0.1:9292'
|
|
||||||
)}
|
|
||||||
|
|
||||||
|
it { is_expected.to contain_keystone_service('Image Service::imagey').with(
|
||||||
|
:ensure => 'present',
|
||||||
|
:description => 'OpenStack Image Service'
|
||||||
|
) }
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'when overriding endpoint URLs' do
|
||||||
|
let :params do
|
||||||
|
{ :password => 'passw0rd',
|
||||||
|
:region => 'RegionTwo',
|
||||||
|
:public_url => 'https://10.10.10.10:81/v2',
|
||||||
|
:internal_url => 'https://10.10.10.11:81/v2',
|
||||||
|
:admin_url => 'https://10.10.10.12:81/v2' }
|
||||||
|
end
|
||||||
|
|
||||||
|
it { is_expected.to contain_keystone_endpoint('RegionTwo/Image Service::image').with(
|
||||||
|
:ensure => 'present',
|
||||||
|
:public_url => 'https://10.10.10.10:81/v2',
|
||||||
|
:internal_url => 'https://10.10.10.11:81/v2',
|
||||||
|
:admin_url => 'https://10.10.10.12:81/v2'
|
||||||
|
) }
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'with deprecated endpoints parameters' do
|
||||||
|
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:password => 'pass',
|
||||||
|
:public_address => '10.0.0.1',
|
||||||
|
:admin_address => '10.0.0.2',
|
||||||
|
:internal_address => '10.0.0.3',
|
||||||
|
:port => '9393',
|
||||||
|
:region => 'RegionTwo',
|
||||||
|
:public_protocol => 'https',
|
||||||
|
:admin_protocol => 'https',
|
||||||
|
:internal_protocol => 'https'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it { is_expected.to contain_keystone_endpoint('RegionTwo/Image Service::image').with(
|
||||||
|
:ensure => 'present',
|
||||||
|
:public_url => 'https://10.0.0.1:9393',
|
||||||
|
:admin_url => 'https://10.0.0.2:9393',
|
||||||
|
:internal_url => 'https://10.0.0.3:9393'
|
||||||
|
)}
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'when endpoint is not set' do
|
||||||
|
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:configure_endpoint => false,
|
||||||
|
:password => 'pass',
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it { is_expected.to_not contain_keystone_endpoint('RegionOne/Image Service::image') }
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'when disabling user configuration' do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:configure_user => false,
|
||||||
|
:password => 'pass',
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it { is_expected.to_not contain_keystone_user('glance') }
|
||||||
|
|
||||||
|
it { is_expected.to contain_keystone_user_role('glance@services') }
|
||||||
|
|
||||||
|
it { is_expected.to contain_keystone_service('Image Service::image').with(
|
||||||
|
:ensure => 'present',
|
||||||
|
:description => 'OpenStack Image Service'
|
||||||
|
) }
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'when disabling user and user role configuration' do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:configure_user => false,
|
||||||
|
:configure_user_role => false,
|
||||||
|
:password => 'pass',
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it { is_expected.to_not contain_keystone_user('glance') }
|
||||||
|
|
||||||
|
it { is_expected.to_not contain_keystone_user_role('glance@services') }
|
||||||
|
|
||||||
|
it { is_expected.to contain_keystone_service('Image Service::image').with(
|
||||||
|
:ensure => 'present',
|
||||||
|
:description => 'OpenStack Image Service'
|
||||||
|
) }
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'when configuring glance-api and the keystone endpoint' do
|
||||||
|
let :pre_condition do
|
||||||
|
"class { 'glance::api': keystone_password => 'test' }"
|
||||||
|
end
|
||||||
|
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:password => 'test',
|
||||||
|
:configure_endpoint => true
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it { is_expected.to contain_keystone_endpoint('RegionOne/Image Service::image').with_notify(["Service[glance-api]"]) }
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'when overriding service name' do
|
||||||
|
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:service_name => 'glance_service',
|
||||||
|
:password => 'pass'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it { is_expected.to contain_keystone_user('glance') }
|
||||||
|
it { is_expected.to contain_keystone_user_role('glance@services') }
|
||||||
|
it { is_expected.to contain_keystone_service('glance_service::image') }
|
||||||
|
it { is_expected.to contain_keystone_endpoint('RegionOne/glance_service::image') }
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'when auth_type, password, and service_type are overridden' do
|
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
|
||||||
|
|
||||||
let :params do
|
it_configures 'glance::keystone::auth'
|
||||||
{
|
|
||||||
:auth_name => 'glancey',
|
|
||||||
:password => 'password',
|
|
||||||
:service_type => 'imagey'
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to contain_keystone_user('glancey').with(
|
|
||||||
:ensure => 'present',
|
|
||||||
:password => 'password'
|
|
||||||
)}
|
|
||||||
|
|
||||||
it { is_expected.to contain_keystone_user_role('glancey@services').with(
|
|
||||||
:ensure => 'present',
|
|
||||||
:roles => ['admin']
|
|
||||||
) }
|
|
||||||
|
|
||||||
it { is_expected.to contain_keystone_service('Image Service::imagey').with(
|
|
||||||
:ensure => 'present',
|
|
||||||
:description => 'OpenStack Image Service'
|
|
||||||
) }
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'when overriding endpoint URLs' do
|
|
||||||
let :params do
|
|
||||||
{ :password => 'passw0rd',
|
|
||||||
:region => 'RegionTwo',
|
|
||||||
:public_url => 'https://10.10.10.10:81/v2',
|
|
||||||
:internal_url => 'https://10.10.10.11:81/v2',
|
|
||||||
:admin_url => 'https://10.10.10.12:81/v2' }
|
|
||||||
end
|
|
||||||
|
|
||||||
it { is_expected.to contain_keystone_endpoint('RegionTwo/Image Service::image').with(
|
|
||||||
:ensure => 'present',
|
|
||||||
:public_url => 'https://10.10.10.10:81/v2',
|
|
||||||
:internal_url => 'https://10.10.10.11:81/v2',
|
|
||||||
:admin_url => 'https://10.10.10.12:81/v2'
|
|
||||||
) }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'with deprecated endpoints parameters' do
|
|
||||||
|
|
||||||
let :params do
|
|
||||||
{
|
|
||||||
:password => 'pass',
|
|
||||||
:public_address => '10.0.0.1',
|
|
||||||
:admin_address => '10.0.0.2',
|
|
||||||
:internal_address => '10.0.0.3',
|
|
||||||
:port => '9393',
|
|
||||||
:region => 'RegionTwo',
|
|
||||||
:public_protocol => 'https',
|
|
||||||
:admin_protocol => 'https',
|
|
||||||
:internal_protocol => 'https'
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
it { is_expected.to contain_keystone_endpoint('RegionTwo/Image Service::image').with(
|
|
||||||
:ensure => 'present',
|
|
||||||
:public_url => 'https://10.0.0.1:9393',
|
|
||||||
:admin_url => 'https://10.0.0.2:9393',
|
|
||||||
:internal_url => 'https://10.0.0.3:9393'
|
|
||||||
)}
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'when endpoint is not set' do
|
|
||||||
|
|
||||||
let :params do
|
|
||||||
{
|
|
||||||
:configure_endpoint => false,
|
|
||||||
:password => 'pass',
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
it { is_expected.to_not contain_keystone_endpoint('RegionOne/Image Service::image') }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'when disabling user configuration' do
|
|
||||||
let :params do
|
|
||||||
{
|
|
||||||
:configure_user => false,
|
|
||||||
:password => 'pass',
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
it { is_expected.to_not contain_keystone_user('glance') }
|
|
||||||
|
|
||||||
it { is_expected.to contain_keystone_user_role('glance@services') }
|
|
||||||
|
|
||||||
it { is_expected.to contain_keystone_service('Image Service::image').with(
|
|
||||||
:ensure => 'present',
|
|
||||||
:description => 'OpenStack Image Service'
|
|
||||||
) }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'when disabling user and user role configuration' do
|
|
||||||
let :params do
|
|
||||||
{
|
|
||||||
:configure_user => false,
|
|
||||||
:configure_user_role => false,
|
|
||||||
:password => 'pass',
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
it { is_expected.to_not contain_keystone_user('glance') }
|
|
||||||
|
|
||||||
it { is_expected.to_not contain_keystone_user_role('glance@services') }
|
|
||||||
|
|
||||||
it { is_expected.to contain_keystone_service('Image Service::image').with(
|
|
||||||
:ensure => 'present',
|
|
||||||
:description => 'OpenStack Image Service'
|
|
||||||
) }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'when configuring glance-api and the keystone endpoint' do
|
|
||||||
let :pre_condition do
|
|
||||||
"class { 'glance::api': keystone_password => 'test' }"
|
|
||||||
end
|
|
||||||
|
|
||||||
let :facts do
|
|
||||||
@default_facts.merge({
|
|
||||||
:osfamily => 'Debian',
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
let :params do
|
|
||||||
{
|
|
||||||
:password => 'test',
|
|
||||||
:configure_endpoint => true
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
it { is_expected.to contain_keystone_endpoint('RegionOne/Image Service::image').with_notify(["Service[glance-api]"]) }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'when overriding service name' do
|
|
||||||
|
|
||||||
let :params do
|
|
||||||
{
|
|
||||||
:service_name => 'glance_service',
|
|
||||||
:password => 'pass'
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
it { is_expected.to contain_keystone_user('glance') }
|
|
||||||
it { is_expected.to contain_keystone_user_role('glance@services') }
|
|
||||||
it { is_expected.to contain_keystone_service('glance_service::image') }
|
|
||||||
it { is_expected.to contain_keystone_endpoint('RegionOne/glance_service::image') }
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,165 +1,175 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
describe 'glance::notify::rabbitmq' do
|
describe 'glance::notify::rabbitmq' do
|
||||||
let :facts do
|
|
||||||
@default_facts.merge({
|
|
||||||
:osfamily => 'Debian',
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
let :pre_condition do
|
shared_examples_for 'glance::notify::rabbitmq' do
|
||||||
'class { "glance::api": keystone_password => "pass" }'
|
let :pre_condition do
|
||||||
end
|
'class { "glance::api": keystone_password => "pass" }'
|
||||||
|
|
||||||
describe 'when defaults with rabbit pass specified' do
|
|
||||||
let :params do
|
|
||||||
{:rabbit_password => 'pass'}
|
|
||||||
end
|
end
|
||||||
it { is_expected.to contain_glance_api_config('DEFAULT/notification_driver').with_value('messaging') }
|
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_password').with_value('pass') }
|
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_password').with_value(params[:rabbit_password]).with_secret(true) }
|
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_userid').with_value('guest') }
|
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_host').with_value('localhost') }
|
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_port').with_value('5672') }
|
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_hosts').with_value('localhost:5672') }
|
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('false') }
|
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('false') }
|
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value('/') }
|
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_notification_exchange').with_value('glance') }
|
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_notification_topic').with_value('notifications') }
|
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('0') }
|
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/heartbeat_rate').with_value('2') }
|
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('<SERVICE DEFAULT>') }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'when passing params and use ssl' do
|
describe 'when defaults with rabbit pass specified' do
|
||||||
let :params do
|
let :params do
|
||||||
{
|
{:rabbit_password => 'pass'}
|
||||||
:rabbit_password => 'pass',
|
end
|
||||||
:rabbit_userid => 'guest2',
|
it { is_expected.to contain_glance_api_config('DEFAULT/notification_driver').with_value('messaging') }
|
||||||
:rabbit_host => 'localhost2',
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_password').with_value('pass') }
|
||||||
:rabbit_port => '5673',
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_password').with_value(params[:rabbit_password]).with_secret(true) }
|
||||||
:rabbit_use_ssl => true,
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_userid').with_value('guest') }
|
||||||
:rabbit_durable_queues => true,
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_host').with_value('localhost') }
|
||||||
:kombu_reconnect_delay => '5.0'
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_port').with_value('5672') }
|
||||||
}
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_hosts').with_value('localhost:5672') }
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_userid').with_value('guest2') }
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('false') }
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_host').with_value('localhost2') }
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('false') }
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_port').with_value('5673') }
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value('/') }
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('true') }
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_notification_exchange').with_value('glance') }
|
||||||
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_notification_topic').with_value('notifications') }
|
||||||
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('0') }
|
||||||
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/heartbeat_rate').with_value('2') }
|
||||||
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('<SERVICE DEFAULT>') }
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'when passing params and use ssl' do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:rabbit_password => 'pass',
|
||||||
|
:rabbit_userid => 'guest2',
|
||||||
|
:rabbit_host => 'localhost2',
|
||||||
|
:rabbit_port => '5673',
|
||||||
|
:rabbit_use_ssl => true,
|
||||||
|
:rabbit_durable_queues => true,
|
||||||
|
:kombu_reconnect_delay => '5.0'
|
||||||
|
}
|
||||||
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_userid').with_value('guest2') }
|
||||||
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_host').with_value('localhost2') }
|
||||||
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_port').with_value('5673') }
|
||||||
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('true') }
|
||||||
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_ensure('absent') }
|
||||||
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_ensure('absent') }
|
||||||
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_ensure('absent') }
|
||||||
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_version').with_value('TLSv1') }
|
||||||
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_durable_queues').with_value('true') }
|
||||||
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('5.0') }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'with rabbit ssl cert parameters' do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:rabbit_password => 'pass',
|
||||||
|
:rabbit_use_ssl => 'true',
|
||||||
|
:kombu_ssl_ca_certs => '/etc/ca.cert',
|
||||||
|
:kombu_ssl_certfile => '/etc/certfile',
|
||||||
|
:kombu_ssl_keyfile => '/etc/key',
|
||||||
|
:kombu_ssl_version => 'TLSv1',
|
||||||
|
}
|
||||||
|
end
|
||||||
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value(true) }
|
||||||
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_value('/etc/ca.cert') }
|
||||||
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_value('/etc/certfile') }
|
||||||
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_value('/etc/key') }
|
||||||
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_version').with_value('TLSv1') }
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'with rabbit ssl disabled' do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:rabbit_password => 'pass',
|
||||||
|
:rabbit_use_ssl => false,
|
||||||
|
:kombu_ssl_ca_certs => 'undef',
|
||||||
|
:kombu_ssl_certfile => 'undef',
|
||||||
|
:kombu_ssl_keyfile => 'undef',
|
||||||
|
:kombu_ssl_version => 'TLSv1',
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('false') }
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_ensure('absent') }
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_ensure('absent') }
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_ensure('absent') }
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_ensure('absent') }
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_ensure('absent') }
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_ensure('absent') }
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_version').with_value('TLSv1') }
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_version').with_ensure('absent') }
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_durable_queues').with_value('true') }
|
end
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('5.0') }
|
|
||||||
|
describe 'when passing params for single rabbit host' do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:rabbit_password => 'pass',
|
||||||
|
:rabbit_userid => 'guest2',
|
||||||
|
:rabbit_host => 'localhost2',
|
||||||
|
:rabbit_port => '5673',
|
||||||
|
:rabbit_use_ssl => true,
|
||||||
|
:rabbit_durable_queues => true,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_userid').with_value('guest2') }
|
||||||
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_host').with_value('localhost2') }
|
||||||
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_port').with_value('5673') }
|
||||||
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_hosts').with_value('localhost2:5673') }
|
||||||
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('true') }
|
||||||
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('true') }
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'when passing params for multiple rabbit hosts' do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:rabbit_password => 'pass',
|
||||||
|
:rabbit_userid => 'guest3',
|
||||||
|
:rabbit_hosts => ['nonlocalhost3:5673', 'nonlocalhost4:5673']
|
||||||
|
}
|
||||||
|
end
|
||||||
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_userid').with_value('guest3') }
|
||||||
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_hosts').with_value(
|
||||||
|
'nonlocalhost3:5673,nonlocalhost4:5673') }
|
||||||
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true') }
|
||||||
|
it { is_expected.to_not contain_glance_api_config('oslo_messaging_rabbit/rabbit_port') }
|
||||||
|
it { is_expected.to_not contain_glance_api_config('oslo_messaging_rabbit/rabbit_host') }
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'a single rabbit_host with enable ha queues' do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:rabbit_password => 'pass',
|
||||||
|
:rabbit_userid => 'guest3',
|
||||||
|
:rabbit_ha_queues => true,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should contain rabbit_ha_queues' do
|
||||||
|
is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'when passing params for rabbitmq heartbeat' do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:rabbit_password => 'pass',
|
||||||
|
:rabbit_heartbeat_timeout_threshold => '60',
|
||||||
|
:rabbit_heartbeat_rate => '10',
|
||||||
|
}
|
||||||
|
end
|
||||||
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('60') }
|
||||||
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/heartbeat_rate').with_value('10') }
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'when using deprecated params' do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:rabbit_durable_queues => true,
|
||||||
|
:rabbit_password => 'pass'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('true') }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'with rabbit ssl cert parameters' do
|
|
||||||
let :params do
|
|
||||||
{
|
|
||||||
:rabbit_password => 'pass',
|
|
||||||
:rabbit_use_ssl => 'true',
|
|
||||||
:kombu_ssl_ca_certs => '/etc/ca.cert',
|
|
||||||
:kombu_ssl_certfile => '/etc/certfile',
|
|
||||||
:kombu_ssl_keyfile => '/etc/key',
|
|
||||||
:kombu_ssl_version => 'TLSv1',
|
|
||||||
}
|
|
||||||
end
|
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value(true) }
|
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_value('/etc/ca.cert') }
|
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_value('/etc/certfile') }
|
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_value('/etc/key') }
|
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_version').with_value('TLSv1') }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'with rabbit ssl disabled' do
|
on_supported_os({
|
||||||
let :params do
|
:supported_os => OSDefaults.get_supported_os
|
||||||
{
|
}).each do |os,facts|
|
||||||
:rabbit_password => 'pass',
|
context "on #{os}" do
|
||||||
:rabbit_use_ssl => false,
|
let (:facts) do
|
||||||
:kombu_ssl_ca_certs => 'undef',
|
facts.merge!(OSDefaults.get_facts())
|
||||||
:kombu_ssl_certfile => 'undef',
|
end
|
||||||
:kombu_ssl_keyfile => 'undef',
|
|
||||||
:kombu_ssl_version => 'TLSv1',
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('false') }
|
it_configures 'glance::notify::rabbitmq'
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_ensure('absent') }
|
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_ensure('absent') }
|
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_ensure('absent') }
|
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_version').with_ensure('absent') }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'when passing params for single rabbit host' do
|
|
||||||
let :params do
|
|
||||||
{
|
|
||||||
:rabbit_password => 'pass',
|
|
||||||
:rabbit_userid => 'guest2',
|
|
||||||
:rabbit_host => 'localhost2',
|
|
||||||
:rabbit_port => '5673',
|
|
||||||
:rabbit_use_ssl => true,
|
|
||||||
:rabbit_durable_queues => true,
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_userid').with_value('guest2') }
|
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_host').with_value('localhost2') }
|
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_port').with_value('5673') }
|
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_hosts').with_value('localhost2:5673') }
|
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('true') }
|
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('true') }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'when passing params for multiple rabbit hosts' do
|
|
||||||
let :params do
|
|
||||||
{
|
|
||||||
:rabbit_password => 'pass',
|
|
||||||
:rabbit_userid => 'guest3',
|
|
||||||
:rabbit_hosts => ['nonlocalhost3:5673', 'nonlocalhost4:5673']
|
|
||||||
}
|
|
||||||
end
|
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_userid').with_value('guest3') }
|
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_hosts').with_value(
|
|
||||||
'nonlocalhost3:5673,nonlocalhost4:5673') }
|
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true') }
|
|
||||||
it { is_expected.to_not contain_glance_api_config('oslo_messaging_rabbit/rabbit_port') }
|
|
||||||
it { is_expected.to_not contain_glance_api_config('oslo_messaging_rabbit/rabbit_host') }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'a single rabbit_host with enable ha queues' do
|
|
||||||
let :params do
|
|
||||||
{
|
|
||||||
:rabbit_password => 'pass',
|
|
||||||
:rabbit_userid => 'guest3',
|
|
||||||
:rabbit_ha_queues => true,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'should contain rabbit_ha_queues' do
|
|
||||||
is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'when passing params for rabbitmq heartbeat' do
|
|
||||||
let :params do
|
|
||||||
{
|
|
||||||
:rabbit_password => 'pass',
|
|
||||||
:rabbit_heartbeat_timeout_threshold => '60',
|
|
||||||
:rabbit_heartbeat_rate => '10',
|
|
||||||
}
|
|
||||||
end
|
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('60') }
|
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/heartbeat_rate').with_value('10') }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'when using deprecated params' do
|
|
||||||
let :params do
|
|
||||||
{
|
|
||||||
:rabbit_durable_queues => true,
|
|
||||||
:rabbit_password => 'pass'
|
|
||||||
}
|
|
||||||
end
|
|
||||||
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('true') }
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -23,23 +23,15 @@ describe 'glance::policy' do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'on Debian platforms' do
|
on_supported_os({
|
||||||
let :facts do
|
:supported_os => OSDefaults.get_supported_os
|
||||||
@default_facts.merge({
|
}).each do |os,facts|
|
||||||
:osfamily => 'Debian',
|
context "on #{os}" do
|
||||||
})
|
let (:facts) do
|
||||||
|
facts.merge!(OSDefaults.get_facts())
|
||||||
|
end
|
||||||
|
|
||||||
|
it_configures 'glance policies'
|
||||||
end
|
end
|
||||||
|
|
||||||
it_configures 'glance policies'
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'on RedHat platforms' do
|
|
||||||
let :facts do
|
|
||||||
@default_facts.merge({
|
|
||||||
:osfamily => 'RedHat',
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
it_configures 'glance policies'
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -52,14 +52,8 @@ describe 'glance::registry::db' do
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'on Debian platforms' do
|
shared_examples_for 'glance::registry::db Debian' do
|
||||||
let :facts do
|
context 'using pymysql driver' do
|
||||||
@default_facts.merge({ :osfamily => 'Debian' })
|
|
||||||
end
|
|
||||||
|
|
||||||
it_configures 'glance::registry::db'
|
|
||||||
|
|
||||||
context 'using pymysql driver' do
|
|
||||||
let :params do
|
let :params do
|
||||||
{ :database_connection => 'mysql+pymysql://glance_registry:glance@localhost/glance', }
|
{ :database_connection => 'mysql+pymysql://glance_registry:glance@localhost/glance', }
|
||||||
end
|
end
|
||||||
|
@ -74,16 +68,7 @@ describe 'glance::registry::db' do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'on Redhat platforms' do
|
shared_examples_for 'glance::registry::db RedHat' do
|
||||||
let :facts do
|
|
||||||
@default_facts.merge({
|
|
||||||
:osfamily => 'RedHat',
|
|
||||||
:operatingsystemrelease => '7',
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
it_configures 'glance::registry::db'
|
|
||||||
|
|
||||||
context 'using pymysql driver' do
|
context 'using pymysql driver' do
|
||||||
let :params do
|
let :params do
|
||||||
{ :database_connection => 'mysql+pymysql://glance_registry:glance@localhost/glance', }
|
{ :database_connection => 'mysql+pymysql://glance_registry:glance@localhost/glance', }
|
||||||
|
@ -93,5 +78,19 @@ describe 'glance::registry::db' do
|
||||||
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())
|
||||||
|
end
|
||||||
|
|
||||||
|
it_configures 'glance::registry::db'
|
||||||
|
it_configures "glance::registry::db #{facts[:osfamily]}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -127,24 +127,15 @@ describe 'glance::registry::logging' do
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'on Debian platforms' do
|
on_supported_os({
|
||||||
let :facts do
|
:supported_os => OSDefaults.get_supported_os
|
||||||
@default_facts.merge({
|
}).each do |os,facts|
|
||||||
:osfamily => 'Debian',
|
context "on #{os}" do
|
||||||
})
|
let (:facts) do
|
||||||
|
facts.merge!(OSDefaults.get_facts())
|
||||||
|
end
|
||||||
|
|
||||||
|
it_configures 'glance-registry-logging'
|
||||||
end
|
end
|
||||||
|
|
||||||
it_configures 'glance-registry-logging'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'on RedHat platforms' do
|
|
||||||
let :facts do
|
|
||||||
@default_facts.merge({
|
|
||||||
:osfamily => 'RedHat',
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
it_configures 'glance-registry-logging'
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,13 +1,5 @@
|
||||||
|
|
||||||
describe 'glance::registry' do
|
describe 'glance::registry' do
|
||||||
|
|
||||||
let :facts do
|
|
||||||
@default_facts.merge({
|
|
||||||
:osfamily => 'Debian',
|
|
||||||
:processorcount => '7',
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
let :default_params do
|
let :default_params do
|
||||||
{
|
{
|
||||||
:verbose => false,
|
:verbose => false,
|
||||||
|
@ -35,178 +27,174 @@ describe 'glance::registry' do
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
[
|
shared_examples_for 'glance::registry' do
|
||||||
{:keystone_password => 'ChangeMe'},
|
[
|
||||||
{
|
{:keystone_password => 'ChangeMe'},
|
||||||
:bind_host => '127.0.0.1',
|
|
||||||
:bind_port => '9111',
|
|
||||||
:workers => '5',
|
|
||||||
:enabled => false,
|
|
||||||
:auth_type => 'keystone',
|
|
||||||
:auth_uri => 'http://127.0.0.1:5000/v2.0',
|
|
||||||
:identity_uri => 'http://127.0.0.1:35357/v2.0',
|
|
||||||
:keystone_tenant => 'admin',
|
|
||||||
:keystone_user => 'admin',
|
|
||||||
:keystone_password => 'ChangeMe',
|
|
||||||
:sync_db => false,
|
|
||||||
:os_region_name => 'RegionOne2',
|
|
||||||
:signing_dir => '/path/to/dir',
|
|
||||||
:token_cache_time => '300',
|
|
||||||
}
|
|
||||||
].each do |param_set|
|
|
||||||
|
|
||||||
describe "when #{param_set == {:keystone_password => 'ChangeMe'} ? "using default" : "specifying"} class parameters" do
|
|
||||||
let :param_hash do
|
|
||||||
default_params.merge(param_set)
|
|
||||||
end
|
|
||||||
|
|
||||||
let :params do
|
|
||||||
param_set
|
|
||||||
end
|
|
||||||
|
|
||||||
it { is_expected.to contain_class 'glance::registry' }
|
|
||||||
it { is_expected.to contain_class 'glance::registry::db' }
|
|
||||||
it { is_expected.to contain_class 'glance::registry::logging' }
|
|
||||||
|
|
||||||
it { is_expected.to contain_service('glance-registry').with(
|
|
||||||
'ensure' => (param_hash[:manage_service] && param_hash[:enabled]) ? 'running' : 'stopped',
|
|
||||||
'enable' => param_hash[:enabled],
|
|
||||||
'hasstatus' => true,
|
|
||||||
'hasrestart' => true,
|
|
||||||
'subscribe' => 'File[/etc/glance/glance-registry.conf]',
|
|
||||||
'require' => 'Class[Glance]',
|
|
||||||
'tag' => 'glance-service',
|
|
||||||
)}
|
|
||||||
|
|
||||||
it 'is_expected.to not sync the db if sync_db is set to false' do
|
|
||||||
|
|
||||||
if !param_hash[:sync_db]
|
|
||||||
is_expected.not_to contain_exec('glance-manage db_sync')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
it 'is_expected.to configure itself' do
|
|
||||||
[
|
|
||||||
'workers',
|
|
||||||
'bind_port',
|
|
||||||
'bind_host',
|
|
||||||
].each do |config|
|
|
||||||
is_expected.to contain_glance_registry_config("DEFAULT/#{config}").with_value(param_hash[config.intern])
|
|
||||||
end
|
|
||||||
[
|
|
||||||
'auth_uri',
|
|
||||||
'identity_uri'
|
|
||||||
].each do |config|
|
|
||||||
is_expected.to contain_glance_registry_config("keystone_authtoken/#{config}").with_value(param_hash[config.intern])
|
|
||||||
end
|
|
||||||
if param_hash[:auth_type] == 'keystone'
|
|
||||||
is_expected.to contain_glance_registry_config("paste_deploy/flavor").with_value('keystone')
|
|
||||||
is_expected.to contain_glance_registry_config('keystone_authtoken/memcached_servers').with_value(param_hash[:memcached_servers])
|
|
||||||
is_expected.to contain_glance_registry_config("keystone_authtoken/admin_tenant_name").with_value(param_hash[:keystone_tenant])
|
|
||||||
is_expected.to contain_glance_registry_config("keystone_authtoken/admin_user").with_value(param_hash[:keystone_user])
|
|
||||||
is_expected.to contain_glance_registry_config("keystone_authtoken/admin_password").with_value(param_hash[:keystone_password])
|
|
||||||
is_expected.to contain_glance_registry_config("keystone_authtoken/admin_password").with_value(param_hash[:keystone_password]).with_secret(true)
|
|
||||||
is_expected.to contain_glance_registry_config("keystone_authtoken/token_cache_time").with_value(param_hash[:token_cache_time])
|
|
||||||
is_expected.to contain_glance_registry_config("keystone_authtoken/signing_dir").with_value(param_hash[:signing_dir])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
it 'is_expected.to lay down default glance_store registry config' do
|
|
||||||
[
|
|
||||||
'os_region_name',
|
|
||||||
].each do |config|
|
|
||||||
is_expected.to contain_glance_registry_config("glance_store/#{config}").with_value(param_hash[config.intern])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'with disabled service managing' do
|
|
||||||
let :params do
|
|
||||||
{
|
{
|
||||||
:keystone_password => 'ChangeMe',
|
:bind_host => '127.0.0.1',
|
||||||
:manage_service => false,
|
:bind_port => '9111',
|
||||||
:enabled => false,
|
:workers => '5',
|
||||||
|
:enabled => false,
|
||||||
|
:auth_type => 'keystone',
|
||||||
|
:auth_uri => 'http://127.0.0.1:5000/v2.0',
|
||||||
|
:identity_uri => 'http://127.0.0.1:35357/v2.0',
|
||||||
|
:keystone_tenant => 'admin',
|
||||||
|
:keystone_user => 'admin',
|
||||||
|
:keystone_password => 'ChangeMe',
|
||||||
|
:sync_db => false,
|
||||||
|
:os_region_name => 'RegionOne2',
|
||||||
|
:signing_dir => '/path/to/dir',
|
||||||
|
:token_cache_time => '300',
|
||||||
}
|
}
|
||||||
|
].each do |param_set|
|
||||||
|
|
||||||
|
describe "when #{param_set == {:keystone_password => 'ChangeMe'} ? "using default" : "specifying"} class parameters" do
|
||||||
|
let :param_hash do
|
||||||
|
default_params.merge(param_set)
|
||||||
|
end
|
||||||
|
|
||||||
|
let :params do
|
||||||
|
param_set
|
||||||
|
end
|
||||||
|
|
||||||
|
it { is_expected.to contain_class 'glance::registry' }
|
||||||
|
it { is_expected.to contain_class 'glance::registry::db' }
|
||||||
|
it { is_expected.to contain_class 'glance::registry::logging' }
|
||||||
|
|
||||||
|
it { is_expected.to contain_service('glance-registry').with(
|
||||||
|
'ensure' => (param_hash[:manage_service] && param_hash[:enabled]) ? 'running' : 'stopped',
|
||||||
|
'enable' => param_hash[:enabled],
|
||||||
|
'hasstatus' => true,
|
||||||
|
'hasrestart' => true,
|
||||||
|
'subscribe' => 'File[/etc/glance/glance-registry.conf]',
|
||||||
|
'require' => 'Class[Glance]',
|
||||||
|
'tag' => 'glance-service',
|
||||||
|
)}
|
||||||
|
|
||||||
|
it 'is_expected.to not sync the db if sync_db is set to false' do
|
||||||
|
|
||||||
|
if !param_hash[:sync_db]
|
||||||
|
is_expected.not_to contain_exec('glance-manage db_sync')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
it 'is_expected.to configure itself' do
|
||||||
|
[
|
||||||
|
'workers',
|
||||||
|
'bind_port',
|
||||||
|
'bind_host',
|
||||||
|
].each do |config|
|
||||||
|
is_expected.to contain_glance_registry_config("DEFAULT/#{config}").with_value(param_hash[config.intern])
|
||||||
|
end
|
||||||
|
[
|
||||||
|
'auth_uri',
|
||||||
|
'identity_uri'
|
||||||
|
].each do |config|
|
||||||
|
is_expected.to contain_glance_registry_config("keystone_authtoken/#{config}").with_value(param_hash[config.intern])
|
||||||
|
end
|
||||||
|
if param_hash[:auth_type] == 'keystone'
|
||||||
|
is_expected.to contain_glance_registry_config("paste_deploy/flavor").with_value('keystone')
|
||||||
|
is_expected.to contain_glance_registry_config('keystone_authtoken/memcached_servers').with_value(param_hash[:memcached_servers])
|
||||||
|
is_expected.to contain_glance_registry_config("keystone_authtoken/admin_tenant_name").with_value(param_hash[:keystone_tenant])
|
||||||
|
is_expected.to contain_glance_registry_config("keystone_authtoken/admin_user").with_value(param_hash[:keystone_user])
|
||||||
|
is_expected.to contain_glance_registry_config("keystone_authtoken/admin_password").with_value(param_hash[:keystone_password])
|
||||||
|
is_expected.to contain_glance_registry_config("keystone_authtoken/admin_password").with_value(param_hash[:keystone_password]).with_secret(true)
|
||||||
|
is_expected.to contain_glance_registry_config("keystone_authtoken/token_cache_time").with_value(param_hash[:token_cache_time])
|
||||||
|
is_expected.to contain_glance_registry_config("keystone_authtoken/signing_dir").with_value(param_hash[:signing_dir])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
it 'is_expected.to lay down default glance_store registry config' do
|
||||||
|
[
|
||||||
|
'os_region_name',
|
||||||
|
].each do |config|
|
||||||
|
is_expected.to contain_glance_registry_config("glance_store/#{config}").with_value(param_hash[config.intern])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to contain_service('glance-registry').with(
|
describe 'with disabled service managing' do
|
||||||
'ensure' => nil,
|
|
||||||
'enable' => false,
|
|
||||||
'hasstatus' => true,
|
|
||||||
'hasrestart' => true,
|
|
||||||
'subscribe' => 'File[/etc/glance/glance-registry.conf]',
|
|
||||||
'require' => 'Class[Glance]',
|
|
||||||
'tag' => 'glance-service',
|
|
||||||
)}
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'with overridden pipeline' do
|
|
||||||
# At the time of writing there was only blank and keystone as options
|
|
||||||
# but there is no reason that there can't be more options in the future.
|
|
||||||
let :params do
|
|
||||||
{
|
|
||||||
:keystone_password => 'ChangeMe',
|
|
||||||
:pipeline => 'validoptionstring',
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
it { is_expected.to contain_glance_registry_config('paste_deploy/flavor').with_value('validoptionstring') }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'with blank pipeline' do
|
|
||||||
let :params do
|
|
||||||
{
|
|
||||||
:keystone_password => 'ChangeMe',
|
|
||||||
:pipeline => '',
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
it { is_expected.to contain_glance_registry_config('paste_deploy/flavor').with_ensure('absent') }
|
|
||||||
end
|
|
||||||
|
|
||||||
[
|
|
||||||
'keystone/',
|
|
||||||
'keystone+',
|
|
||||||
'+keystone',
|
|
||||||
'keystone+cachemanagement+',
|
|
||||||
'+'
|
|
||||||
].each do |pipeline|
|
|
||||||
describe "with pipeline incorrect value #{pipeline}" do
|
|
||||||
let :params do
|
let :params do
|
||||||
{
|
{
|
||||||
:keystone_password => 'ChangeMe',
|
:keystone_password => 'ChangeMe',
|
||||||
:auth_type => 'keystone',
|
:manage_service => false,
|
||||||
:pipeline => pipeline
|
:enabled => false,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect { is_expected.to contain_glance_registry_config('filter:paste_deploy/flavor') }.to\
|
it { is_expected.to contain_service('glance-registry').with(
|
||||||
raise_error(Puppet::Error, /validate_re\(\): .* does not match/) }
|
'ensure' => nil,
|
||||||
|
'enable' => false,
|
||||||
|
'hasstatus' => true,
|
||||||
|
'hasrestart' => true,
|
||||||
|
'subscribe' => 'File[/etc/glance/glance-registry.conf]',
|
||||||
|
'require' => 'Class[Glance]',
|
||||||
|
'tag' => 'glance-service',
|
||||||
|
)}
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'with overridden pipeline' do
|
||||||
|
# At the time of writing there was only blank and keystone as options
|
||||||
|
# but there is no reason that there can't be more options in the future.
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:keystone_password => 'ChangeMe',
|
||||||
|
:pipeline => 'validoptionstring',
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it { is_expected.to contain_glance_registry_config('paste_deploy/flavor').with_value('validoptionstring') }
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'with blank pipeline' do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:keystone_password => 'ChangeMe',
|
||||||
|
:pipeline => '',
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it { is_expected.to contain_glance_registry_config('paste_deploy/flavor').with_ensure('absent') }
|
||||||
|
end
|
||||||
|
|
||||||
|
[
|
||||||
|
'keystone/',
|
||||||
|
'keystone+',
|
||||||
|
'+keystone',
|
||||||
|
'keystone+cachemanagement+',
|
||||||
|
'+'
|
||||||
|
].each do |pipeline|
|
||||||
|
describe "with pipeline incorrect value #{pipeline}" do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:keystone_password => 'ChangeMe',
|
||||||
|
:auth_type => 'keystone',
|
||||||
|
:pipeline => pipeline
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it { expect { is_expected.to contain_glance_registry_config('filter:paste_deploy/flavor') }.to\
|
||||||
|
raise_error(Puppet::Error, /validate_re\(\): .* does not match/) }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'with ssl options' do
|
||||||
|
let :params do
|
||||||
|
default_params.merge({
|
||||||
|
:ca_file => '/tmp/ca_file',
|
||||||
|
:cert_file => '/tmp/cert_file',
|
||||||
|
:key_file => '/tmp/key_file'
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with ssl options' do
|
||||||
|
it { is_expected.to contain_glance_registry_config('DEFAULT/ca_file').with_value('/tmp/ca_file') }
|
||||||
|
it { is_expected.to contain_glance_registry_config('DEFAULT/cert_file').with_value('/tmp/cert_file') }
|
||||||
|
it { is_expected.to contain_glance_registry_config('DEFAULT/key_file').with_value('/tmp/key_file') }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'with ssl options' do
|
shared_examples_for 'glance::registry Debian' do
|
||||||
let :params do
|
|
||||||
default_params.merge({
|
|
||||||
:ca_file => '/tmp/ca_file',
|
|
||||||
:cert_file => '/tmp/cert_file',
|
|
||||||
:key_file => '/tmp/key_file'
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'with ssl options' do
|
|
||||||
it { is_expected.to contain_glance_registry_config('DEFAULT/ca_file').with_value('/tmp/ca_file') }
|
|
||||||
it { is_expected.to contain_glance_registry_config('DEFAULT/cert_file').with_value('/tmp/cert_file') }
|
|
||||||
it { is_expected.to contain_glance_registry_config('DEFAULT/key_file').with_value('/tmp/key_file') }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'on Debian platforms' do
|
|
||||||
let :facts do
|
|
||||||
@default_facts.merge({
|
|
||||||
:osfamily => 'Debian',
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
# We only test this on Debian platforms, since on RedHat there isn't a
|
# We only test this on Debian platforms, since on RedHat there isn't a
|
||||||
# separate package for glance registry.
|
# separate package for glance registry.
|
||||||
['present', 'latest'].each do |package_ensure|
|
['present', 'latest'].each do |package_ensure|
|
||||||
|
@ -220,18 +208,25 @@ describe 'glance::registry' do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'on RedHat platforms' do
|
shared_examples_for 'glance::registry RedHat' do
|
||||||
let :facts do
|
|
||||||
@default_facts.merge({
|
|
||||||
:osfamily => 'RedHat',
|
|
||||||
:operatingsystemrelease => '7',
|
|
||||||
})
|
|
||||||
end
|
|
||||||
let(:params) { default_params }
|
let(:params) { default_params }
|
||||||
|
|
||||||
it { is_expected.to contain_package('openstack-glance') }
|
it { is_expected.to contain_package('openstack-glance') }
|
||||||
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_configures 'glance::registry'
|
||||||
|
it_configures "glance::registry #{facts[:osfamily]}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe 'on unknown platforms' do
|
describe 'on unknown platforms' do
|
||||||
let :facts do
|
let :facts do
|
||||||
{ :osfamily => 'unknown' }
|
{ :osfamily => 'unknown' }
|
||||||
|
|
|
@ -2,28 +2,13 @@ require 'spec_helper'
|
||||||
|
|
||||||
describe 'glance' do
|
describe 'glance' do
|
||||||
|
|
||||||
let :facts do
|
|
||||||
@default_facts.merge({
|
|
||||||
:osfamily => 'Debian',
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
let :default_params do
|
let :default_params do
|
||||||
{}
|
{}
|
||||||
end
|
end
|
||||||
|
|
||||||
[
|
shared_examples_for 'glance' do
|
||||||
{},
|
describe "when using default class parameters" do
|
||||||
{}
|
let(:params) { default_params }
|
||||||
].each do |param_set|
|
|
||||||
|
|
||||||
describe "when #{param_set == {} ? "using default" : "specifying"} class parameters" do
|
|
||||||
|
|
||||||
let :param_hash do
|
|
||||||
param_set == {} ? default_params : params
|
|
||||||
end
|
|
||||||
|
|
||||||
let :params do param_set end
|
|
||||||
|
|
||||||
it { is_expected.to contain_file('/etc/glance/').with(
|
it { is_expected.to contain_file('/etc/glance/').with(
|
||||||
'ensure' => 'directory',
|
'ensure' => 'directory',
|
||||||
|
@ -38,24 +23,13 @@ describe 'glance' do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'on Debian platforms' do
|
shared_examples_for 'glance Debian' do
|
||||||
let :facts do
|
|
||||||
@default_facts.merge({
|
|
||||||
:osfamily => 'Debian',
|
|
||||||
})
|
|
||||||
end
|
|
||||||
let(:params) { default_params }
|
let(:params) { default_params }
|
||||||
|
|
||||||
it { is_expected.to_not contain_package('glance') }
|
it { is_expected.to_not contain_package('glance') }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'on RedHat platforms' do
|
shared_examples_for 'glance RedHat' do
|
||||||
let :facts do
|
|
||||||
@default_facts.merge({
|
|
||||||
:osfamily => 'RedHat',
|
|
||||||
:operatingsystemrelease => '7',
|
|
||||||
})
|
|
||||||
end
|
|
||||||
let(:params) { default_params }
|
let(:params) { default_params }
|
||||||
|
|
||||||
it { is_expected.to contain_package('openstack-glance').with(
|
it { is_expected.to contain_package('openstack-glance').with(
|
||||||
|
@ -63,4 +37,16 @@ describe 'glance' do
|
||||||
)}
|
)}
|
||||||
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_configures 'glance'
|
||||||
|
it_configures "glance #{facts[:osfamily]}"
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue