2012-01-02 15:01:50 -08:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'glance::api' do
|
|
|
|
|
2012-03-19 22:57:23 -07:00
|
|
|
let :facts do
|
2015-10-21 12:54:54 +03:00
|
|
|
@default_facts.merge({
|
|
|
|
:osfamily => 'Debian',
|
|
|
|
:processorcount => '7',
|
|
|
|
})
|
2012-03-19 22:57:23 -07:00
|
|
|
end
|
|
|
|
|
2012-01-02 15:01:50 -08:00
|
|
|
let :default_params do
|
|
|
|
{
|
2014-06-17 11:59:39 +08:00
|
|
|
:verbose => false,
|
|
|
|
:debug => false,
|
2015-08-07 15:44:19 +03:00
|
|
|
:use_stderr => true,
|
2014-06-17 11:59:39 +08:00
|
|
|
:bind_host => '0.0.0.0',
|
|
|
|
:bind_port => '9292',
|
|
|
|
:registry_host => '0.0.0.0',
|
|
|
|
:registry_port => '9191',
|
|
|
|
:registry_client_protocol => 'http',
|
|
|
|
:log_file => '/var/log/glance/api.log',
|
|
|
|
:log_dir => '/var/log/glance',
|
|
|
|
:auth_type => 'keystone',
|
2015-12-23 23:06:15 +01:00
|
|
|
:auth_region => '<SERVICE DEFAULT>',
|
2014-06-17 11:59:39 +08:00
|
|
|
:enabled => true,
|
2014-08-25 15:15:55 +02:00
|
|
|
:manage_service => true,
|
2014-06-17 11:59:39 +08:00
|
|
|
:backlog => '4096',
|
|
|
|
:workers => '7',
|
|
|
|
:auth_host => '127.0.0.1',
|
|
|
|
:auth_port => '35357',
|
|
|
|
:auth_protocol => 'http',
|
|
|
|
:keystone_tenant => 'services',
|
|
|
|
:keystone_user => 'glance',
|
|
|
|
:keystone_password => 'ChangeMe',
|
2015-10-19 18:07:43 +03:00
|
|
|
:token_cache_time => '<SERVICE DEFAULT>',
|
2014-06-17 11:59:39 +08:00
|
|
|
:show_image_direct_url => false,
|
2015-12-21 17:28:43 +11:00
|
|
|
:show_multiple_locations => '<SERVICE DEFAULT>',
|
|
|
|
:location_strategy => '<SERVICE DEFAULT>',
|
2014-06-17 11:59:39 +08:00
|
|
|
:purge_config => false,
|
|
|
|
:known_stores => false,
|
2015-10-19 18:07:43 +03:00
|
|
|
:delayed_delete => '<SERVICE DEFAULT>',
|
|
|
|
:scrub_time => '<SERVICE DEFAULT>',
|
2014-06-17 11:59:39 +08:00
|
|
|
:image_cache_dir => '/var/lib/glance/image-cache',
|
2015-10-19 18:07:43 +03:00
|
|
|
:image_cache_stall_time => '<SERVICE DEFAULT>',
|
|
|
|
:image_cache_max_size => '<SERVICE DEFAULT>',
|
2014-10-26 14:46:17 -07:00
|
|
|
:os_region_name => 'RegionOne',
|
2015-10-19 18:07:43 +03:00
|
|
|
:signing_dir => '<SERVICE DEFAULT>',
|
2015-03-11 10:44:17 -04:00
|
|
|
:pipeline => 'keystone',
|
2012-01-02 15:01:50 -08:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2012-10-14 12:36:13 -07:00
|
|
|
[{:keystone_password => 'ChangeMe'},
|
2012-01-02 15:01:50 -08:00
|
|
|
{
|
2014-06-17 11:59:39 +08:00
|
|
|
:verbose => true,
|
|
|
|
:debug => true,
|
|
|
|
:bind_host => '127.0.0.1',
|
|
|
|
:bind_port => '9222',
|
|
|
|
:registry_host => '127.0.0.1',
|
|
|
|
:registry_port => '9111',
|
|
|
|
:registry_client_protocol => 'https',
|
|
|
|
:auth_type => 'not_keystone',
|
2015-10-19 18:07:43 +03:00
|
|
|
:auth_region => 'RegionOne2',
|
2014-06-17 11:59:39 +08:00
|
|
|
:enabled => false,
|
|
|
|
:backlog => '4095',
|
|
|
|
:workers => '5',
|
|
|
|
:auth_host => '127.0.0.2',
|
|
|
|
:auth_port => '35358',
|
|
|
|
:auth_protocol => 'https',
|
|
|
|
:keystone_tenant => 'admin2',
|
|
|
|
:keystone_user => 'admin2',
|
|
|
|
:keystone_password => 'ChangeMe2',
|
2015-10-19 18:07:43 +03:00
|
|
|
:token_cache_time => '300',
|
2014-06-17 11:59:39 +08:00
|
|
|
:show_image_direct_url => true,
|
2015-12-21 17:28:43 +11:00
|
|
|
:show_multiple_locations => true,
|
|
|
|
:location_strategy => 'store_type',
|
2015-10-19 18:07:43 +03:00
|
|
|
:delayed_delete => 'true',
|
|
|
|
:scrub_time => '10',
|
2014-10-26 14:46:17 -07:00
|
|
|
:image_cache_dir => '/tmp/glance',
|
2015-10-19 18:07:43 +03:00
|
|
|
:image_cache_stall_time => '10',
|
|
|
|
:image_cache_max_size => '10737418240',
|
2014-10-26 14:46:17 -07:00
|
|
|
:os_region_name => 'RegionOne2',
|
2015-10-19 18:07:43 +03:00
|
|
|
:signing_dir => '/path/to/dir',
|
2015-03-11 10:44:17 -04:00
|
|
|
:pipeline => 'keystone2',
|
2012-01-02 15:01:50 -08:00
|
|
|
}
|
|
|
|
].each do |param_set|
|
|
|
|
|
2012-10-14 12:36:13 -07:00
|
|
|
describe "when #{param_set == {:keystone_password => 'ChangeMe'} ? "using default" : "specifying"} class parameters" do
|
2012-03-13 15:09:58 -07:00
|
|
|
|
2012-01-02 15:01:50 -08:00
|
|
|
let :param_hash do
|
2012-03-13 15:09:58 -07:00
|
|
|
default_params.merge(param_set)
|
2012-01-02 15:01:50 -08:00
|
|
|
end
|
|
|
|
|
|
|
|
let :params do
|
|
|
|
param_set
|
|
|
|
end
|
|
|
|
|
2015-02-25 05:37:44 +01:00
|
|
|
it { is_expected.to contain_class 'glance' }
|
|
|
|
it { is_expected.to contain_class 'glance::policy' }
|
2015-09-25 12:33:51 +02:00
|
|
|
it { is_expected.to contain_class 'glance::api::logging' }
|
2015-10-21 13:07:42 +03:00
|
|
|
it { is_expected.to contain_class 'glance::api::db' }
|
2012-01-02 15:01:50 -08:00
|
|
|
|
2015-02-25 05:37:44 +01:00
|
|
|
it { is_expected.to contain_service('glance-api').with(
|
2014-08-25 15:15:55 +02:00
|
|
|
'ensure' => (param_hash[:manage_service] && param_hash[:enabled]) ? 'running': 'stopped',
|
2012-06-18 10:14:53 -07:00
|
|
|
'enable' => param_hash[:enabled],
|
2013-05-09 23:12:33 -04:00
|
|
|
'hasstatus' => true,
|
2015-07-22 10:14:50 +02:00
|
|
|
'hasrestart' => true,
|
|
|
|
'tag' => 'glance-service',
|
2012-03-31 16:09:29 -07:00
|
|
|
) }
|
2012-01-02 15:01:50 -08:00
|
|
|
|
2015-02-25 05:37:44 +01:00
|
|
|
it { is_expected.to_not contain_exec('validate_nova_api') }
|
2015-03-11 10:44:17 -04:00
|
|
|
it { is_expected.to contain_glance_api_config("paste_deploy/flavor").with_value(param_hash[:pipeline]) }
|
2014-11-21 11:25:31 -05:00
|
|
|
|
2015-02-25 05:37:44 +01:00
|
|
|
it 'is_expected.to lay down default api config' do
|
2012-10-14 00:23:20 -07:00
|
|
|
[
|
2015-08-07 15:44:19 +03:00
|
|
|
'use_stderr',
|
2012-10-14 00:23:20 -07:00
|
|
|
'bind_host',
|
|
|
|
'bind_port',
|
|
|
|
'registry_host',
|
2014-01-28 19:28:46 +01:00
|
|
|
'registry_port',
|
2014-06-17 11:59:39 +08:00
|
|
|
'registry_client_protocol',
|
2014-10-26 14:46:17 -07:00
|
|
|
'show_image_direct_url',
|
2015-12-21 17:28:43 +11:00
|
|
|
'show_multiple_locations',
|
|
|
|
'location_strategy',
|
2015-10-19 18:07:43 +03:00
|
|
|
'delayed_delete',
|
|
|
|
'scrub_time',
|
|
|
|
'image_cache_dir',
|
|
|
|
'auth_region'
|
2012-10-14 00:23:20 -07:00
|
|
|
].each do |config|
|
2015-02-25 05:37:44 +01:00
|
|
|
is_expected.to contain_glance_api_config("DEFAULT/#{config}").with_value(param_hash[config.intern])
|
2012-10-14 00:23:20 -07:00
|
|
|
end
|
2012-03-31 16:09:29 -07:00
|
|
|
end
|
|
|
|
|
2015-02-25 05:37:44 +01:00
|
|
|
it 'is_expected.to lay down default cache config' do
|
2012-10-14 00:23:20 -07:00
|
|
|
[
|
|
|
|
'registry_host',
|
2014-10-26 14:46:17 -07:00
|
|
|
'registry_port',
|
2015-10-19 18:07:43 +03:00
|
|
|
'image_cache_stall_time',
|
|
|
|
'image_cache_max_size',
|
2015-04-01 07:06:19 -07:00
|
|
|
].each do |config|
|
2015-04-17 17:13:52 +00:00
|
|
|
is_expected.to contain_glance_cache_config("DEFAULT/#{config}").with_value(param_hash[config.intern])
|
2015-04-01 07:06:19 -07:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-04-17 10:14:14 -07:00
|
|
|
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
|
|
|
|
|
2015-02-25 05:37:44 +01:00
|
|
|
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')
|
2014-03-07 10:09:41 +01:00
|
|
|
end
|
|
|
|
|
2015-02-25 05:37:44 +01:00
|
|
|
it 'is_expected.to lay down default auth config' do
|
2012-10-14 00:23:20 -07:00
|
|
|
[
|
|
|
|
'auth_host',
|
|
|
|
'auth_port',
|
2013-06-13 19:38:16 -04:00
|
|
|
'auth_protocol'
|
2012-10-14 00:23:20 -07:00
|
|
|
].each do |config|
|
2015-02-25 05:37:44 +01:00
|
|
|
is_expected.to contain_glance_api_config("keystone_authtoken/#{config}").with_value(param_hash[config.intern])
|
2012-10-14 00:23:20 -07:00
|
|
|
end
|
|
|
|
end
|
2015-02-25 05:37:44 +01:00
|
|
|
it { is_expected.to contain_glance_api_config('keystone_authtoken/auth_admin_prefix').with_ensure('absent') }
|
2012-10-14 00:23:20 -07:00
|
|
|
|
2015-02-25 05:37:44 +01:00
|
|
|
it 'is_expected.to configure itself for keystone if that is the auth_type' do
|
2012-10-14 00:23:20 -07:00
|
|
|
if params[:auth_type] == 'keystone'
|
2015-02-25 05:37:44 +01:00
|
|
|
is_expected.to contain('paste_deploy/flavor').with_value('keystone+cachemanagement')
|
2014-06-11 10:36:39 +02:00
|
|
|
|
2015-10-19 18:07:43 +03:00
|
|
|
['admin_tenant_name', 'admin_user', 'admin_password', 'token_cache_time', 'signing_dir'].each do |config|
|
2015-02-25 05:37:44 +01:00
|
|
|
is_expected.to contain_glance_api_config("keystone_authtoken/#{config}").with_value(param_hash[config.intern])
|
2012-10-14 00:23:20 -07:00
|
|
|
end
|
2015-02-25 05:37:44 +01:00
|
|
|
is_expected.to contain_glance_api_config('keystone_authtoken/admin_password').with_value(param_hash[:keystone_password]).with_secret(true)
|
2014-06-11 10:36:39 +02:00
|
|
|
|
2012-10-31 10:39:12 -07:00
|
|
|
['admin_tenant_name', 'admin_user', 'admin_password'].each do |config|
|
2015-02-25 05:37:44 +01:00
|
|
|
is_expected.to contain_glance_cache_config("keystone_authtoken/#{config}").with_value(param_hash[config.intern])
|
2012-10-14 00:23:20 -07:00
|
|
|
end
|
2015-02-25 05:37:44 +01:00
|
|
|
is_expected.to contain_glance_cache_config('keystone_authtoken/admin_password').with_value(param_hash[:keystone_password]).with_secret(true)
|
2012-10-14 00:23:20 -07:00
|
|
|
end
|
2012-08-21 12:39:23 -07:00
|
|
|
end
|
2012-01-02 15:01:50 -08:00
|
|
|
end
|
2014-11-21 11:25:31 -05:00
|
|
|
|
2012-01-02 15:01:50 -08:00
|
|
|
end
|
2013-04-26 05:48:39 -04:00
|
|
|
|
2014-08-25 15:15:55 +02:00
|
|
|
describe 'with disabled service managing' do
|
|
|
|
let :params do
|
|
|
|
{
|
|
|
|
:keystone_password => 'ChangeMe',
|
|
|
|
:manage_service => false,
|
|
|
|
:enabled => false,
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2015-02-25 05:37:44 +01:00
|
|
|
it { is_expected.to contain_service('glance-api').with(
|
2014-08-25 15:15:55 +02:00
|
|
|
'ensure' => nil,
|
|
|
|
'enable' => false,
|
|
|
|
'hasstatus' => true,
|
2015-07-22 10:14:50 +02:00
|
|
|
'hasrestart' => true,
|
|
|
|
'tag' => 'glance-service',
|
2014-08-25 15:15:55 +02:00
|
|
|
) }
|
|
|
|
end
|
|
|
|
|
2013-04-26 05:48:39 -04:00
|
|
|
describe 'with overridden pipeline' do
|
|
|
|
let :params do
|
|
|
|
{
|
|
|
|
:keystone_password => 'ChangeMe',
|
2015-03-11 10:44:17 -04:00
|
|
|
:pipeline => 'something',
|
2013-04-26 05:48:39 -04:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2015-03-11 10:44:17 -04:00
|
|
|
it { is_expected.to contain_glance_api_config('paste_deploy/flavor').with_value('something') }
|
2013-04-26 05:48:39 -04:00
|
|
|
end
|
|
|
|
|
2013-06-17 01:07:28 +00:00
|
|
|
describe 'with blank pipeline' do
|
|
|
|
let :params do
|
|
|
|
{
|
|
|
|
:keystone_password => 'ChangeMe',
|
|
|
|
:pipeline => '',
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2015-02-25 05:37:44 +01:00
|
|
|
it { is_expected.to contain_glance_api_config('paste_deploy/flavor').with_ensure('absent') }
|
2013-06-17 01:07:28 +00:00
|
|
|
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
|
|
|
|
|
2015-02-25 05:37:44 +01:00
|
|
|
it { expect { is_expected.to contain_glance_api_config('filter:paste_deploy/flavor') }.to\
|
2013-06-17 01:07:28 +00:00
|
|
|
raise_error(Puppet::Error, /validate_re\(\): .* does not match/) }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-06-11 11:28:53 +02:00
|
|
|
describe 'with overriden auth_admin_prefix' do
|
|
|
|
let :params do
|
|
|
|
{
|
|
|
|
:keystone_password => 'ChangeMe',
|
|
|
|
:auth_admin_prefix => '/keystone/main'
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2015-02-25 05:37:44 +01:00
|
|
|
it { is_expected.to contain_glance_api_config('keystone_authtoken/auth_admin_prefix').with_value('/keystone/main') }
|
2013-06-11 11:28:53 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
[
|
|
|
|
'/keystone/',
|
|
|
|
'keystone/',
|
|
|
|
'keystone',
|
|
|
|
'/keystone/admin/',
|
|
|
|
'keystone/admin/',
|
|
|
|
'keystone/admin'
|
|
|
|
].each do |auth_admin_prefix|
|
|
|
|
describe "with auth_admin_prefix_containing incorrect value #{auth_admin_prefix}" do
|
|
|
|
let :params do
|
|
|
|
{
|
|
|
|
:keystone_password => 'ChangeMe',
|
|
|
|
:auth_admin_prefix => auth_admin_prefix
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2015-02-25 05:37:44 +01:00
|
|
|
it { expect { is_expected.to contain_glance_api_config('filter:authtoken/auth_admin_prefix') }.to\
|
2013-06-11 11:28:53 +02:00
|
|
|
raise_error(Puppet::Error, /validate_re\(\): "#{auth_admin_prefix}" does not match/) }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-03-07 10:09:41 +01:00
|
|
|
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
|
2014-02-20 13:31:58 +01:00
|
|
|
|
2014-03-07 10:09:41 +01:00
|
|
|
context 'with ssl options' do
|
2015-02-25 05:37:44 +01:00
|
|
|
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') }
|
2014-03-07 10:09:41 +01:00
|
|
|
end
|
|
|
|
end
|
2013-12-10 13:56:34 +08:00
|
|
|
describe 'with known_stores by default' do
|
|
|
|
let :params do
|
|
|
|
default_params
|
|
|
|
end
|
|
|
|
|
2015-02-25 05:37:44 +01:00
|
|
|
it { is_expected.to_not contain_glance_api_config('glance_store/stores').with_value('false') }
|
2013-12-10 13:56:34 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
describe 'with known_stores override' do
|
|
|
|
let :params do
|
|
|
|
default_params.merge({
|
|
|
|
:known_stores => ['glance.store.filesystem.Store','glance.store.http.Store'],
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
2015-02-25 05:37:44 +01:00
|
|
|
it { is_expected.to contain_glance_api_config('glance_store/stores').with_value("glance.store.filesystem.Store,glance.store.http.Store") }
|
2013-12-10 13:56:34 +08:00
|
|
|
end
|
2014-04-01 15:59:29 +02:00
|
|
|
|
2014-11-21 11:25:31 -05:00
|
|
|
describe 'while validating the service with default command' do
|
|
|
|
let :params do
|
|
|
|
default_params.merge({
|
|
|
|
:validate => true,
|
|
|
|
})
|
|
|
|
end
|
2015-02-25 05:37:44 +01:00
|
|
|
it { is_expected.to contain_exec('execute glance-api validation').with(
|
2014-11-21 11:25:31 -05:00
|
|
|
:path => '/usr/bin:/bin:/usr/sbin:/sbin',
|
|
|
|
:provider => 'shell',
|
|
|
|
:tries => '10',
|
|
|
|
:try_sleep => '2',
|
|
|
|
:command => 'glance --os-auth-url http://localhost:5000/v2.0 --os-tenant-name services --os-username glance --os-password ChangeMe image-list',
|
|
|
|
)}
|
|
|
|
|
2015-02-25 05:37:44 +01:00
|
|
|
it { is_expected.to contain_anchor('create glance-api anchor').with(
|
2014-11-21 11:25:31 -05:00
|
|
|
: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
|
2015-02-25 05:37:44 +01:00
|
|
|
it { is_expected.to contain_exec('execute glance-api validation').with(
|
2014-11-21 11:25:31 -05:00
|
|
|
:path => '/usr/bin:/bin:/usr/sbin:/sbin',
|
|
|
|
:provider => 'shell',
|
|
|
|
:tries => '10',
|
|
|
|
:try_sleep => '2',
|
|
|
|
:command => 'my-script',
|
|
|
|
)}
|
|
|
|
|
2015-02-25 05:37:44 +01:00
|
|
|
it { is_expected.to contain_anchor('create glance-api anchor').with(
|
2014-11-21 11:25:31 -05:00
|
|
|
:require => 'Exec[execute glance-api validation]',
|
|
|
|
)}
|
|
|
|
end
|
|
|
|
|
2015-02-02 15:40:09 -07:00
|
|
|
describe 'with identity and auth settings' do
|
|
|
|
let :params do
|
|
|
|
{
|
|
|
|
:keystone_password => 'ChangeMe',
|
|
|
|
}
|
|
|
|
end
|
|
|
|
context 'with custom keystone identity_uri' do
|
|
|
|
let :params do
|
|
|
|
default_params.merge!({
|
|
|
|
:identity_uri => 'https://foo.bar:1234/',
|
|
|
|
})
|
|
|
|
end
|
|
|
|
it 'configures identity_uri' do
|
2015-02-25 05:37:44 +01:00
|
|
|
is_expected.to contain_glance_api_config('keystone_authtoken/identity_uri').with_value("https://foo.bar:1234/");
|
|
|
|
# since only identity_uri is set the deprecated auth parameters is_expected.to
|
2015-02-02 15:40:09 -07:00
|
|
|
# still get set in case they are still in use
|
2015-02-25 05:37:44 +01:00
|
|
|
is_expected.to contain_glance_api_config('keystone_authtoken/auth_host').with_value('127.0.0.1');
|
|
|
|
is_expected.to contain_glance_api_config('keystone_authtoken/auth_port').with_value('35357');
|
|
|
|
is_expected.to contain_glance_api_config('keystone_authtoken/auth_protocol').with_value('http');
|
2015-02-02 15:40:09 -07:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'with custom keystone identity_uri and auth_uri' do
|
|
|
|
let :params do
|
|
|
|
default_params.merge!({
|
|
|
|
:identity_uri => 'https://foo.bar:35357/',
|
|
|
|
:auth_uri => 'https://foo.bar:5000/v2.0/',
|
|
|
|
})
|
|
|
|
end
|
|
|
|
it 'configures identity_uri' do
|
2015-02-25 05:37:44 +01:00
|
|
|
is_expected.to contain_glance_api_config('keystone_authtoken/identity_uri').with_value("https://foo.bar:35357/");
|
|
|
|
is_expected.to contain_glance_api_config('keystone_authtoken/auth_uri').with_value("https://foo.bar:5000/v2.0/");
|
|
|
|
is_expected.to contain_glance_api_config('keystone_authtoken/auth_host').with_ensure('absent')
|
|
|
|
is_expected.to contain_glance_api_config('keystone_authtoken/auth_port').with_ensure('absent')
|
|
|
|
is_expected.to contain_glance_api_config('keystone_authtoken/auth_protocol').with_ensure('absent')
|
|
|
|
is_expected.to contain_glance_api_config('keystone_authtoken/auth_admin_prefix').with_ensure('absent')
|
2015-02-02 15:40:09 -07:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2014-04-01 15:59:29 +02:00
|
|
|
describe 'on Debian platforms' do
|
|
|
|
let :facts do
|
2015-10-21 12:54:54 +03:00
|
|
|
@default_facts.merge({
|
|
|
|
:osfamily => 'Debian',
|
|
|
|
})
|
2014-04-01 15:59:29 +02:00
|
|
|
end
|
|
|
|
let(:params) { default_params }
|
|
|
|
|
2015-04-17 13:37:04 +00:00
|
|
|
# We only test this on Debian platforms, since on RedHat there isn't a
|
|
|
|
# separate package for glance API.
|
2015-03-26 11:13:07 -06:00
|
|
|
['present', 'latest'].each do |package_ensure|
|
|
|
|
context "with package_ensure '#{package_ensure}'" do
|
|
|
|
let(:params) { default_params.merge({ :package_ensure => package_ensure }) }
|
|
|
|
it { is_expected.to contain_package('glance-api').with(
|
|
|
|
:ensure => package_ensure,
|
2015-07-22 10:14:50 +02:00
|
|
|
:tag => ['openstack', 'glance-package']
|
2015-03-26 11:13:07 -06:00
|
|
|
)}
|
|
|
|
end
|
|
|
|
end
|
2014-04-01 15:59:29 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
describe 'on RedHat platforms' do
|
|
|
|
let :facts do
|
2015-10-21 12:54:54 +03:00
|
|
|
@default_facts.merge({
|
2015-11-24 10:02:50 +01:00
|
|
|
:osfamily => 'RedHat',
|
|
|
|
:operatingsystemrelease => '7',
|
2015-10-21 12:54:54 +03:00
|
|
|
})
|
2014-04-01 15:59:29 +02:00
|
|
|
end
|
|
|
|
let(:params) { default_params }
|
|
|
|
|
2015-04-17 13:37:04 +00:00
|
|
|
it { is_expected.to contain_package('openstack-glance').with(
|
2015-07-22 10:14:50 +02:00
|
|
|
:tag => ['openstack', 'glance-package'],
|
2015-04-17 13:37:04 +00:00
|
|
|
)}
|
2014-04-01 15:59:29 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
describe 'on unknown platforms' do
|
|
|
|
let :facts do
|
|
|
|
{ :osfamily => 'unknown' }
|
|
|
|
end
|
|
|
|
let(:params) { default_params }
|
|
|
|
|
2015-02-25 05:37:44 +01:00
|
|
|
it_raises 'a Puppet::Error', /module glance only support osfamily RedHat and Debian/
|
2014-04-01 15:59:29 +02:00
|
|
|
end
|
|
|
|
|
2012-01-02 15:01:50 -08:00
|
|
|
end
|