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 order to be prepared for rspec 3.x move. In details: * Upgrade and pin rspec-puppet from 1.0.1 to 2.0.0 * Convert 'should' keyword to 'is_expected.to' (prepare rspec 3.x) * * Fix spec tests for rspec-puppet 2.0.0 * Clean Gemfile (remove over-specificication of runtime deps of puppetlabs_spec_helper) Change-Id: Iabbf445ef82037dcf2ece0477f3c82d449ac689a Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
This commit is contained in:
parent
1b44b7d826
commit
f1ca7eb98a
5
Gemfile
5
Gemfile
@ -2,8 +2,8 @@ source 'https://rubygems.org'
|
||||
|
||||
group :development, :test do
|
||||
gem 'puppetlabs_spec_helper', :require => false
|
||||
gem 'rspec-puppet', '~> 2.0.0', :require => false
|
||||
|
||||
gem 'puppet-lint', '~> 1.1.0'
|
||||
gem 'metadata-json-lint'
|
||||
gem 'puppet-lint-absolute_classname-check'
|
||||
gem 'puppet-lint-absolute_template_path'
|
||||
@ -15,9 +15,6 @@ group :development, :test do
|
||||
gem 'puppet-lint-variable_contains_upcase'
|
||||
gem 'puppet-lint-numericvariable'
|
||||
|
||||
gem 'rspec-puppet', '~> 1.0.1'
|
||||
gem 'rake', '10.1.1'
|
||||
gem 'rspec', '< 2.99'
|
||||
gem 'json'
|
||||
gem 'webmock'
|
||||
end
|
||||
|
@ -41,32 +41,32 @@ describe 'ironic::api' do
|
||||
default_params.merge(params)
|
||||
end
|
||||
|
||||
it { should contain_class('ironic::params') }
|
||||
it { should contain_class('ironic::policy') }
|
||||
it { is_expected.to contain_class('ironic::params') }
|
||||
it { is_expected.to contain_class('ironic::policy') }
|
||||
|
||||
it 'installs ironic api package' do
|
||||
if platform_params.has_key?(:api_package)
|
||||
should contain_package('ironic-api').with(
|
||||
is_expected.to contain_package('ironic-api').with(
|
||||
:name => platform_params[:api_package],
|
||||
:ensure => p[:package_ensure]
|
||||
)
|
||||
should contain_package('ironic-api').with_before(/Ironic_config\[.+\]/)
|
||||
should contain_package('ironic-api').with_before(/Service\[ironic-api\]/)
|
||||
is_expected.to contain_package('ironic-api').with_before(/Ironic_config\[.+\]/)
|
||||
is_expected.to contain_package('ironic-api').with_before(/Service\[ironic-api\]/)
|
||||
end
|
||||
end
|
||||
|
||||
it 'ensure ironic api service is running' do
|
||||
should contain_service('ironic-api').with('hasstatus' => true)
|
||||
is_expected.to contain_service('ironic-api').with('hasstatus' => true)
|
||||
end
|
||||
|
||||
it 'configures ironic.conf' do
|
||||
should contain_ironic_config('api/port').with_value(p[:port])
|
||||
should contain_ironic_config('api/host_ip').with_value(p[:host_ip])
|
||||
should contain_ironic_config('api/max_limit').with_value(p[:max_limit])
|
||||
should contain_ironic_config('keystone_authtoken/admin_password').with_value(p[:admin_password])
|
||||
should contain_ironic_config('keystone_authtoken/admin_user').with_value(p[:admin_user])
|
||||
should contain_ironic_config('keystone_authtoken/auth_uri').with_value('http://127.0.0.1:5000/')
|
||||
should contain_ironic_config('neutron/url').with_value('http://127.0.0.1:9696/')
|
||||
is_expected.to contain_ironic_config('api/port').with_value(p[:port])
|
||||
is_expected.to contain_ironic_config('api/host_ip').with_value(p[:host_ip])
|
||||
is_expected.to contain_ironic_config('api/max_limit').with_value(p[:max_limit])
|
||||
is_expected.to contain_ironic_config('keystone_authtoken/admin_password').with_value(p[:admin_password])
|
||||
is_expected.to contain_ironic_config('keystone_authtoken/admin_user').with_value(p[:admin_user])
|
||||
is_expected.to contain_ironic_config('keystone_authtoken/auth_uri').with_value('http://127.0.0.1:5000/')
|
||||
is_expected.to contain_ironic_config('neutron/url').with_value('http://127.0.0.1:9696/')
|
||||
end
|
||||
|
||||
context 'when overriding parameters' do
|
||||
@ -80,10 +80,10 @@ describe 'ironic::api' do
|
||||
)
|
||||
end
|
||||
it 'should replace default parameter with new value' do
|
||||
should contain_ironic_config('api/port').with_value(p[:port])
|
||||
should contain_ironic_config('api/host_ip').with_value(p[:host_ip])
|
||||
should contain_ironic_config('api/max_limit').with_value(p[:max_limit])
|
||||
should contain_ironic_config('keystone_authtoken/auth_uri').with_value('https://1.2.3.4:5000/')
|
||||
is_expected.to contain_ironic_config('api/port').with_value(p[:port])
|
||||
is_expected.to contain_ironic_config('api/host_ip').with_value(p[:host_ip])
|
||||
is_expected.to contain_ironic_config('api/max_limit').with_value(p[:max_limit])
|
||||
is_expected.to contain_ironic_config('keystone_authtoken/auth_uri').with_value('https://1.2.3.4:5000/')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -27,7 +27,7 @@ describe 'ironic::client' do
|
||||
{ :osfamily => 'Debian' }
|
||||
end
|
||||
|
||||
it { should contain_class('ironic::client') }
|
||||
it { is_expected.to contain_class('ironic::client') }
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
@ -35,6 +35,6 @@ describe 'ironic::client' do
|
||||
{ :osfamily => 'RedHat' }
|
||||
end
|
||||
|
||||
it { should contain_class('ironic::client') }
|
||||
it { is_expected.to contain_class('ironic::client') }
|
||||
end
|
||||
end
|
||||
|
@ -37,25 +37,25 @@ describe 'ironic::conductor' do
|
||||
default_params.merge(params)
|
||||
end
|
||||
|
||||
it { should contain_class('ironic::params') }
|
||||
it { is_expected.to contain_class('ironic::params') }
|
||||
|
||||
it 'installs ironic conductor package' do
|
||||
if platform_params.has_key?(:conductor_package)
|
||||
should contain_package('ironic-conductor').with(
|
||||
is_expected.to contain_package('ironic-conductor').with(
|
||||
:name => platform_params[:conductor_package],
|
||||
:ensure => p[:package_ensure]
|
||||
)
|
||||
should contain_package('ironic-conductor').with_before(/Ironic_config\[.+\]/)
|
||||
should contain_package('ironic-conductor').with_before(/Service\[ironic-conductor\]/)
|
||||
is_expected.to contain_package('ironic-conductor').with_before(/Ironic_config\[.+\]/)
|
||||
is_expected.to contain_package('ironic-conductor').with_before(/Service\[ironic-conductor\]/)
|
||||
end
|
||||
end
|
||||
|
||||
it 'ensure ironic conductor service is running' do
|
||||
should contain_service('ironic-conductor').with('hasstatus' => true)
|
||||
is_expected.to contain_service('ironic-conductor').with('hasstatus' => true)
|
||||
end
|
||||
|
||||
it 'configures ironic.conf' do
|
||||
should contain_ironic_config('conductor/max_time_interval').with_value(p[:max_time_interval])
|
||||
is_expected.to contain_ironic_config('conductor/max_time_interval').with_value(p[:max_time_interval])
|
||||
end
|
||||
|
||||
context 'when overriding parameters' do
|
||||
@ -63,7 +63,7 @@ describe 'ironic::conductor' do
|
||||
params.merge!(:max_time_interval => '50')
|
||||
end
|
||||
it 'should replace default parameter with new value' do
|
||||
should contain_ironic_config('conductor/max_time_interval').with_value(p[:max_time_interval])
|
||||
is_expected.to contain_ironic_config('conductor/max_time_interval').with_value(p[:max_time_interval])
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -39,7 +39,7 @@ describe 'ironic::db::mysql' do
|
||||
{ :osfamily => 'Debian' }
|
||||
end
|
||||
|
||||
it { should contain_openstacklib__db__mysql('ironic').with(
|
||||
it { is_expected.to contain_openstacklib__db__mysql('ironic').with(
|
||||
:user => 'ironic',
|
||||
:password_hash => '*74B1C21ACE0C2D6B0678A5E503D2A60E8F9651A3',
|
||||
:charset => 'utf8'
|
||||
@ -51,7 +51,7 @@ describe 'ironic::db::mysql' do
|
||||
{ :osfamily => 'RedHat' }
|
||||
end
|
||||
|
||||
it { should contain_openstacklib__db__mysql('ironic').with(
|
||||
it { is_expected.to contain_openstacklib__db__mysql('ironic').with(
|
||||
:user => 'ironic',
|
||||
:password_hash => '*74B1C21ACE0C2D6B0678A5E503D2A60E8F9651A3',
|
||||
:charset => 'utf8'
|
||||
|
@ -36,7 +36,7 @@ describe 'ironic::drivers::ipmi' do
|
||||
end
|
||||
|
||||
it 'configures ironic.conf' do
|
||||
should contain_ironic_config('ipmi/retry_timeout').with_value(p[:retry_timeout])
|
||||
is_expected.to contain_ironic_config('ipmi/retry_timeout').with_value(p[:retry_timeout])
|
||||
end
|
||||
|
||||
context 'when overriding parameters' do
|
||||
@ -44,7 +44,7 @@ describe 'ironic::drivers::ipmi' do
|
||||
params.merge!(:retry_timeout => '50')
|
||||
end
|
||||
it 'should replace default parameter with new value' do
|
||||
should contain_ironic_config('ipmi/retry_timeout').with_value(p[:retry_timeout])
|
||||
is_expected.to contain_ironic_config('ipmi/retry_timeout').with_value(p[:retry_timeout])
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -43,14 +43,14 @@ describe 'ironic::drivers::pxe' do
|
||||
end
|
||||
|
||||
it 'configures ironic.conf' do
|
||||
should contain_ironic_config('pxe/pxe_append_params').with_value(p[:pxe_append_params])
|
||||
should contain_ironic_config('pxe/pxe_config_template').with_value(p[:pxe_config_template])
|
||||
should contain_ironic_config('pxe/pxe_deploy_timeout').with_value(p[:pxe_deploy_timeout])
|
||||
should contain_ironic_config('pxe/tftp_server').with_value(p[:tftp_server])
|
||||
should contain_ironic_config('pxe/tftp_root').with_value(p[:tftp_root])
|
||||
should contain_ironic_config('pxe/images_path').with_value(p[:images_path])
|
||||
should contain_ironic_config('pxe/tftp_master_path').with_value(p[:tftp_master_path])
|
||||
should contain_ironic_config('pxe/instance_master_path').with_value(p[:instance_master_path])
|
||||
is_expected.to contain_ironic_config('pxe/pxe_append_params').with_value(p[:pxe_append_params])
|
||||
is_expected.to contain_ironic_config('pxe/pxe_config_template').with_value(p[:pxe_config_template])
|
||||
is_expected.to contain_ironic_config('pxe/pxe_deploy_timeout').with_value(p[:pxe_deploy_timeout])
|
||||
is_expected.to contain_ironic_config('pxe/tftp_server').with_value(p[:tftp_server])
|
||||
is_expected.to contain_ironic_config('pxe/tftp_root').with_value(p[:tftp_root])
|
||||
is_expected.to contain_ironic_config('pxe/images_path').with_value(p[:images_path])
|
||||
is_expected.to contain_ironic_config('pxe/tftp_master_path').with_value(p[:tftp_master_path])
|
||||
is_expected.to contain_ironic_config('pxe/instance_master_path').with_value(p[:instance_master_path])
|
||||
end
|
||||
|
||||
context 'when overriding parameters' do
|
||||
@ -70,16 +70,16 @@ describe 'ironic::drivers::pxe' do
|
||||
end
|
||||
|
||||
it 'should replace default parameter with new value' do
|
||||
should contain_ironic_config('pxe/deploy_kernel').with_value(p[:deploy_kernel])
|
||||
should contain_ironic_config('pxe/deploy_ramdisk').with_value(p[:deploy_ramdisk])
|
||||
should contain_ironic_config('pxe/pxe_append_params').with_value(p[:pxe_append_params])
|
||||
should contain_ironic_config('pxe/pxe_config_template').with_value(p[:pxe_config_template])
|
||||
should contain_ironic_config('pxe/pxe_deploy_timeout').with_value(p[:pxe_deploy_timeout])
|
||||
should contain_ironic_config('pxe/tftp_server').with_value(p[:tftp_server])
|
||||
should contain_ironic_config('pxe/tftp_root').with_value(p[:tftp_root])
|
||||
should contain_ironic_config('pxe/images_path').with_value(p[:images_path])
|
||||
should contain_ironic_config('pxe/tftp_master_path').with_value(p[:tftp_master_path])
|
||||
should contain_ironic_config('pxe/instance_master_path').with_value(p[:instance_master_path])
|
||||
is_expected.to contain_ironic_config('pxe/deploy_kernel').with_value(p[:deploy_kernel])
|
||||
is_expected.to contain_ironic_config('pxe/deploy_ramdisk').with_value(p[:deploy_ramdisk])
|
||||
is_expected.to contain_ironic_config('pxe/pxe_append_params').with_value(p[:pxe_append_params])
|
||||
is_expected.to contain_ironic_config('pxe/pxe_config_template').with_value(p[:pxe_config_template])
|
||||
is_expected.to contain_ironic_config('pxe/pxe_deploy_timeout').with_value(p[:pxe_deploy_timeout])
|
||||
is_expected.to contain_ironic_config('pxe/tftp_server').with_value(p[:tftp_server])
|
||||
is_expected.to contain_ironic_config('pxe/tftp_root').with_value(p[:tftp_root])
|
||||
is_expected.to contain_ironic_config('pxe/images_path').with_value(p[:images_path])
|
||||
is_expected.to contain_ironic_config('pxe/tftp_master_path').with_value(p[:tftp_master_path])
|
||||
is_expected.to contain_ironic_config('pxe/instance_master_path').with_value(p[:instance_master_path])
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -78,14 +78,14 @@ describe 'ironic' do
|
||||
before do
|
||||
params.merge!(:database_connection => 'sqlite:////var/lib/ironic/ironic.sqlite')
|
||||
end
|
||||
it { should contain_package('ironic-database-backend').with_name('python-pysqlite2')}
|
||||
it { is_expected.to contain_package('ironic-database-backend').with_name('python-pysqlite2')}
|
||||
end
|
||||
|
||||
context 'with postgresql database backend' do
|
||||
before do
|
||||
params.merge!(:database_connection => 'postgresql://ironic:ironic@localhost/ironic')
|
||||
end
|
||||
it { should contain_package('ironic-database-backend').with_name('python-psycopg2')}
|
||||
it { is_expected.to contain_package('ironic-database-backend').with_name('python-psycopg2')}
|
||||
end
|
||||
|
||||
it_configures 'with syslog disabled'
|
||||
@ -95,10 +95,10 @@ describe 'ironic' do
|
||||
|
||||
shared_examples_for 'a ironic base installation' do
|
||||
|
||||
it { should contain_class('ironic::params') }
|
||||
it { is_expected.to contain_class('ironic::params') }
|
||||
|
||||
it 'configures ironic configuration folder' do
|
||||
should contain_file('/etc/ironic/').with(
|
||||
is_expected.to contain_file('/etc/ironic/').with(
|
||||
:ensure => 'directory',
|
||||
:owner => 'root',
|
||||
:group => 'ironic',
|
||||
@ -108,7 +108,7 @@ describe 'ironic' do
|
||||
end
|
||||
|
||||
it 'configures ironic configuration file' do
|
||||
should contain_file('/etc/ironic/ironic.conf').with(
|
||||
is_expected.to contain_file('/etc/ironic/ironic.conf').with(
|
||||
:owner => 'root',
|
||||
:group => 'ironic',
|
||||
:mode => '0640',
|
||||
@ -117,62 +117,62 @@ describe 'ironic' do
|
||||
end
|
||||
|
||||
it 'installs ironic package' do
|
||||
should contain_package('ironic-common').with(
|
||||
is_expected.to contain_package('ironic-common').with(
|
||||
:ensure => 'present',
|
||||
:name => platform_params[:common_package_name],
|
||||
)
|
||||
end
|
||||
|
||||
it 'configures enabled_drivers' do
|
||||
should contain_ironic_config('DEFAULT/enabled_drivers').with_value( params[:enabled_drivers] )
|
||||
is_expected.to contain_ironic_config('DEFAULT/enabled_drivers').with_value( params[:enabled_drivers] )
|
||||
end
|
||||
|
||||
it 'configures credentials for rabbit' do
|
||||
should contain_ironic_config('DEFAULT/rabbit_userid').with_value( params[:rabbit_user] )
|
||||
should contain_ironic_config('DEFAULT/rabbit_password').with_value( params[:rabbit_password] )
|
||||
should contain_ironic_config('DEFAULT/rabbit_virtual_host').with_value( params[:rabbit_virtual_host] )
|
||||
should contain_ironic_config('DEFAULT/rabbit_password').with_secret( true )
|
||||
is_expected.to contain_ironic_config('DEFAULT/rabbit_userid').with_value( params[:rabbit_user] )
|
||||
is_expected.to contain_ironic_config('DEFAULT/rabbit_password').with_value( params[:rabbit_password] )
|
||||
is_expected.to contain_ironic_config('DEFAULT/rabbit_virtual_host').with_value( params[:rabbit_virtual_host] )
|
||||
is_expected.to contain_ironic_config('DEFAULT/rabbit_password').with_secret( true )
|
||||
end
|
||||
|
||||
it 'should perform default database configuration' do
|
||||
should contain_ironic_config('database/connection').with_value(params[:database_connection])
|
||||
should contain_ironic_config('database/max_retries').with_value(params[:database_max_retries])
|
||||
should contain_ironic_config('database/idle_timeout').with_value(params[:database_idle_timeout])
|
||||
should contain_ironic_config('database/retry_interval').with_value(params[:database_retry_interval])
|
||||
is_expected.to contain_ironic_config('database/connection').with_value(params[:database_connection])
|
||||
is_expected.to contain_ironic_config('database/max_retries').with_value(params[:database_max_retries])
|
||||
is_expected.to contain_ironic_config('database/idle_timeout').with_value(params[:database_idle_timeout])
|
||||
is_expected.to contain_ironic_config('database/retry_interval').with_value(params[:database_retry_interval])
|
||||
end
|
||||
|
||||
it 'configures glance connection' do
|
||||
should contain_ironic_config('glance/glance_num_retries').with_value(params[:glance_num_retries])
|
||||
should contain_ironic_config('glance/glance_api_insecure').with_value(params[:glance_api_insecure])
|
||||
is_expected.to contain_ironic_config('glance/glance_num_retries').with_value(params[:glance_num_retries])
|
||||
is_expected.to contain_ironic_config('glance/glance_api_insecure').with_value(params[:glance_api_insecure])
|
||||
end
|
||||
|
||||
it 'configures ironic.conf' do
|
||||
should contain_ironic_config('DEFAULT/verbose').with_value( params[:verbose] )
|
||||
should contain_ironic_config('DEFAULT/auth_strategy').with_value('keystone')
|
||||
should contain_ironic_config('DEFAULT/control_exchange').with_value('openstack')
|
||||
is_expected.to contain_ironic_config('DEFAULT/verbose').with_value( params[:verbose] )
|
||||
is_expected.to contain_ironic_config('DEFAULT/auth_strategy').with_value('keystone')
|
||||
is_expected.to contain_ironic_config('DEFAULT/control_exchange').with_value('openstack')
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'rabbit HA with a single virtual host' do
|
||||
it 'in ironic.conf' do
|
||||
should_not contain_ironic_config('DEFAULT/rabbit_host')
|
||||
should_not contain_ironic_config('DEFAULT/rabbit_port')
|
||||
should contain_ironic_config('DEFAULT/rabbit_hosts').with_value( params[:rabbit_hosts] )
|
||||
should contain_ironic_config('DEFAULT/rabbit_ha_queues').with_value(true)
|
||||
is_expected.not_to contain_ironic_config('DEFAULT/rabbit_host')
|
||||
is_expected.not_to contain_ironic_config('DEFAULT/rabbit_port')
|
||||
is_expected.to contain_ironic_config('DEFAULT/rabbit_hosts').with_value( params[:rabbit_hosts] )
|
||||
is_expected.to contain_ironic_config('DEFAULT/rabbit_ha_queues').with_value(true)
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'rabbit HA with multiple hosts' do
|
||||
it 'in ironic.conf' do
|
||||
should_not contain_ironic_config('DEFAULT/rabbit_host')
|
||||
should_not contain_ironic_config('DEFAULT/rabbit_port')
|
||||
should contain_ironic_config('DEFAULT/rabbit_hosts').with_value( params[:rabbit_hosts].join(',') )
|
||||
should contain_ironic_config('DEFAULT/rabbit_ha_queues').with_value(true)
|
||||
is_expected.not_to contain_ironic_config('DEFAULT/rabbit_host')
|
||||
is_expected.not_to contain_ironic_config('DEFAULT/rabbit_port')
|
||||
is_expected.to contain_ironic_config('DEFAULT/rabbit_hosts').with_value( params[:rabbit_hosts].join(',') )
|
||||
is_expected.to contain_ironic_config('DEFAULT/rabbit_ha_queues').with_value(true)
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'with syslog disabled' do
|
||||
it { should contain_ironic_config('DEFAULT/use_syslog').with_value(false) }
|
||||
it { is_expected.to contain_ironic_config('DEFAULT/use_syslog').with_value(false) }
|
||||
end
|
||||
|
||||
shared_examples_for 'with syslog enabled' do
|
||||
@ -181,8 +181,8 @@ describe 'ironic' do
|
||||
end
|
||||
|
||||
it do
|
||||
should contain_ironic_config('DEFAULT/use_syslog').with_value(true)
|
||||
should contain_ironic_config('DEFAULT/syslog_log_facility').with_value('LOG_USER')
|
||||
is_expected.to contain_ironic_config('DEFAULT/use_syslog').with_value(true)
|
||||
is_expected.to contain_ironic_config('DEFAULT/syslog_log_facility').with_value('LOG_USER')
|
||||
end
|
||||
end
|
||||
|
||||
@ -195,8 +195,8 @@ describe 'ironic' do
|
||||
end
|
||||
|
||||
it do
|
||||
should contain_ironic_config('DEFAULT/use_syslog').with_value(true)
|
||||
should contain_ironic_config('DEFAULT/syslog_log_facility').with_value('LOG_LOCAL0')
|
||||
is_expected.to contain_ironic_config('DEFAULT/use_syslog').with_value(true)
|
||||
is_expected.to contain_ironic_config('DEFAULT/syslog_log_facility').with_value('LOG_LOCAL0')
|
||||
end
|
||||
end
|
||||
|
||||
@ -206,7 +206,7 @@ describe 'ironic' do
|
||||
end
|
||||
|
||||
it 'should configure one glance server' do
|
||||
should contain_ironic_config('glance/glance_api_servers').with_value(p[:glance_api_servers])
|
||||
is_expected.to contain_ironic_config('glance/glance_api_servers').with_value(p[:glance_api_servers])
|
||||
end
|
||||
end
|
||||
|
||||
@ -216,7 +216,7 @@ describe 'ironic' do
|
||||
end
|
||||
|
||||
it 'should configure one glance server' do
|
||||
should contain_ironic_config('glance/glance_api_servers').with_value(p[:glance_api_servers].join(','))
|
||||
is_expected.to contain_ironic_config('glance/glance_api_servers').with_value(p[:glance_api_servers].join(','))
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -32,24 +32,24 @@ describe 'ironic::keystone::auth' do
|
||||
:tenant => 'foobar' }
|
||||
end
|
||||
|
||||
it { should contain_keystone_user('ironic').with(
|
||||
it { is_expected.to contain_keystone_user('ironic').with(
|
||||
:ensure => 'present',
|
||||
:password => 'ironic_password',
|
||||
:tenant => 'foobar'
|
||||
) }
|
||||
|
||||
it { should contain_keystone_user_role('ironic@foobar').with(
|
||||
it { is_expected.to contain_keystone_user_role('ironic@foobar').with(
|
||||
:ensure => 'present',
|
||||
:roles => 'admin'
|
||||
)}
|
||||
|
||||
it { should contain_keystone_service('ironic').with(
|
||||
it { is_expected.to contain_keystone_service('ironic').with(
|
||||
:ensure => 'present',
|
||||
:type => 'baremetal',
|
||||
:description => 'Ironic Networking Service'
|
||||
) }
|
||||
|
||||
it { should contain_keystone_endpoint('RegionOne/ironic').with(
|
||||
it { is_expected.to contain_keystone_endpoint('RegionOne/ironic').with(
|
||||
:ensure => 'present',
|
||||
:public_url => "http://127.0.0.1:6385/",
|
||||
:admin_url => "http://127.0.0.1:6385/",
|
||||
@ -81,7 +81,7 @@ describe 'ironic::keystone::auth' do
|
||||
:admin_address => '10.10.10.12' }
|
||||
end
|
||||
|
||||
it { should contain_keystone_endpoint('RegionOne/ironic').with(
|
||||
it { is_expected.to contain_keystone_endpoint('RegionOne/ironic').with(
|
||||
:ensure => 'present',
|
||||
:public_url => "https://10.10.10.10:80/",
|
||||
:internal_url => "http://10.10.10.11:81/",
|
||||
@ -95,10 +95,10 @@ describe 'ironic::keystone::auth' do
|
||||
:auth_name => 'ironicy' }
|
||||
end
|
||||
|
||||
it { should contain_keystone_user('ironicy') }
|
||||
it { should contain_keystone_user_role('ironicy@services') }
|
||||
it { should contain_keystone_service('ironicy') }
|
||||
it { should contain_keystone_endpoint('RegionOne/ironicy') }
|
||||
it { is_expected.to contain_keystone_user('ironicy') }
|
||||
it { is_expected.to contain_keystone_user_role('ironicy@services') }
|
||||
it { is_expected.to contain_keystone_service('ironicy') }
|
||||
it { is_expected.to contain_keystone_endpoint('RegionOne/ironicy') }
|
||||
end
|
||||
|
||||
describe 'when overriding service name' do
|
||||
@ -109,10 +109,10 @@ describe 'ironic::keystone::auth' do
|
||||
}
|
||||
end
|
||||
|
||||
it { should contain_keystone_user('ironic') }
|
||||
it { should contain_keystone_user_role('ironic@services') }
|
||||
it { should contain_keystone_service('ironic_service') }
|
||||
it { should contain_keystone_endpoint('RegionOne/ironic_service') }
|
||||
it { is_expected.to contain_keystone_user('ironic') }
|
||||
it { is_expected.to contain_keystone_user_role('ironic@services') }
|
||||
it { is_expected.to contain_keystone_service('ironic_service') }
|
||||
it { is_expected.to contain_keystone_endpoint('RegionOne/ironic_service') }
|
||||
end
|
||||
|
||||
describe 'when disabling user configuration' do
|
||||
@ -124,11 +124,11 @@ describe 'ironic::keystone::auth' do
|
||||
}
|
||||
end
|
||||
|
||||
it { should_not contain_keystone_user('ironic') }
|
||||
it { is_expected.not_to contain_keystone_user('ironic') }
|
||||
|
||||
it { should contain_keystone_user_role('ironic@services') }
|
||||
it { is_expected.to contain_keystone_user_role('ironic@services') }
|
||||
|
||||
it { should contain_keystone_service('ironic').with(
|
||||
it { is_expected.to contain_keystone_service('ironic').with(
|
||||
:ensure => 'present',
|
||||
:type => 'baremetal',
|
||||
:description => 'Ironic Networking Service'
|
||||
@ -146,11 +146,11 @@ describe 'ironic::keystone::auth' do
|
||||
}
|
||||
end
|
||||
|
||||
it { should_not contain_keystone_user('ironic') }
|
||||
it { is_expected.not_to contain_keystone_user('ironic') }
|
||||
|
||||
it { should_not contain_keystone_user_role('ironic@services') }
|
||||
it { is_expected.not_to contain_keystone_user_role('ironic@services') }
|
||||
|
||||
it { should contain_keystone_service('ironic').with(
|
||||
it { is_expected.to contain_keystone_service('ironic').with(
|
||||
:ensure => 'present',
|
||||
:type => 'baremetal',
|
||||
:description => 'Ironic Networking Service'
|
||||
|
@ -16,7 +16,7 @@ describe 'ironic::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'
|
||||
})
|
||||
|
@ -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
|
||||
|
@ -61,7 +61,7 @@ describe Puppet::Provider::Ironic do
|
||||
it 'should use specified host/port/protocol in the auth endpoint' do
|
||||
conf = {'keystone_authtoken' => credential_hash}
|
||||
klass.expects(:ironic_conf).returns(conf)
|
||||
klass.get_auth_endpoint.should == auth_endpoint
|
||||
expect(klass.get_auth_endpoint).to eq(auth_endpoint)
|
||||
end
|
||||
|
||||
end
|
||||
@ -103,7 +103,7 @@ describe Puppet::Provider::Ironic do
|
||||
EOT
|
||||
klass.expects(:auth_ironic).returns(output)
|
||||
result = klass.list_ironic_resources('foo')
|
||||
result.should eql(['net1', 'net2'])
|
||||
expect(result).to eql(['net1', 'net2'])
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user