spec: updates for rspec-puppet 2.x and rspec 3.x

This patch aim to update our specs test in order to work with the rspec-puppet release
2.0.0, in the mean time, we update rspec syntax in order to be prepared
for rspec 3.x move.

In details:

  * Use shared_examples "a Puppet::Error" for puppet::error tests
  * Convert 'should' keyword to 'is_expected.to' (prepare rspec 3.x)
  * Fix spec tests for rspec-puppet 2.0.0
  * Upgrade and pin rspec-puppet from 1.0.1 to 2.0.0
  * Clean Gemfile (remove over-specificication of runtime deps of puppetlabs_spec_helper)

Change-Id: Ibd0333dc3c0959e846edfbad51fb48e8dfb8fbe9
Card: https://trello.com/c/eHXc1Ryd/4-investigate-the-necessary-change-to-be-rspec-puppet-2-0-0-compliant
This commit is contained in:
Sebastien Badia 2015-02-25 05:37:44 +01:00
parent 0d83409381
commit dbe297b056
20 changed files with 288 additions and 293 deletions

View File

@ -2,7 +2,8 @@ source 'https://rubygems.org'
group :development, :test do
gem 'puppetlabs_spec_helper', :require => false
gem 'rspec-puppet', '~> 1.0.1'
gem 'rspec-puppet', '~> 2.0.0', :require => false
gem 'metadata-json-lint'
gem 'puppet-lint-param-docs'
gem 'puppet-lint-absolute_classname-check'
@ -15,8 +16,6 @@ group :development, :test do
gem 'puppet-lint-variable_contains_upcase'
gem 'puppet-lint-numericvariable'
gem 'rake', '10.1.1'
gem 'rspec', '< 2.99'
gem 'json'
gem 'webmock'
end

View File

@ -78,19 +78,19 @@ describe 'glance::api' do
param_set
end
it { should contain_class 'glance' }
it { should contain_class 'glance::policy' }
it { is_expected.to contain_class 'glance' }
it { is_expected.to contain_class 'glance::policy' }
it { should contain_service('glance-api').with(
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
) }
it { should_not contain_exec('validate_nova_api') }
it { is_expected.to_not contain_exec('validate_nova_api') }
it 'should lay down default api config' do
it 'is_expected.to lay down default api config' do
[
'verbose',
'debug',
@ -102,11 +102,11 @@ describe 'glance::api' do
'show_image_direct_url',
'os_region_name',
].each do |config|
should contain_glance_api_config("DEFAULT/#{config}").with_value(param_hash[config.intern])
is_expected.to contain_glance_api_config("DEFAULT/#{config}").with_value(param_hash[config.intern])
end
end
it 'should lay down default cache config' do
it 'is_expected.to lay down default cache config' do
[
'verbose',
'debug',
@ -114,46 +114,46 @@ describe 'glance::api' do
'registry_port',
'os_region_name',
].each do |config|
should contain_glance_cache_config("DEFAULT/#{config}").with_value(param_hash[config.intern])
is_expected.to contain_glance_cache_config("DEFAULT/#{config}").with_value(param_hash[config.intern])
end
end
it 'should config db' do
should contain_glance_api_config('database/connection').with_value(param_hash[:database_connection])
should contain_glance_api_config('database/connection').with_value(param_hash[:database_connection]).with_secret(true)
should contain_glance_api_config('database/idle_timeout').with_value(param_hash[:database_idle_timeout])
it 'is_expected.to config db' do
is_expected.to contain_glance_api_config('database/connection').with_value(param_hash[:database_connection])
is_expected.to contain_glance_api_config('database/connection').with_value(param_hash[:database_connection]).with_secret(true)
is_expected.to contain_glance_api_config('database/idle_timeout').with_value(param_hash[:database_idle_timeout])
end
it 'should have no ssl options' do
should contain_glance_api_config('DEFAULT/ca_file').with_ensure('absent')
should contain_glance_api_config('DEFAULT/cert_file').with_ensure('absent')
should contain_glance_api_config('DEFAULT/key_file').with_ensure('absent')
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 'should lay down default auth config' do
it 'is_expected.to lay down default auth config' do
[
'auth_host',
'auth_port',
'auth_protocol'
].each do |config|
should contain_glance_api_config("keystone_authtoken/#{config}").with_value(param_hash[config.intern])
is_expected.to contain_glance_api_config("keystone_authtoken/#{config}").with_value(param_hash[config.intern])
end
end
it { should contain_glance_api_config('keystone_authtoken/auth_admin_prefix').with_ensure('absent') }
it { is_expected.to contain_glance_api_config('keystone_authtoken/auth_admin_prefix').with_ensure('absent') }
it 'should configure itself for keystone if that is the auth_type' do
it 'is_expected.to configure itself for keystone if that is the auth_type' do
if params[:auth_type] == 'keystone'
should contain('paste_deploy/flavor').with_value('keystone+cachemanagement')
is_expected.to contain('paste_deploy/flavor').with_value('keystone+cachemanagement')
['admin_tenant_name', 'admin_user', 'admin_password'].each do |config|
should contain_glance_api_config("keystone_authtoken/#{config}").with_value(param_hash[config.intern])
is_expected.to contain_glance_api_config("keystone_authtoken/#{config}").with_value(param_hash[config.intern])
end
should contain_glance_api_config('keystone_authtoken/admin_password').with_value(param_hash[:keystone_password]).with_secret(true)
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|
should contain_glance_cache_config("keystone_authtoken/#{config}").with_value(param_hash[config.intern])
is_expected.to contain_glance_cache_config("keystone_authtoken/#{config}").with_value(param_hash[config.intern])
end
should contain_glance_cache_config('keystone_authtoken/admin_password').with_value(param_hash[:keystone_password]).with_secret(true)
is_expected.to contain_glance_cache_config('keystone_authtoken/admin_password').with_value(param_hash[:keystone_password]).with_secret(true)
end
end
end
@ -169,7 +169,7 @@ describe 'glance::api' do
}
end
it { should contain_service('glance-api').with(
it { is_expected.to contain_service('glance-api').with(
'ensure' => nil,
'enable' => false,
'hasstatus' => true,
@ -185,7 +185,7 @@ describe 'glance::api' do
}
end
it { should contain_glance_api_config('paste_deploy/flavor').with_value('keystone') }
it { is_expected.to contain_glance_api_config('paste_deploy/flavor').with_value('keystone') }
end
describe 'with blank pipeline' do
@ -196,7 +196,7 @@ describe 'glance::api' do
}
end
it { should contain_glance_api_config('paste_deploy/flavor').with_ensure('absent') }
it { is_expected.to contain_glance_api_config('paste_deploy/flavor').with_ensure('absent') }
end
[
@ -214,7 +214,7 @@ describe 'glance::api' do
}
end
it { expect { should contain_glance_api_config('filter:paste_deploy/flavor') }.to\
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
@ -227,7 +227,7 @@ describe 'glance::api' do
}
end
it { should contain_glance_api_config('keystone_authtoken/auth_admin_prefix').with_value('/keystone/main') }
it { is_expected.to contain_glance_api_config('keystone_authtoken/auth_admin_prefix').with_value('/keystone/main') }
end
[
@ -246,7 +246,7 @@ describe 'glance::api' do
}
end
it { expect { should contain_glance_api_config('filter:authtoken/auth_admin_prefix') }.to\
it { expect { is_expected.to contain_glance_api_config('filter:authtoken/auth_admin_prefix') }.to\
raise_error(Puppet::Error, /validate_re\(\): "#{auth_admin_prefix}" does not match/) }
end
end
@ -256,8 +256,8 @@ describe 'glance::api' do
default_params
end
it { should contain_glance_api_config('DEFAULT/use_syslog').with_value(false) }
it { should_not contain_glance_api_config('DEFAULT/syslog_log_facility') }
it { is_expected.to contain_glance_api_config('DEFAULT/use_syslog').with_value(false) }
it { is_expected.to_not contain_glance_api_config('DEFAULT/syslog_log_facility') }
end
describe 'with syslog enabled' do
@ -267,8 +267,8 @@ describe 'glance::api' do
})
end
it { should contain_glance_api_config('DEFAULT/use_syslog').with_value(true) }
it { should contain_glance_api_config('DEFAULT/syslog_log_facility').with_value('LOG_USER') }
it { is_expected.to contain_glance_api_config('DEFAULT/use_syslog').with_value(true) }
it { is_expected.to contain_glance_api_config('DEFAULT/syslog_log_facility').with_value('LOG_USER') }
end
describe 'with syslog enabled and custom settings' do
@ -279,29 +279,29 @@ describe 'glance::api' do
})
end
it { should contain_glance_api_config('DEFAULT/use_syslog').with_value(true) }
it { should contain_glance_api_config('DEFAULT/syslog_log_facility').with_value('LOG_LOCAL0') }
it { is_expected.to contain_glance_api_config('DEFAULT/use_syslog').with_value(true) }
it { is_expected.to contain_glance_api_config('DEFAULT/syslog_log_facility').with_value('LOG_LOCAL0') }
end
describe 'with log_file enabled by default' do
let(:params) { default_params }
it { should contain_glance_api_config('DEFAULT/log_file').with_value(default_params[:log_file]) }
it { is_expected.to contain_glance_api_config('DEFAULT/log_file').with_value(default_params[:log_file]) }
context 'with log_file disabled' do
let(:params) { default_params.merge!({ :log_file => false }) }
it { should contain_glance_api_config('DEFAULT/log_file').with_ensure('absent') }
it { is_expected.to contain_glance_api_config('DEFAULT/log_file').with_ensure('absent') }
end
end
describe 'with log_dir enabled by default' do
let(:params) { default_params }
it { should contain_glance_api_config('DEFAULT/log_dir').with_value(default_params[:log_dir]) }
it { is_expected.to contain_glance_api_config('DEFAULT/log_dir').with_value(default_params[:log_dir]) }
context 'with log_dir disabled' do
let(:params) { default_params.merge!({ :log_dir => false }) }
it { should contain_glance_api_config('DEFAULT/log_dir').with_ensure('absent') }
it { is_expected.to contain_glance_api_config('DEFAULT/log_dir').with_ensure('absent') }
end
end
@ -315,9 +315,9 @@ describe 'glance::api' do
end
context 'with ssl options' do
it { should contain_glance_api_config('DEFAULT/ca_file').with_value('/tmp/ca_file') }
it { should contain_glance_api_config('DEFAULT/cert_file').with_value('/tmp/cert_file') }
it { should contain_glance_api_config('DEFAULT/key_file').with_value('/tmp/key_file') }
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
@ -325,7 +325,7 @@ describe 'glance::api' do
default_params
end
it { should_not contain_glance_api_config('glance_store/stores').with_value('false') }
it { is_expected.to_not contain_glance_api_config('glance_store/stores').with_value('false') }
end
describe 'with known_stores override' do
@ -335,7 +335,7 @@ describe 'glance::api' do
})
end
it { should contain_glance_api_config('glance_store/stores').with_value("glance.store.filesystem.Store,glance.store.http.Store") }
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
@ -344,7 +344,7 @@ describe 'glance::api' do
:validate => true,
})
end
it { should contain_exec('execute glance-api validation').with(
it { is_expected.to contain_exec('execute glance-api validation').with(
:path => '/usr/bin:/bin:/usr/sbin:/sbin',
:provider => 'shell',
:tries => '10',
@ -352,7 +352,7 @@ describe 'glance::api' do
:command => 'glance --os-auth-url http://localhost:5000/v2.0 --os-tenant-name services --os-username glance --os-password ChangeMe image-list',
)}
it { should contain_anchor('create glance-api anchor').with(
it { is_expected.to contain_anchor('create glance-api anchor').with(
:require => 'Exec[execute glance-api validation]',
)}
end
@ -364,7 +364,7 @@ describe 'glance::api' do
:validation_options => { 'glance-api' => { 'command' => 'my-script' } }
})
end
it { should contain_exec('execute glance-api validation').with(
it { is_expected.to contain_exec('execute glance-api validation').with(
:path => '/usr/bin:/bin:/usr/sbin:/sbin',
:provider => 'shell',
:tries => '10',
@ -372,7 +372,7 @@ describe 'glance::api' do
:command => 'my-script',
)}
it { should contain_anchor('create glance-api anchor').with(
it { is_expected.to contain_anchor('create glance-api anchor').with(
:require => 'Exec[execute glance-api validation]',
)}
end
@ -390,12 +390,12 @@ describe 'glance::api' do
})
end
it 'configures identity_uri' do
should contain_glance_api_config('keystone_authtoken/identity_uri').with_value("https://foo.bar:1234/");
# since only identity_uri is set the deprecated auth parameters should
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
# still get set in case they are still in use
should contain_glance_api_config('keystone_authtoken/auth_host').with_value('127.0.0.1');
should contain_glance_api_config('keystone_authtoken/auth_port').with_value('35357');
should contain_glance_api_config('keystone_authtoken/auth_protocol').with_value('http');
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');
end
end
@ -407,12 +407,12 @@ describe 'glance::api' do
})
end
it 'configures identity_uri' do
should contain_glance_api_config('keystone_authtoken/identity_uri').with_value("https://foo.bar:35357/");
should contain_glance_api_config('keystone_authtoken/auth_uri').with_value("https://foo.bar:5000/v2.0/");
should contain_glance_api_config('keystone_authtoken/auth_host').with_ensure('absent')
should contain_glance_api_config('keystone_authtoken/auth_port').with_ensure('absent')
should contain_glance_api_config('keystone_authtoken/auth_protocol').with_ensure('absent')
should contain_glance_api_config('keystone_authtoken/auth_admin_prefix').with_ensure('absent')
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')
end
end
end
@ -424,7 +424,7 @@ describe 'glance::api' do
end
let(:params) { default_params }
it { should contain_package('glance-api').with(
it { is_expected.to contain_package('glance-api').with(
:tag => ['openstack'],
)}
end
@ -435,7 +435,7 @@ describe 'glance::api' do
end
let(:params) { default_params }
it { should contain_package('openstack-glance').with(
it { is_expected.to contain_package('openstack-glance').with(
:tag => ['openstack'],
)}
end
@ -446,9 +446,7 @@ describe 'glance::api' do
end
let(:params) { default_params }
it 'should fails to configure glance-api' do
expect { subject }.to raise_error(Puppet::Error, /module glance only support osfamily RedHat and Debian/)
end
it_raises 'a Puppet::Error', /module glance only support osfamily RedHat and Debian/
end
end

View File

@ -31,19 +31,19 @@ describe 'glance::backend::cinder' do
context 'when default parameters' do
it 'configures glance-api.conf' do
should contain_glance_api_config('glance_store/default_store').with_value('cinder')
should contain_glance_api_config('DEFAULT/cinder_api_insecure').with_value(false)
should contain_glance_api_config('DEFAULT/cinder_catalog_info').with_value('volume:cinder:publicURL')
should contain_glance_api_config('DEFAULT/cinder_http_retries').with_value('3')
should contain_glance_api_config('DEFAULT/cinder_ca_certificates_file').with(:ensure => 'absent')
should contain_glance_api_config('DEFAULT/cinder_endpoint_template').with(:ensure => 'absent')
is_expected.to contain_glance_api_config('glance_store/default_store').with_value('cinder')
is_expected.to contain_glance_api_config('DEFAULT/cinder_api_insecure').with_value(false)
is_expected.to contain_glance_api_config('DEFAULT/cinder_catalog_info').with_value('volume:cinder:publicURL')
is_expected.to contain_glance_api_config('DEFAULT/cinder_http_retries').with_value('3')
is_expected.to contain_glance_api_config('DEFAULT/cinder_ca_certificates_file').with(:ensure => 'absent')
is_expected.to contain_glance_api_config('DEFAULT/cinder_endpoint_template').with(:ensure => 'absent')
end
it 'configures glance-cache.conf' do
should contain_glance_cache_config('DEFAULT/cinder_api_insecure').with_value(false)
should contain_glance_cache_config('DEFAULT/cinder_catalog_info').with_value('volume:cinder:publicURL')
should contain_glance_cache_config('DEFAULT/cinder_http_retries').with_value('3')
should contain_glance_cache_config('DEFAULT/cinder_ca_certificates_file').with(:ensure => 'absent')
should contain_glance_cache_config('DEFAULT/cinder_endpoint_template').with(:ensure => 'absent')
is_expected.to contain_glance_cache_config('DEFAULT/cinder_api_insecure').with_value(false)
is_expected.to contain_glance_cache_config('DEFAULT/cinder_catalog_info').with_value('volume:cinder:publicURL')
is_expected.to contain_glance_cache_config('DEFAULT/cinder_http_retries').with_value('3')
is_expected.to contain_glance_cache_config('DEFAULT/cinder_ca_certificates_file').with(:ensure => 'absent')
is_expected.to contain_glance_cache_config('DEFAULT/cinder_endpoint_template').with(:ensure => 'absent')
end
end
@ -58,19 +58,19 @@ describe 'glance::backend::cinder' do
}
end
it 'configures glance-api.conf' do
should contain_glance_api_config('glance_store/default_store').with_value('cinder')
should contain_glance_api_config('DEFAULT/cinder_api_insecure').with_value(true)
should contain_glance_api_config('DEFAULT/cinder_ca_certificates_file').with_value('/etc/ssh/ca.crt')
should contain_glance_api_config('DEFAULT/cinder_catalog_info').with_value('volume:cinder:internalURL')
should contain_glance_api_config('DEFAULT/cinder_endpoint_template').with_value('http://srv-foo:8776/v1/%(project_id)s')
should contain_glance_api_config('DEFAULT/cinder_http_retries').with_value('10')
is_expected.to contain_glance_api_config('glance_store/default_store').with_value('cinder')
is_expected.to contain_glance_api_config('DEFAULT/cinder_api_insecure').with_value(true)
is_expected.to contain_glance_api_config('DEFAULT/cinder_ca_certificates_file').with_value('/etc/ssh/ca.crt')
is_expected.to contain_glance_api_config('DEFAULT/cinder_catalog_info').with_value('volume:cinder:internalURL')
is_expected.to contain_glance_api_config('DEFAULT/cinder_endpoint_template').with_value('http://srv-foo:8776/v1/%(project_id)s')
is_expected.to contain_glance_api_config('DEFAULT/cinder_http_retries').with_value('10')
end
it 'configures glance-cache.conf' do
should contain_glance_cache_config('DEFAULT/cinder_api_insecure').with_value(true)
should contain_glance_cache_config('DEFAULT/cinder_ca_certificates_file').with_value('/etc/ssh/ca.crt')
should contain_glance_cache_config('DEFAULT/cinder_catalog_info').with_value('volume:cinder:internalURL')
should contain_glance_cache_config('DEFAULT/cinder_endpoint_template').with_value('http://srv-foo:8776/v1/%(project_id)s')
should contain_glance_cache_config('DEFAULT/cinder_http_retries').with_value('10')
is_expected.to contain_glance_cache_config('DEFAULT/cinder_api_insecure').with_value(true)
is_expected.to contain_glance_cache_config('DEFAULT/cinder_ca_certificates_file').with_value('/etc/ssh/ca.crt')
is_expected.to contain_glance_cache_config('DEFAULT/cinder_catalog_info').with_value('volume:cinder:internalURL')
is_expected.to contain_glance_cache_config('DEFAULT/cinder_endpoint_template').with_value('http://srv-foo:8776/v1/%(project_id)s')
is_expected.to contain_glance_cache_config('DEFAULT/cinder_http_retries').with_value('10')
end
end

View File

@ -10,12 +10,12 @@ describe 'glance::backend::file' do
end
it 'configures glance-api.conf' do
should contain_glance_api_config('glance_store/default_store').with_value('file')
should contain_glance_api_config('glance_store/filesystem_store_datadir').with_value('/var/lib/glance/images/')
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
should contain_glance_cache_config('glance_store/filesystem_store_datadir').with_value('/var/lib/glance/images/')
is_expected.to contain_glance_cache_config('glance_store/filesystem_store_datadir').with_value('/var/lib/glance/images/')
end
describe 'when overriding datadir' do
@ -24,11 +24,11 @@ describe 'glance::backend::file' do
end
it 'configures glance-api.conf' do
should contain_glance_api_config('glance_store/filesystem_store_datadir').with_value('/tmp/')
is_expected.to contain_glance_api_config('glance_store/filesystem_store_datadir').with_value('/tmp/')
end
it 'configures glance-cache.conf' do
should 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('/tmp/')
end
end
end

View File

@ -14,12 +14,12 @@ describe 'glance::backend::rbd' do
}
end
it { should contain_glance_api_config('glance_store/default_store').with_value('rbd') }
it { should contain_glance_api_config('DEFAULT/rbd_store_pool').with_value('images') }
it { should contain_glance_api_config('DEFAULT/rbd_store_ceph_conf').with_value('/etc/ceph/ceph.conf') }
it { should contain_glance_api_config('DEFAULT/rbd_store_chunk_size').with_value('8') }
it { is_expected.to contain_glance_api_config('glance_store/default_store').with_value('rbd') }
it { is_expected.to contain_glance_api_config('DEFAULT/rbd_store_pool').with_value('images') }
it { is_expected.to contain_glance_api_config('DEFAULT/rbd_store_ceph_conf').with_value('/etc/ceph/ceph.conf') }
it { is_expected.to contain_glance_api_config('DEFAULT/rbd_store_chunk_size').with_value('8') }
it { should contain_package('python-ceph').with(
it { is_expected.to contain_package('python-ceph').with(
:name => 'python-ceph',
:ensure => 'present'
)
@ -34,9 +34,9 @@ describe 'glance::backend::rbd' do
:package_ensure => 'latest',
}
end
it { should contain_glance_api_config('DEFAULT/rbd_store_user').with_value('user') }
it { should contain_glance_api_config('DEFAULT/rbd_store_chunk_size').with_value('2') }
it { should contain_package('python-ceph').with(
it { is_expected.to contain_glance_api_config('DEFAULT/rbd_store_user').with_value('user') }
it { is_expected.to contain_glance_api_config('DEFAULT/rbd_store_chunk_size').with_value('2') }
it { is_expected.to contain_package('python-ceph').with(
:name => 'python-ceph',
:ensure => 'latest'
)

View File

@ -21,24 +21,24 @@ describe 'glance::backend::swift' do
describe 'when default parameters' do
it 'configures glance-api.conf' do
should contain_glance_api_config('glance_store/default_store').with_value('swift')
should contain_glance_api_config('glance_store/swift_store_key').with_value('key')
should contain_glance_api_config('glance_store/swift_store_user').with_value('user')
should contain_glance_api_config('DEFAULT/swift_store_auth_version').with_value('2')
should contain_glance_api_config('DEFAULT/swift_store_large_object_size').with_value('5120')
should contain_glance_api_config('glance_store/swift_store_auth_address').with_value('127.0.0.1:5000/v2.0/')
should contain_glance_api_config('DEFAULT/swift_store_container').with_value('glance')
should contain_glance_api_config('DEFAULT/swift_store_create_container_on_put').with_value(false)
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_key').with_value('key')
is_expected.to contain_glance_api_config('glance_store/swift_store_user').with_value('user')
is_expected.to contain_glance_api_config('DEFAULT/swift_store_auth_version').with_value('2')
is_expected.to contain_glance_api_config('DEFAULT/swift_store_large_object_size').with_value('5120')
is_expected.to contain_glance_api_config('glance_store/swift_store_auth_address').with_value('127.0.0.1:5000/v2.0/')
is_expected.to contain_glance_api_config('DEFAULT/swift_store_container').with_value('glance')
is_expected.to contain_glance_api_config('DEFAULT/swift_store_create_container_on_put').with_value(false)
end
it 'configures glance-cache.conf' do
should contain_glance_cache_config('glance_store/swift_store_key').with_value('key')
should contain_glance_cache_config('glance_store/swift_store_user').with_value('user')
should contain_glance_cache_config('DEFAULT/swift_store_auth_version').with_value('2')
should contain_glance_cache_config('DEFAULT/swift_store_large_object_size').with_value('5120')
should contain_glance_cache_config('glance_store/swift_store_auth_address').with_value('127.0.0.1:5000/v2.0/')
should contain_glance_cache_config('DEFAULT/swift_store_container').with_value('glance')
should contain_glance_cache_config('DEFAULT/swift_store_create_container_on_put').with_value(false)
is_expected.to contain_glance_cache_config('glance_store/swift_store_key').with_value('key')
is_expected.to contain_glance_cache_config('glance_store/swift_store_user').with_value('user')
is_expected.to contain_glance_cache_config('DEFAULT/swift_store_auth_version').with_value('2')
is_expected.to contain_glance_cache_config('DEFAULT/swift_store_large_object_size').with_value('5120')
is_expected.to contain_glance_cache_config('glance_store/swift_store_auth_address').with_value('127.0.0.1:5000/v2.0/')
is_expected.to contain_glance_cache_config('DEFAULT/swift_store_container').with_value('glance')
is_expected.to contain_glance_cache_config('DEFAULT/swift_store_create_container_on_put').with_value(false)
end
end
@ -56,19 +56,19 @@ describe 'glance::backend::swift' do
end
it 'configures glance-api.conf' do
should contain_glance_api_config('DEFAULT/swift_store_container').with_value('swift')
should contain_glance_api_config('DEFAULT/swift_store_create_container_on_put').with_value(true)
should contain_glance_api_config('DEFAULT/swift_store_auth_version').with_value('1')
should contain_glance_api_config('DEFAULT/swift_store_large_object_size').with_value('100')
should contain_glance_api_config('glance_store/swift_store_auth_address').with_value('127.0.0.2:8080/v1.0/')
is_expected.to contain_glance_api_config('DEFAULT/swift_store_container').with_value('swift')
is_expected.to contain_glance_api_config('DEFAULT/swift_store_create_container_on_put').with_value(true)
is_expected.to contain_glance_api_config('DEFAULT/swift_store_auth_version').with_value('1')
is_expected.to contain_glance_api_config('DEFAULT/swift_store_large_object_size').with_value('100')
is_expected.to contain_glance_api_config('glance_store/swift_store_auth_address').with_value('127.0.0.2:8080/v1.0/')
end
it 'configures glance-cache.conf' do
should contain_glance_cache_config('DEFAULT/swift_store_container').with_value('swift')
should contain_glance_cache_config('DEFAULT/swift_store_create_container_on_put').with_value(true)
should contain_glance_cache_config('DEFAULT/swift_store_auth_version').with_value('1')
should contain_glance_cache_config('DEFAULT/swift_store_large_object_size').with_value('100')
should contain_glance_cache_config('glance_store/swift_store_auth_address').with_value('127.0.0.2:8080/v1.0/')
is_expected.to contain_glance_cache_config('DEFAULT/swift_store_container').with_value('swift')
is_expected.to contain_glance_cache_config('DEFAULT/swift_store_create_container_on_put').with_value(true)
is_expected.to contain_glance_cache_config('DEFAULT/swift_store_auth_version').with_value('1')
is_expected.to contain_glance_cache_config('DEFAULT/swift_store_large_object_size').with_value('100')
is_expected.to contain_glance_cache_config('glance_store/swift_store_auth_address').with_value('127.0.0.2:8080/v1.0/')
end
end
end

View File

@ -40,16 +40,16 @@ describe 'glance::backend::vsphere' do
}
end
it 'configures glance-api.conf' do
should contain_glance_api_config('DEFAULT/default_store').with_value('vsphere')
should contain_glance_api_config('DEFAULT/vmware_api_insecure').with_value('False')
should contain_glance_api_config('DEFAULT/vmware_server_host').with_value('10.0.0.1')
should contain_glance_api_config('DEFAULT/vmware_server_username').with_value('root')
should contain_glance_api_config('DEFAULT/vmware_server_password').with_value('123456')
should contain_glance_api_config('DEFAULT/vmware_datastore_name').with_value('Datastore')
should contain_glance_api_config('DEFAULT/vmware_store_image_dir').with_value('/openstack_glance')
should contain_glance_api_config('DEFAULT/vmware_task_poll_interval').with_value('5')
should contain_glance_api_config('DEFAULT/vmware_api_retry_count').with_value('10')
should contain_glance_api_config('DEFAULT/vmware_datacenter_path').with_value('Datacenter')
is_expected.to contain_glance_api_config('DEFAULT/default_store').with_value('vsphere')
is_expected.to contain_glance_api_config('DEFAULT/vmware_api_insecure').with_value('False')
is_expected.to contain_glance_api_config('DEFAULT/vmware_server_host').with_value('10.0.0.1')
is_expected.to contain_glance_api_config('DEFAULT/vmware_server_username').with_value('root')
is_expected.to contain_glance_api_config('DEFAULT/vmware_server_password').with_value('123456')
is_expected.to contain_glance_api_config('DEFAULT/vmware_datastore_name').with_value('Datastore')
is_expected.to contain_glance_api_config('DEFAULT/vmware_store_image_dir').with_value('/openstack_glance')
is_expected.to contain_glance_api_config('DEFAULT/vmware_task_poll_interval').with_value('5')
is_expected.to contain_glance_api_config('DEFAULT/vmware_api_retry_count').with_value('10')
is_expected.to contain_glance_api_config('DEFAULT/vmware_datacenter_path').with_value('Datacenter')
end
end
@ -68,9 +68,9 @@ describe 'glance::backend::vsphere' do
}
end
it 'configures glance-api.conf' do
should contain_glance_api_config('DEFAULT/vmware_api_insecure').with_value('True')
should contain_glance_api_config('DEFAULT/vmware_task_poll_interval').with_value('6')
should contain_glance_api_config('DEFAULT/vmware_api_retry_count').with_value('11')
is_expected.to contain_glance_api_config('DEFAULT/vmware_api_insecure').with_value('True')
is_expected.to contain_glance_api_config('DEFAULT/vmware_task_poll_interval').with_value('6')
is_expected.to contain_glance_api_config('DEFAULT/vmware_api_retry_count').with_value('11')
end
end

View File

@ -7,7 +7,7 @@ describe 'glance::cache::cleaner' do
context 'when default parameters' do
it 'configures a cron' do
should contain_cron('glance-cache-cleaner').with(
is_expected.to contain_cron('glance-cache-cleaner').with(
:command => 'glance-cache-cleaner ',
:environment => 'PATH=/bin:/usr/bin:/usr/sbin',
:user => 'glance',
@ -32,7 +32,7 @@ describe 'glance::cache::cleaner' do
}
end
it 'configures a cron' do
should contain_cron('glance-cache-cleaner').with(
is_expected.to contain_cron('glance-cache-cleaner').with(
:command => 'glance-cache-cleaner --config-dir /etc/glance/',
:environment => 'PATH=/bin:/usr/bin:/usr/sbin',
:user => 'glance',
@ -51,7 +51,7 @@ describe 'glance::cache::cleaner' do
{ :osfamily => 'Debian' }
end
include_examples 'glance cache cleaner'
it { should contain_cron('glance-cache-cleaner').with(:require => 'Package[glance-api]')}
it { is_expected.to contain_cron('glance-cache-cleaner').with(:require => 'Package[glance-api]')}
end
context 'on RedHat platforms' do
@ -59,7 +59,7 @@ describe 'glance::cache::cleaner' do
{ :osfamily => 'RedHat' }
end
include_examples 'glance cache cleaner'
it { should contain_cron('glance-cache-cleaner').with(:require => 'Package[openstack-glance]')}
it { is_expected.to contain_cron('glance-cache-cleaner').with(:require => 'Package[openstack-glance]')}
end
end

View File

@ -7,7 +7,7 @@ describe 'glance::cache::pruner' do
context 'when default parameters' do
it 'configures a cron' do
should contain_cron('glance-cache-pruner').with(
is_expected.to contain_cron('glance-cache-pruner').with(
:command => 'glance-cache-pruner ',
:environment => 'PATH=/bin:/usr/bin:/usr/sbin',
:user => 'glance',
@ -32,7 +32,7 @@ describe 'glance::cache::pruner' do
}
end
it 'configures a cron' do
should contain_cron('glance-cache-pruner').with(
is_expected.to contain_cron('glance-cache-pruner').with(
:command => 'glance-cache-pruner --config-dir /etc/glance/',
:environment => 'PATH=/bin:/usr/bin:/usr/sbin',
:user => 'glance',
@ -51,7 +51,7 @@ describe 'glance::cache::pruner' do
{ :osfamily => 'Debian' }
end
include_examples 'glance cache pruner'
it { should contain_cron('glance-cache-pruner').with(:require => 'Package[glance-api]')}
it { is_expected.to contain_cron('glance-cache-pruner').with(:require => 'Package[glance-api]')}
end
context 'on RedHat platforms' do
@ -59,7 +59,7 @@ describe 'glance::cache::pruner' do
{ :osfamily => 'RedHat' }
end
include_examples 'glance cache pruner'
it { should contain_cron('glance-cache-pruner').with(:require => 'Package[openstack-glance]')}
it { is_expected.to contain_cron('glance-cache-pruner').with(:require => 'Package[openstack-glance]')}
end
end

View File

@ -3,8 +3,8 @@ require 'spec_helper'
describe 'glance::client' do
shared_examples 'glance client' do
it { should contain_class('glance::params') }
it { should contain_package('python-glanceclient').with(
it { is_expected.to contain_class('glance::params') }
it { is_expected.to contain_package('python-glanceclient').with(
:name => 'python-glanceclient',
:ensure => 'present',
:tag => ['openstack'],

View File

@ -18,7 +18,7 @@ describe 'glance::db::mysql' do
}
end
it { should contain_openstacklib__db__mysql('glance').with(
it { is_expected.to contain_openstacklib__db__mysql('glance').with(
:password_hash => '*41C910F70EB213CF4CB7B2F561B4995503C0A87B',
:charset => 'utf8'
)}
@ -34,7 +34,7 @@ describe 'glance::db::mysql' do
}
end
it { should contain_openstacklib__db__mysql('glance').with(
it { is_expected.to contain_openstacklib__db__mysql('glance').with(
:password_hash => '*6F9A1CB9BD83EE06F3903BDFF9F4188764E694CA',
:dbname => 'glancedb2',
:charset => 'utf8'

View File

@ -24,7 +24,7 @@ describe 'glance::db::postgresql' do
req_params
end
it { should contain_postgresql__server__db('glance').with(
it { is_expected.to contain_postgresql__server__db('glance').with(
:user => 'glance',
:password => 'md56c7c03b193c2c1e0667bc5bd891703db'
)}
@ -47,7 +47,7 @@ describe 'glance::db::postgresql' do
req_params
end
it { should contain_postgresql__server__db('glance').with(
it { is_expected.to contain_postgresql__server__db('glance').with(
:user => 'glance',
:password => 'md56c7c03b193c2c1e0667bc5bd891703db'
)}

View File

@ -8,23 +8,23 @@ describe 'glance::keystone::auth' do
{:password => 'pass'}
end
it { should contain_keystone_user('glance').with(
it { is_expected.to contain_keystone_user('glance').with(
:ensure => 'present',
:password => 'pass'
)}
it { should contain_keystone_user_role('glance@services').with(
it { is_expected.to contain_keystone_user_role('glance@services').with(
:ensure => 'present',
:roles => 'admin'
) }
it { should contain_keystone_service('glance').with(
it { is_expected.to contain_keystone_service('glance').with(
:ensure => 'present',
:type => 'image',
:description => 'OpenStack Image Service'
) }
it { should contain_keystone_endpoint('RegionOne/glance').with(
it { is_expected.to contain_keystone_endpoint('RegionOne/glance').with(
:ensure => 'present',
:public_url => 'http://127.0.0.1:9292',
:admin_url => 'http://127.0.0.1:9292',
@ -43,17 +43,17 @@ describe 'glance::keystone::auth' do
}
end
it { should contain_keystone_user('glancey').with(
it { is_expected.to contain_keystone_user('glancey').with(
:ensure => 'present',
:password => 'password'
)}
it { should contain_keystone_user_role('glancey@services').with(
it { is_expected.to contain_keystone_user_role('glancey@services').with(
:ensure => 'present',
:roles => 'admin'
) }
it { should contain_keystone_service('glancey').with(
it { is_expected.to contain_keystone_service('glancey').with(
:ensure => 'present',
:type => 'imagey',
:description => 'OpenStack Image Service'
@ -77,7 +77,7 @@ describe 'glance::keystone::auth' do
}
end
it { should contain_keystone_endpoint('RegionTwo/glance').with(
it { is_expected.to contain_keystone_endpoint('RegionTwo/glance').with(
:ensure => 'present',
:public_url => 'https://10.0.0.1:9393',
:admin_url => 'https://10.0.0.2:9393',
@ -95,7 +95,7 @@ describe 'glance::keystone::auth' do
}
end
it { should_not contain_keystone_endpoint('glance') }
it { is_expected.to_not contain_keystone_endpoint('glance') }
end
describe 'when disabling user configuration' do
@ -106,11 +106,11 @@ describe 'glance::keystone::auth' do
}
end
it { should_not contain_keystone_user('glance') }
it { is_expected.to_not contain_keystone_user('glance') }
it { should contain_keystone_user_role('glance@services') }
it { is_expected.to contain_keystone_user_role('glance@services') }
it { should contain_keystone_service('glance').with(
it { is_expected.to contain_keystone_service('glance').with(
:ensure => 'present',
:type => 'image',
:description => 'OpenStack Image Service'
@ -126,11 +126,11 @@ describe 'glance::keystone::auth' do
}
end
it { should_not contain_keystone_user('glance') }
it { is_expected.to_not contain_keystone_user('glance') }
it { should_not contain_keystone_user_role('glance@services') }
it { is_expected.to_not contain_keystone_user_role('glance@services') }
it { should contain_keystone_service('glance').with(
it { is_expected.to contain_keystone_service('glance').with(
:ensure => 'present',
:type => 'image',
:description => 'OpenStack Image Service'
@ -153,7 +153,7 @@ describe 'glance::keystone::auth' do
}
end
it { should contain_keystone_endpoint('RegionOne/glance').with_notify('Service[glance-api]') }
it { is_expected.to contain_keystone_endpoint('RegionOne/glance').with_notify('Service[glance-api]') }
end
describe 'when overriding service name' do
@ -165,10 +165,10 @@ describe 'glance::keystone::auth' do
}
end
it { should contain_keystone_user('glance') }
it { should contain_keystone_user_role('glance@services') }
it { should contain_keystone_service('glance_service') }
it { should contain_keystone_endpoint('RegionOne/glance_service') }
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') }
it { is_expected.to contain_keystone_endpoint('RegionOne/glance_service') }
end

View File

@ -15,13 +15,13 @@ describe 'glance::notify::qpid' do
{:qpid_password => 'pass'}
end
it { should contain_glance_api_config('DEFAULT/notifier_driver').with_value('qpid') }
it { should contain_glance_api_config('DEFAULT/qpid_username').with_value('guest') }
it { should contain_glance_api_config('DEFAULT/qpid_password').with_value('pass') }
it { should contain_glance_api_config('DEFAULT/qpid_password').with_value(params[:qpid_password]).with_secret(true) }
it { should contain_glance_api_config('DEFAULT/qpid_hostname').with_value('localhost') }
it { should contain_glance_api_config('DEFAULT/qpid_port').with_value('5672') }
it { should contain_glance_api_config('DEFAULT/qpid_protocol').with_value('tcp') }
it { is_expected.to contain_glance_api_config('DEFAULT/notifier_driver').with_value('qpid') }
it { is_expected.to contain_glance_api_config('DEFAULT/qpid_username').with_value('guest') }
it { is_expected.to contain_glance_api_config('DEFAULT/qpid_password').with_value('pass') }
it { is_expected.to contain_glance_api_config('DEFAULT/qpid_password').with_value(params[:qpid_password]).with_secret(true) }
it { is_expected.to contain_glance_api_config('DEFAULT/qpid_hostname').with_value('localhost') }
it { is_expected.to contain_glance_api_config('DEFAULT/qpid_port').with_value('5672') }
it { is_expected.to contain_glance_api_config('DEFAULT/qpid_protocol').with_value('tcp') }
end
describe 'when passing params' do
@ -33,10 +33,10 @@ describe 'glance::notify::qpid' do
:qpid_port => '5673'
}
end
it { should contain_glance_api_config('DEFAULT/qpid_username').with_value('guest2') }
it { should contain_glance_api_config('DEFAULT/qpid_hostname').with_value('localhost2') }
it { should contain_glance_api_config('DEFAULT/qpid_port').with_value('5673') }
it { should contain_glance_api_config('DEFAULT/qpid_protocol').with_value('tcp') }
it { is_expected.to contain_glance_api_config('DEFAULT/qpid_username').with_value('guest2') }
it { is_expected.to contain_glance_api_config('DEFAULT/qpid_hostname').with_value('localhost2') }
it { is_expected.to contain_glance_api_config('DEFAULT/qpid_port').with_value('5673') }
it { is_expected.to contain_glance_api_config('DEFAULT/qpid_protocol').with_value('tcp') }
end
describe 'when configuring with ssl' do
@ -49,9 +49,9 @@ describe 'glance::notify::qpid' do
:qpid_protocol => 'ssl'
}
end
it { should contain_glance_api_config('DEFAULT/qpid_username').with_value('guest3') }
it { should contain_glance_api_config('DEFAULT/qpid_hostname').with_value('localhost3') }
it { should contain_glance_api_config('DEFAULT/qpid_port').with_value('5671') }
it { should contain_glance_api_config('DEFAULT/qpid_protocol').with_value('ssl') }
it { is_expected.to contain_glance_api_config('DEFAULT/qpid_username').with_value('guest3') }
it { is_expected.to contain_glance_api_config('DEFAULT/qpid_hostname').with_value('localhost3') }
it { is_expected.to contain_glance_api_config('DEFAULT/qpid_port').with_value('5671') }
it { is_expected.to contain_glance_api_config('DEFAULT/qpid_protocol').with_value('ssl') }
end
end

View File

@ -14,18 +14,18 @@ describe 'glance::notify::rabbitmq' do
let :params do
{:rabbit_password => 'pass'}
end
it { should contain_glance_api_config('DEFAULT/notification_driver').with_value('messaging') }
it { should contain_glance_api_config('DEFAULT/rabbit_password').with_value('pass') }
it { should contain_glance_api_config('DEFAULT/rabbit_password').with_value(params[:rabbit_password]).with_secret(true) }
it { should contain_glance_api_config('DEFAULT/rabbit_userid').with_value('guest') }
it { should contain_glance_api_config('DEFAULT/rabbit_host').with_value('localhost') }
it { should contain_glance_api_config('DEFAULT/rabbit_port').with_value('5672') }
it { should contain_glance_api_config('DEFAULT/rabbit_hosts').with_value('localhost:5672') }
it { should contain_glance_api_config('DEFAULT/rabbit_ha_queues').with_value('false') }
it { should contain_glance_api_config('DEFAULT/amqp_durable_queues').with_value('false') }
it { should contain_glance_api_config('DEFAULT/rabbit_virtual_host').with_value('/') }
it { should contain_glance_api_config('DEFAULT/rabbit_notification_exchange').with_value('glance') }
it { should contain_glance_api_config('DEFAULT/rabbit_notification_topic').with_value('notifications') }
it { is_expected.to contain_glance_api_config('DEFAULT/notification_driver').with_value('messaging') }
it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_password').with_value('pass') }
it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_password').with_value(params[:rabbit_password]).with_secret(true) }
it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_userid').with_value('guest') }
it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_host').with_value('localhost') }
it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_port').with_value('5672') }
it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_hosts').with_value('localhost:5672') }
it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_ha_queues').with_value('false') }
it { is_expected.to contain_glance_api_config('DEFAULT/amqp_durable_queues').with_value('false') }
it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_virtual_host').with_value('/') }
it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_notification_exchange').with_value('glance') }
it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_notification_topic').with_value('notifications') }
end
describe 'when passing params and use ssl' do
@ -38,15 +38,15 @@ describe 'glance::notify::rabbitmq' do
:rabbit_use_ssl => true,
:rabbit_durable_queues => true,
}
it { should contain_glance_api_config('DEFAULT/rabbit_userid').with_value('guest2') }
it { should contain_glance_api_config('DEFAULT/rabbit_host').with_value('localhost2') }
it { should contain_glance_api_config('DEFAULT/rabbit_port').with_value('5673') }
it { should contain_glance_api_config('DEFAULT/rabbit_use_ssl').with_value('true') }
it { should contain_glance_api_config('DEFAULT/kombu_ssl_ca_certs').with_ensure('absent') }
it { should contain_glance_api_config('DEFAULT/kombu_ssl_certfile').with_ensure('absent') }
it { should contain_glance_api_config('DEFAULT/kombu_ssl_keyfile').with_ensure('absent') }
it { should contain_glance_api_config('DEFAULT/kombu_ssl_version').with_value('TLSv1') }
it { should contain_glance_api_config('DEFAULT/rabbit_durable_queues').with_value('true') }
it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_userid').with_value('guest2') }
it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_host').with_value('localhost2') }
it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_port').with_value('5673') }
it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_use_ssl').with_value('true') }
it { is_expected.to contain_glance_api_config('DEFAULT/kombu_ssl_ca_certs').with_ensure('absent') }
it { is_expected.to contain_glance_api_config('DEFAULT/kombu_ssl_certfile').with_ensure('absent') }
it { is_expected.to contain_glance_api_config('DEFAULT/kombu_ssl_keyfile').with_ensure('absent') }
it { is_expected.to contain_glance_api_config('DEFAULT/kombu_ssl_version').with_value('TLSv1') }
it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_durable_queues').with_value('true') }
end
end
@ -61,11 +61,11 @@ describe 'glance::notify::rabbitmq' do
:kombu_ssl_version => 'TLSv1',
}
end
it { should contain_glance_api_config('DEFAULT/rabbit_use_ssl').with_value(true) }
it { should contain_glance_api_config('DEFAULT/kombu_ssl_ca_certs').with_value('/etc/ca.cert') }
it { should contain_glance_api_config('DEFAULT/kombu_ssl_certfile').with_value('/etc/certfile') }
it { should contain_glance_api_config('DEFAULT/kombu_ssl_keyfile').with_value('/etc/key') }
it { should contain_glance_api_config('DEFAULT/kombu_ssl_version').with_value('TLSv1') }
it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_use_ssl').with_value(true) }
it { is_expected.to contain_glance_api_config('DEFAULT/kombu_ssl_ca_certs').with_value('/etc/ca.cert') }
it { is_expected.to contain_glance_api_config('DEFAULT/kombu_ssl_certfile').with_value('/etc/certfile') }
it { is_expected.to contain_glance_api_config('DEFAULT/kombu_ssl_keyfile').with_value('/etc/key') }
it { is_expected.to contain_glance_api_config('DEFAULT/kombu_ssl_version').with_value('TLSv1') }
end
describe 'with rabbit ssl disabled' do
@ -80,11 +80,11 @@ describe 'glance::notify::rabbitmq' do
}
end
it { should contain_glance_api_config('DEFAULT/rabbit_use_ssl').with_value('false') }
it { should contain_glance_api_config('DEFAULT/kombu_ssl_ca_certs').with_ensure('absent') }
it { should contain_glance_api_config('DEFAULT/kombu_ssl_certfile').with_ensure('absent') }
it { should contain_glance_api_config('DEFAULT/kombu_ssl_keyfile').with_ensure('absent') }
it { should contain_glance_api_config('DEFAULT/kombu_ssl_version').with_ensure('absent') }
it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_use_ssl').with_value('false') }
it { is_expected.to contain_glance_api_config('DEFAULT/kombu_ssl_ca_certs').with_ensure('absent') }
it { is_expected.to contain_glance_api_config('DEFAULT/kombu_ssl_certfile').with_ensure('absent') }
it { is_expected.to contain_glance_api_config('DEFAULT/kombu_ssl_keyfile').with_ensure('absent') }
it { is_expected.to contain_glance_api_config('DEFAULT/kombu_ssl_version').with_ensure('absent') }
end
describe 'when passing params for single rabbit host' do
@ -98,12 +98,12 @@ describe 'glance::notify::rabbitmq' do
:rabbit_durable_queues => true,
}
end
it { should contain_glance_api_config('DEFAULT/rabbit_userid').with_value('guest2') }
it { should contain_glance_api_config('DEFAULT/rabbit_host').with_value('localhost2') }
it { should contain_glance_api_config('DEFAULT/rabbit_port').with_value('5673') }
it { should contain_glance_api_config('DEFAULT/rabbit_hosts').with_value('localhost2:5673') }
it { should contain_glance_api_config('DEFAULT/rabbit_use_ssl').with_value('true') }
it { should contain_glance_api_config('DEFAULT/amqp_durable_queues').with_value('true') }
it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_userid').with_value('guest2') }
it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_host').with_value('localhost2') }
it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_port').with_value('5673') }
it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_hosts').with_value('localhost2:5673') }
it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_use_ssl').with_value('true') }
it { is_expected.to contain_glance_api_config('DEFAULT/amqp_durable_queues').with_value('true') }
end
describe 'when passing params for multiple rabbit hosts' do
@ -114,12 +114,12 @@ describe 'glance::notify::rabbitmq' do
:rabbit_hosts => ['nonlocalhost3:5673', 'nonlocalhost4:5673']
}
end
it { should contain_glance_api_config('DEFAULT/rabbit_userid').with_value('guest3') }
it { should contain_glance_api_config('DEFAULT/rabbit_hosts').with_value(
it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_userid').with_value('guest3') }
it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_hosts').with_value(
'nonlocalhost3:5673,nonlocalhost4:5673') }
it { should contain_glance_api_config('DEFAULT/rabbit_ha_queues').with_value('true') }
it { should_not contain_glance_api_config('DEFAULT/rabbit_port') }
it { should_not contain_glance_api_config('DEFAULT/rabbit_host') }
it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_ha_queues').with_value('true') }
it { is_expected.to_not contain_glance_api_config('DEFAULT/rabbit_port') }
it { is_expected.to_not contain_glance_api_config('DEFAULT/rabbit_host') }
end
describe 'when using deprecated params' do
@ -129,6 +129,6 @@ describe 'glance::notify::rabbitmq' do
:rabbit_password => 'pass'
}
end
it { should contain_glance_api_config('DEFAULT/amqp_durable_queues').with_value('true') }
it { is_expected.to contain_glance_api_config('DEFAULT/amqp_durable_queues').with_value('true') }
end
end

View File

@ -16,7 +16,7 @@ describe 'glance::policy' do
end
it 'set up the policies' do
should contain_openstacklib__policy__base('context_is_admin').with({
is_expected.to contain_openstacklib__policy__base('context_is_admin').with({
:key => 'context_is_admin',
:value => 'foo:bar'
})

View File

@ -61,9 +61,9 @@ describe 'glance::registry' do
param_set
end
it { should contain_class 'glance::registry' }
it { is_expected.to contain_class 'glance::registry' }
it { should contain_service('glance-registry').with(
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,
@ -72,10 +72,10 @@ describe 'glance::registry' do
'require' => 'Class[Glance]'
)}
it 'should only sync the db if the service is enabled' do
it 'is_expected.to only sync the db if the service is enabled' do
if param_hash[:enabled]
should contain_exec('glance-manage db_sync').with(
is_expected.to contain_exec('glance-manage db_sync').with(
'path' => '/usr/bin',
'refreshonly' => true,
'logoutput' => 'on_failure',
@ -84,35 +84,35 @@ describe 'glance::registry' do
)
end
end
it 'should configure itself' do
it 'is_expected.to configure itself' do
[
'verbose',
'debug',
'bind_port',
'bind_host',
].each do |config|
should contain_glance_registry_config("DEFAULT/#{config}").with_value(param_hash[config.intern])
is_expected.to contain_glance_registry_config("DEFAULT/#{config}").with_value(param_hash[config.intern])
end
[
'database_connection',
'database_idle_timeout',
].each do |config|
should contain_glance_registry_config("database/#{config.gsub(/database_/,'')}").with_value(param_hash[config.intern])
is_expected.to contain_glance_registry_config("database/#{config.gsub(/database_/,'')}").with_value(param_hash[config.intern])
end
[
'auth_host',
'auth_port',
'auth_protocol'
].each do |config|
should contain_glance_registry_config("keystone_authtoken/#{config}").with_value(param_hash[config.intern])
is_expected.to contain_glance_registry_config("keystone_authtoken/#{config}").with_value(param_hash[config.intern])
end
should contain_glance_registry_config('keystone_authtoken/auth_admin_prefix').with_ensure('absent')
is_expected.to contain_glance_registry_config('keystone_authtoken/auth_admin_prefix').with_ensure('absent')
if param_hash[:auth_type] == 'keystone'
should contain_glance_registry_config("paste_deploy/flavor").with_value('keystone')
should contain_glance_registry_config("keystone_authtoken/admin_tenant_name").with_value(param_hash[:keystone_tenant])
should contain_glance_registry_config("keystone_authtoken/admin_user").with_value(param_hash[:keystone_user])
should contain_glance_registry_config("keystone_authtoken/admin_password").with_value(param_hash[:keystone_password])
should contain_glance_registry_config("keystone_authtoken/admin_password").with_value(param_hash[:keystone_password]).with_secret(true)
is_expected.to contain_glance_registry_config("paste_deploy/flavor").with_value('keystone')
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)
end
end
end
@ -127,7 +127,7 @@ describe 'glance::registry' do
}
end
it { should contain_service('glance-registry').with(
it { is_expected.to contain_service('glance-registry').with(
'ensure' => nil,
'enable' => false,
'hasstatus' => true,
@ -147,7 +147,7 @@ describe 'glance::registry' do
}
end
it { should contain_glance_registry_config('paste_deploy/flavor').with_value('validoptionstring') }
it { is_expected.to contain_glance_registry_config('paste_deploy/flavor').with_value('validoptionstring') }
end
describe 'with blank pipeline' do
@ -158,7 +158,7 @@ describe 'glance::registry' do
}
end
it { should contain_glance_registry_config('paste_deploy/flavor').with_ensure('absent') }
it { is_expected.to contain_glance_registry_config('paste_deploy/flavor').with_ensure('absent') }
end
[
@ -177,7 +177,7 @@ describe 'glance::registry' do
}
end
it { expect { should contain_glance_registry_config('filter:paste_deploy/flavor') }.to\
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
@ -190,7 +190,7 @@ describe 'glance::registry' do
}
end
it { should contain_glance_registry_config('keystone_authtoken/auth_admin_prefix').with_value('/keystone/main') }
it { is_expected.to contain_glance_registry_config('keystone_authtoken/auth_admin_prefix').with_value('/keystone/main') }
end
[
@ -209,7 +209,7 @@ describe 'glance::registry' do
}
end
it { expect { should contain_glance_registry_config('filter:authtoken/auth_admin_prefix') }.to\
it { expect { is_expected.to contain_glance_registry_config('filter:authtoken/auth_admin_prefix') }.to\
raise_error(Puppet::Error, /validate_re\(\): "#{auth_admin_prefix}" does not match/) }
end
end
@ -219,8 +219,8 @@ describe 'glance::registry' do
default_params
end
it { should contain_glance_registry_config('DEFAULT/use_syslog').with_value(false) }
it { should_not contain_glance_registry_config('DEFAULT/syslog_log_facility') }
it { is_expected.to contain_glance_registry_config('DEFAULT/use_syslog').with_value(false) }
it { is_expected.to_not contain_glance_registry_config('DEFAULT/syslog_log_facility') }
end
describe 'with syslog enabled' do
@ -230,8 +230,8 @@ describe 'glance::registry' do
})
end
it { should contain_glance_registry_config('DEFAULT/use_syslog').with_value(true) }
it { should contain_glance_registry_config('DEFAULT/syslog_log_facility').with_value('LOG_USER') }
it { is_expected.to contain_glance_registry_config('DEFAULT/use_syslog').with_value(true) }
it { is_expected.to contain_glance_registry_config('DEFAULT/syslog_log_facility').with_value('LOG_USER') }
end
describe 'with syslog enabled and custom settings' do
@ -242,38 +242,38 @@ describe 'glance::registry' do
})
end
it { should contain_glance_registry_config('DEFAULT/use_syslog').with_value(true) }
it { should contain_glance_registry_config('DEFAULT/syslog_log_facility').with_value('LOG_LOCAL0') }
it { is_expected.to contain_glance_registry_config('DEFAULT/use_syslog').with_value(true) }
it { is_expected.to contain_glance_registry_config('DEFAULT/syslog_log_facility').with_value('LOG_LOCAL0') }
end
describe 'with log_file enabled by default' do
let(:params) { default_params }
it { should contain_glance_registry_config('DEFAULT/log_file').with_value(default_params[:log_file]) }
it { is_expected.to contain_glance_registry_config('DEFAULT/log_file').with_value(default_params[:log_file]) }
context 'with log_file disabled' do
let(:params) { default_params.merge!({ :log_file => false }) }
it { should contain_glance_registry_config('DEFAULT/log_file').with_ensure('absent') }
it { is_expected.to contain_glance_registry_config('DEFAULT/log_file').with_ensure('absent') }
end
end
describe 'with log_dir enabled by default' do
let(:params) { default_params }
it { should contain_glance_registry_config('DEFAULT/log_dir').with_value(default_params[:log_dir]) }
it { is_expected.to contain_glance_registry_config('DEFAULT/log_dir').with_value(default_params[:log_dir]) }
context 'with log_dir disabled' do
let(:params) { default_params.merge!({ :log_dir => false }) }
it { should contain_glance_registry_config('DEFAULT/log_dir').with_ensure('absent') }
it { is_expected.to contain_glance_registry_config('DEFAULT/log_dir').with_ensure('absent') }
end
end
describe 'with no ssl options (default)' do
let(:params) { default_params }
it { should contain_glance_registry_config('DEFAULT/ca_file').with_ensure('absent')}
it { should contain_glance_registry_config('DEFAULT/cert_file').with_ensure('absent')}
it { should contain_glance_registry_config('DEFAULT/key_file').with_ensure('absent')}
it { is_expected.to contain_glance_registry_config('DEFAULT/ca_file').with_ensure('absent')}
it { is_expected.to contain_glance_registry_config('DEFAULT/cert_file').with_ensure('absent')}
it { is_expected.to contain_glance_registry_config('DEFAULT/key_file').with_ensure('absent')}
end
describe 'with ssl options' do
@ -286,9 +286,9 @@ describe 'glance::registry' do
end
context 'with ssl options' do
it { should contain_glance_registry_config('DEFAULT/ca_file').with_value('/tmp/ca_file') }
it { should contain_glance_registry_config('DEFAULT/cert_file').with_value('/tmp/cert_file') }
it { should contain_glance_registry_config('DEFAULT/key_file').with_value('/tmp/key_file') }
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
@ -306,12 +306,12 @@ describe 'glance::registry' do
})
end
it 'configures identity_uri' do
should contain_glance_registry_config('keystone_authtoken/identity_uri').with_value("https://foo.bar:1234/");
# since only auth_uri is set the deprecated auth parameters should
is_expected.to contain_glance_registry_config('keystone_authtoken/identity_uri').with_value("https://foo.bar:1234/");
# since only auth_uri is set the deprecated auth parameters is_expected.to
# still get set in case they are still in use
should contain_glance_registry_config('keystone_authtoken/auth_host').with_value('127.0.0.1');
should contain_glance_registry_config('keystone_authtoken/auth_port').with_value('35357');
should contain_glance_registry_config('keystone_authtoken/auth_protocol').with_value('http');
is_expected.to contain_glance_registry_config('keystone_authtoken/auth_host').with_value('127.0.0.1');
is_expected.to contain_glance_registry_config('keystone_authtoken/auth_port').with_value('35357');
is_expected.to contain_glance_registry_config('keystone_authtoken/auth_protocol').with_value('http');
end
end
@ -323,12 +323,12 @@ describe 'glance::registry' do
})
end
it 'configures identity_uri' do
should contain_glance_registry_config('keystone_authtoken/identity_uri').with_value("https://foo.bar:35357/");
should contain_glance_registry_config('keystone_authtoken/auth_uri').with_value("https://foo.bar:5000/v2.0/");
should contain_glance_registry_config('keystone_authtoken/auth_host').with_ensure('absent')
should contain_glance_registry_config('keystone_authtoken/auth_port').with_ensure('absent')
should contain_glance_registry_config('keystone_authtoken/auth_protocol').with_ensure('absent')
should contain_glance_registry_config('keystone_authtoken/auth_admin_prefix').with_ensure('absent')
is_expected.to contain_glance_registry_config('keystone_authtoken/identity_uri').with_value("https://foo.bar:35357/");
is_expected.to contain_glance_registry_config('keystone_authtoken/auth_uri').with_value("https://foo.bar:5000/v2.0/");
is_expected.to contain_glance_registry_config('keystone_authtoken/auth_host').with_ensure('absent')
is_expected.to contain_glance_registry_config('keystone_authtoken/auth_port').with_ensure('absent')
is_expected.to contain_glance_registry_config('keystone_authtoken/auth_protocol').with_ensure('absent')
is_expected.to contain_glance_registry_config('keystone_authtoken/auth_admin_prefix').with_ensure('absent')
end
end
end
@ -343,7 +343,7 @@ describe 'glance::registry' do
['present', 'latest'].each do |package_ensure|
context "with package_ensure '#{package_ensure}'" do
let(:params) { default_params.merge({ :package_ensure => package_ensure }) }
it { should contain_package('glance-registry').with(
it { is_expected.to contain_package('glance-registry').with(
:ensure => package_ensure,
:tag => ['openstack']
)}
@ -357,7 +357,7 @@ describe 'glance::registry' do
end
let(:params) { default_params }
it { should contain_package('openstack-glance')}
it { is_expected.to contain_package('openstack-glance')}
end
describe 'on unknown platforms' do
@ -366,9 +366,7 @@ describe 'glance::registry' do
end
let(:params) { default_params }
it 'should fails to configure glance-registry' do
expect { subject }.to raise_error(Puppet::Error, /module glance only support osfamily RedHat and Debian/)
end
it_raises 'a Puppet::Error', /module glance only support osfamily RedHat and Debian/
end
end

View File

@ -25,7 +25,7 @@ describe 'glance' do
let :params do param_set end
it { should contain_file('/etc/glance/').with(
it { is_expected.to contain_file('/etc/glance/').with(
'ensure' => 'directory',
'owner' => 'glance',
'mode' => '0770'
@ -40,7 +40,7 @@ describe 'glance' do
end
let(:params) { default_params }
it { should_not contain_package('glance') }
it { is_expected.to_not contain_package('glance') }
end
describe 'on RedHat platforms' do
@ -49,7 +49,7 @@ describe 'glance' do
end
let(:params) { default_params }
it { should contain_package('openstack-glance').with(
it { is_expected.to contain_package('openstack-glance').with(
:tag => ['openstack'],
)}
end

View File

@ -1,5 +1,5 @@
shared_examples_for "a Puppet::Error" do |description|
it "with message matching #{description.inspect}" do
expect { should have_class_count(1) }.to raise_error(Puppet::Error, description)
expect { is_expected.to have_class_count(1) }.to raise_error(Puppet::Error, description)
end
end

View File

@ -2,6 +2,6 @@ require 'puppetlabs_spec_helper/module_spec_helper'
require 'shared_examples'
RSpec.configure do |c|
c.alias_it_should_behave_like_to :it_configures, 'configures'
c.alias_it_should_behave_like_to :it_raises, 'raises'
c.alias_it_should_behave_like_to :it_configures, 'configures'
c.alias_it_should_behave_like_to :it_raises, 'raises'
end