From 96917bcbe030fc856cc89069bb8daf68055e9ffd Mon Sep 17 00:00:00 2001 From: Sebastien Badia Date: Sat, 21 Jun 2014 15:25:08 +0200 Subject: [PATCH] Fix unit-test in order to prepare module for deprecation * Update spec tests in order to match rspec 3.x syntax (and puppet-rspec 2.x) * Remove gems over-specifications (puppetlabs_spec_helper already add runtime deps on rpsec, puppet-rspec and rake) * Fix RedHat fact (cherry-pick of commit https://review.openstack.org/106555/) * Pin fixtures to stable/icehouse (this module is EOL) * Pin concat to 1.2.1 Partial-Bug: #1326034 Change-Id: If299e1f9591f21d9410f2a5744d29823f913c000 --- .fixtures.yml | 62 ++++-- Gemfile | 3 +- spec/classes/openstack_all_spec.rb | 54 ++--- spec/classes/openstack_auth_file_spec.rb | 6 +- spec/classes/openstack_cinder_all_spec.rb | 32 +-- .../openstack_cinder_controller_spec.rb | 14 +- spec/classes/openstack_cinder_storage_spec.rb | 22 +- spec/classes/openstack_client_spec.rb | 24 +-- spec/classes/openstack_compute_spec.rb | 78 +++---- spec/classes/openstack_controller_spec.rb | 204 +++++++++--------- spec/classes/openstack_glance_spec.rb | 30 +-- spec/classes/openstack_horizon_spec.rb | 12 +- spec/classes/openstack_keystone_spec.rb | 30 +-- spec/classes/openstack_neutron_spec.rb | 28 +-- .../classes/openstack_nova_controller_spec.rb | 20 +- spec/classes/openstack_provision_spec.rb | 14 +- spec/classes/openstack_repo_spec.rb | 28 +-- spec/classes/openstack_repo_uca_spec.rb | 4 +- spec/classes/openstack_swift_storage-node.rb | 12 +- spec/classes/openstack_test_file_spec.rb | 6 +- 20 files changed, 352 insertions(+), 331 deletions(-) diff --git a/.fixtures.yml b/.fixtures.yml index 6f5c03d..26063b4 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -1,27 +1,47 @@ fixtures: repositories: - 'cinder': 'git://github.com/stackforge/puppet-cinder' - "keystone": "git://github.com/stackforge/puppet-keystone.git" - "nova": "git://github.com/stackforge/puppet-nova.git" - "glance": "git://github.com/stackforge/puppet-glance.git" - 'horizon': 'git://github.com/stackforge/puppet-horizon' - 'swift' : 'git://github.com/stackforge/puppet-swift' - 'neutron': 'git://github.com/stackforge/puppet-neutron' - 'ceilometer' : 'git://github.com/stackforge/puppet-ceilometer' - 'heat' : 'git://github.com/stackforge/puppet-heat' - "apt": "git://github.com/puppetlabs/puppetlabs-apt.git" - "apache": "git://github.com/puppetlabs/puppetlabs-apache.git" - "concat": "git://github.com/puppetlabs/puppetlabs-concat.git" - "firewall": "git://github.com/puppetlabs/puppetlabs-firewall.git" - "mysql": - repo: "git://github.com/puppetlabs/puppetlabs-mysql.git" - ref: "origin/0.x" - "rabbitmq": - repo: "git://github.com/puppetlabs/puppetlabs-rabbitmq" - ref: "origin/2.x" + 'cinder': + repo: 'git://github.com/stackforge/puppet-cinder' + ref: 'origin/stable/icehouse' + 'keystone': + repo: 'git://github.com/stackforge/puppet-keystone.git' + ref: 'origin/stable/icehouse' + 'nova': + repo: 'git://github.com/stackforge/puppet-nova.git' + ref: 'origin/stable/icehouse' + 'glance': + repo: 'git://github.com/stackforge/puppet-glance.git' + ref: 'origin/stable/icehouse' + 'horizon': + repo: 'git://github.com/stackforge/puppet-horizon' + ref: 'origin/stable/icehouse' + 'swift' : + repo: 'git://github.com/stackforge/puppet-swift' + ref: 'origin/stable/icehouse' + 'neutron': + repo: 'git://github.com/stackforge/puppet-neutron' + ref: 'origin/stable/icehouse' + 'ceilometer' : + repo: 'git://github.com/stackforge/puppet-ceilometer' + ref: 'origin/stable/icehouse' + 'heat' : + repo: 'git://github.com/stackforge/puppet-heat' + ref: 'origin/stable/icehouse' + 'apt': 'git://github.com/puppetlabs/puppetlabs-apt.git' + 'apache': 'git://github.com/puppetlabs/puppetlabs-apache.git' + 'concat': + repo: 'git://github.com/puppetlabs/puppetlabs-concat.git' + ref: '1.2.1' + 'firewall': 'git://github.com/puppetlabs/puppetlabs-firewall.git' + 'mysql': + repo: 'git://github.com/puppetlabs/puppetlabs-mysql.git' + ref: 'origin/0.x' + 'rabbitmq': + repo: 'git://github.com/puppetlabs/puppetlabs-rabbitmq' + ref: 'origin/2.x' 'memcached': 'git://github.com/saz/puppet-memcached' - "stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git" - "sysctl": "git://github.com/duritong/puppet-sysctl.git" + 'stdlib': 'git://github.com/puppetlabs/puppetlabs-stdlib.git' + 'sysctl': 'git://github.com/duritong/puppet-sysctl.git' 'inifile': 'git://github.com/puppetlabs/puppetlabs-inifile' 'vswitch': 'git://github.com/stackforge/puppet-vswitch' 'tempest': 'git://github.com/stackforge/puppet-tempest' diff --git a/Gemfile b/Gemfile index 0d35201..1c6a377 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,8 @@ source 'https://rubygems.org' group :development, :test do gem 'puppetlabs_spec_helper', :require => false gem 'puppet-lint', '~> 0.3.2' - gem 'rake', '10.1.1' + gem 'json' + gem 'webmock' end if puppetversion = ENV['PUPPET_GEM_VERSION'] diff --git a/spec/classes/openstack_all_spec.rb b/spec/classes/openstack_all_spec.rb index 3890546..c731ddb 100644 --- a/spec/classes/openstack_all_spec.rb +++ b/spec/classes/openstack_all_spec.rb @@ -39,7 +39,7 @@ describe 'openstack::all' do end it 'raises an error if no neutron_user_password is set' do - expect { subject }.to raise_error(Puppet::Error, /neutron_user_password must be specified when neutron is configured/) + expect { catalogue }.to raise_error(Puppet::Error, /neutron_user_password must be specified when neutron is configured/) end context 'with neutron_user_password set' do @@ -47,7 +47,7 @@ describe 'openstack::all' do params.merge!(:neutron_user_password => 'neutron_user_password') end it 'raises an error if no neutron_db_password is set' do - expect { subject }.to raise_error(Puppet::Error, /neutron_db_password must be set when configuring neutron/) + expect { catalogue }.to raise_error(Puppet::Error, /neutron_db_password must be set when configuring neutron/) end end @@ -59,7 +59,7 @@ describe 'openstack::all' do ) end it 'raises an error if no bridge_interface is set' do - expect { subject }.to raise_error(Puppet::Error, /bridge_interface must be set when configuring neutron/) + expect { catalogue }.to raise_error(Puppet::Error, /bridge_interface must be set when configuring neutron/) end end @@ -84,7 +84,7 @@ describe 'openstack::all' do ) end it 'raises an error if no shared metadata key is set' do - expect { subject }.to raise_error(Puppet::Error, /metadata_shared_secret parameter must be set when using metadata agent/) + expect { catalogue }.to raise_error(Puppet::Error, /metadata_shared_secret parameter must be set when using metadata agent/) end end @@ -100,7 +100,7 @@ describe 'openstack::all' do ) end it 'contains an openstack::neutron class' do - should contain_class('openstack::neutron').with( + is_expected.to contain_class('openstack::neutron').with( :db_host => '127.0.0.1', :rabbit_host => '127.0.0.1', :rabbit_user => 'openstack', @@ -143,7 +143,7 @@ describe 'openstack::all' do ) end it 'contains a nova::compute class with force_config_drive set' do - should contain_class('nova::compute').with( + is_expected.to contain_class('nova::compute').with( :enabled => true, :force_config_drive => true ) @@ -166,7 +166,7 @@ describe 'openstack::all' do ) end it 'contains an openstack::neutron class' do - should contain_class('openstack::neutron').with( + is_expected.to contain_class('openstack::neutron').with( :db_host => '127.0.0.1', :rabbit_host => '127.0.0.1', :rabbit_user => 'openstack', @@ -212,7 +212,7 @@ describe 'openstack::all' do end it 'raises an error if no cinder_db_password is set' do - expect { subject }.to raise_error(Puppet::Error, /Must set cinder db password when setting up a cinder controller/) + expect { catalogue }.to raise_error(Puppet::Error, /Must set cinder db password when setting up a cinder controller/) end context 'with cinder_db_password set' do @@ -220,7 +220,7 @@ describe 'openstack::all' do params.merge!(:cinder_db_password => 'cinder_db_password') end it 'raises an error if no cinder_user_password is set' do - expect { subject }.to raise_error(Puppet::Error, /Must set cinder user password when setting up a cinder controller/) + expect { catalogue }.to raise_error(Puppet::Error, /Must set cinder user password when setting up a cinder controller/) end end @@ -232,7 +232,7 @@ describe 'openstack::all' do ) end it 'raises an error if no cinder_user_password is set' do - should contain_class('openstack::cinder::all').with( + is_expected.to contain_class('openstack::cinder::all').with( :bind_host => '0.0.0.0', :keystone_auth_host => '127.0.0.1', :keystone_password => 'cinder_user_password', @@ -249,7 +249,7 @@ describe 'openstack::all' do :debug => false, :verbose => false ) - should contain_nova_config('DEFAULT/volume_api_class').with(:value => 'nova.volume.cinder.API') + is_expected.to contain_nova_config('DEFAULT/volume_api_class').with(:value => 'nova.volume.cinder.API') end end end @@ -271,7 +271,7 @@ describe 'openstack::all' do end it 'should have cinder::volume::rbd' do - should contain_class('cinder::volume::rbd').with( + is_expected.to contain_class('cinder::volume::rbd').with( :rbd_pool => 'volumes', :rbd_user => 'volumes', :rbd_secret_uuid => 'e80afa94-a64c-486c-9e34-d55e85f26406' @@ -294,7 +294,7 @@ describe 'openstack::all' do end it 'should have openstack::db::mysql configured' do - should contain_class('openstack::db::mysql').with( + is_expected.to contain_class('openstack::db::mysql').with( :charset => 'latin1', :mysql_root_password => 'sql_pass', :mysql_bind_address => '0.0.0.0', @@ -322,7 +322,7 @@ describe 'openstack::all' do end it 'should have openstack::keystone configured' do - should contain_class('openstack::keystone').with( + is_expected.to contain_class('openstack::keystone').with( :debug => false, :verbose => false, :db_type => 'mysql', @@ -350,7 +350,7 @@ describe 'openstack::all' do end it 'should have openstack::glance configured' do - should contain_class('openstack::glance').with( + is_expected.to contain_class('openstack::glance').with( :debug => false, :verbose => false, :db_type => 'mysql', @@ -366,7 +366,7 @@ describe 'openstack::all' do end it 'should have nova::compute configured' do - should contain_class('nova::compute').with( + is_expected.to contain_class('nova::compute').with( :enabled => true, :vnc_enabled => true, :vncserver_proxyclient_address => '10.0.0.1', @@ -375,7 +375,7 @@ describe 'openstack::all' do end it 'should have nova::compute::libvirt configured' do - should contain_class('nova::compute::libvirt').with( + is_expected.to contain_class('nova::compute::libvirt').with( :libvirt_type => 'kvm', :vncserver_listen => '10.0.0.1', :migration_support => false @@ -383,7 +383,7 @@ describe 'openstack::all' do end it 'should have openstack::nova::controller configured' do - should contain_class('openstack::nova::controller').with( + is_expected.to contain_class('openstack::nova::controller').with( :db_host => '127.0.0.1', :network_manager => 'nova.network.manager.FlatDHCPManager', :network_config => {}, @@ -421,11 +421,11 @@ describe 'openstack::all' do end it 'should configure horizon' do - should contain_class('openstack::horizon').with( + is_expected.to contain_class('openstack::horizon').with( :secret_key => 'secret_key', :cache_server_ip => '127.0.0.1', :cache_server_port => 11211, - :horizon_app_links => '' + :horizon_app_links => nil ) end end @@ -445,7 +445,7 @@ describe 'openstack::all' do ) end it 'raises an error if no fixed_range is given' do - expect { subject }.to raise_error(Puppet::Error, /Must specify the fixed range when using nova-network/) + expect { catalogue }.to raise_error(Puppet::Error, /Must specify the fixed range when using nova-network/) end end @@ -454,7 +454,7 @@ describe 'openstack::all' do params.merge!(:private_interface => false) end it 'raises an error if no private_interface is given' do - expect { subject }.to raise_error(Puppet::Error, /private interface must be set when nova networking is used/) + expect { catalogue }.to raise_error(Puppet::Error, /private interface must be set when nova networking is used/) end end @@ -466,7 +466,7 @@ describe 'openstack::all' do end it 'sets send_arp_for_ha' do - should contain_nova_config('DEFAULT/send_arp_for_ha').with(:value => true) + is_expected.to contain_nova_config('DEFAULT/send_arp_for_ha').with(:value => true) end @@ -480,13 +480,13 @@ describe 'openstack::all' do end it 'unsets multi_host and send_arp_for_ha' do - should contain_nova_config('DEFAULT/multi_host').with(:value => false) - should contain_nova_config('DEFAULT/send_arp_for_ha').with(:value => false) + is_expected.to contain_nova_config('DEFAULT/multi_host').with(:value => false) + is_expected.to contain_nova_config('DEFAULT/send_arp_for_ha').with(:value => false) end end it 'configures nova::network' do - should contain_class('nova::network').with( + is_expected.to contain_class('nova::network').with( :private_interface => 'eth1', :public_interface => 'eth0', :fixed_range => '10.0.0.0/24', @@ -516,7 +516,7 @@ describe 'openstack::all' do end it 'should have glance::backend::rbd with default user/pool' do - should contain_class('glance::backend::rbd').with( + is_expected.to contain_class('glance::backend::rbd').with( :rbd_store_user => 'images', :rbd_store_pool => 'images' ) diff --git a/spec/classes/openstack_auth_file_spec.rb b/spec/classes/openstack_auth_file_spec.rb index 33c421c..75adc36 100644 --- a/spec/classes/openstack_auth_file_spec.rb +++ b/spec/classes/openstack_auth_file_spec.rb @@ -9,7 +9,7 @@ describe 'openstack::auth_file' do end it 'should create a openrc file' do - verify_contents(subject, '/root/openrc', [ + verify_contents(catalogue, '/root/openrc', [ 'export OS_NO_CACHE=\'true\'', 'export OS_TENANT_NAME=\'openstack\'', 'export OS_USERNAME=\'admin\'', @@ -43,7 +43,7 @@ describe 'openstack::auth_file' do end it 'should create a openrc file' do - verify_contents(subject, '/root/openrc', [ + verify_contents(catalogue, '/root/openrc', [ 'export OS_SERVICE_TOKEN=\'keystone\'', 'export OS_SERVICE_ENDPOINT=\'http://127.0.0.2:35357/v2.0/\'', 'export OS_NO_CACHE=\'true\'', @@ -72,7 +72,7 @@ describe 'openstack::auth_file' do end it 'should create a openrc file' do - verify_contents(subject, '/root/openrc', [ + verify_contents(catalogue, '/root/openrc', [ 'export OS_SERVICE_TOKEN=\'key\\\'stone\'', 'export OS_PASSWORD=\'singlequote\\\'\'', ]) diff --git a/spec/classes/openstack_cinder_all_spec.rb b/spec/classes/openstack_cinder_all_spec.rb index efda534..174915b 100644 --- a/spec/classes/openstack_cinder_all_spec.rb +++ b/spec/classes/openstack_cinder_all_spec.rb @@ -14,8 +14,8 @@ describe 'openstack::cinder::all' do { :osfamily => 'Debian' } end - it 'should configure using the default values' do - should contain_class('cinder').with( + it 'is_expected.to configure using the default values' do + is_expected.to contain_class('cinder').with( :sql_connection => "mysql://cinder:#{params[:db_password]}@127.0.0.1/cinder?charset=utf8", :sql_idle_timeout => '3600', :rpc_backend => 'cinder.openstack.common.rpc.impl_kombu', @@ -32,7 +32,7 @@ describe 'openstack::cinder::all' do :debug => false, :verbose => false ) - should contain_class('cinder::api').with( + is_expected.to contain_class('cinder::api').with( :keystone_password => params[:keystone_password], :keystone_enabled => true, :keystone_user => 'cinder', @@ -44,23 +44,23 @@ describe 'openstack::cinder::all' do :bind_host => '0.0.0.0', :enabled => true ) - should contain_class('cinder::scheduler').with( + is_expected.to contain_class('cinder::scheduler').with( :scheduler_driver => 'cinder.scheduler.simple.SimpleScheduler', :package_ensure => 'present', :enabled => true ) - should contain_class('cinder::volume').with( + is_expected.to contain_class('cinder::volume').with( :package_ensure => 'present', :enabled => true ) - should contain_class('cinder::volume::iscsi').with( + is_expected.to contain_class('cinder::volume::iscsi').with( :iscsi_ip_address => '127.0.0.1', :volume_group => 'cinder-volumes' ) - should contain_class('cinder::glance').with( + is_expected.to contain_class('cinder::glance').with( :glance_api_servers => '127.0.0.1:9292' ) - should_not contain_class('cinder::setup_test_volume') + is_expected.to_not contain_class('cinder::setup_test_volume') end describe 'with manage_volumes set to false' do @@ -69,7 +69,7 @@ describe 'openstack::cinder::all' do :manage_volumes => false ) end - it { should_not contain_class('cinder::volume') } + it { is_expected.to_not contain_class('cinder::volume') } end describe 'with a volume driver other than iscsi' do @@ -78,7 +78,7 @@ describe 'openstack::cinder::all' do :volume_driver => 'netapp' ) end - it { should_not contain_class('cinder::volume::iscsi') } + it { is_expected.to_not contain_class('cinder::volume::iscsi') } end describe 'with a volume driver other than rbd' do @@ -87,7 +87,7 @@ describe 'openstack::cinder::all' do :volume_driver => 'netapp' ) end - it { should_not contain_class('cinder::volume::rbd') } + it { is_expected.to_not contain_class('cinder::volume::rbd') } end describe 'with the rbd volume driver' do @@ -96,7 +96,7 @@ describe 'openstack::cinder::all' do :volume_driver => 'rbd' ) end - it { should contain_class('cinder::volume::rbd') } + it { is_expected.to contain_class('cinder::volume::rbd') } end describe 'when setting up test volumes for iscsi' do @@ -105,14 +105,14 @@ describe 'openstack::cinder::all' do :setup_test_volume => true ) end - it { should contain_class('cinder::setup_test_volume').with( + it { is_expected.to contain_class('cinder::setup_test_volume').with( :volume_name => 'cinder-volumes' )} describe 'when volume_group is set' do before do params.merge!(:volume_group => 'foo') end - it { should contain_class('cinder::setup_test_volume').with( + it { is_expected.to contain_class('cinder::setup_test_volume').with( :volume_name => 'foo' )} end @@ -125,7 +125,7 @@ describe 'openstack::cinder::all' do :log_facility => 'LOG_LOCAL0' ) end - it { should contain_class('cinder').with( + it { is_expected.to contain_class('cinder').with( :use_syslog => true, :log_facility => 'LOG_LOCAL0' )} @@ -138,7 +138,7 @@ describe 'openstack::cinder::all' do end it do - expect { subject }.to raise_error(Puppet::Error, /Unsupported db_type sqlite/) + expect { catalogue }.to raise_error(Puppet::Error, /Unsupported db_type sqlite/) end end diff --git a/spec/classes/openstack_cinder_controller_spec.rb b/spec/classes/openstack_cinder_controller_spec.rb index 859051d..3b77c68 100644 --- a/spec/classes/openstack_cinder_controller_spec.rb +++ b/spec/classes/openstack_cinder_controller_spec.rb @@ -11,11 +11,11 @@ describe 'openstack::cinder::controller' do end let :facts do - { :osfamily => 'Redhat' } + { :osfamily => 'RedHat' } end it 'should configure using the default values' do - should contain_class('cinder').with( + is_expected.to contain_class('cinder').with( :sql_connection => "mysql://cinder:#{params[:db_password]}@127.0.0.1/cinder?charset=utf8", :sql_idle_timeout => '3600', :rpc_backend => 'cinder.openstack.common.rpc.impl_kombu', @@ -32,7 +32,7 @@ describe 'openstack::cinder::controller' do :debug => false, :verbose => false ) - should contain_class('cinder::api').with( + is_expected.to contain_class('cinder::api').with( :keystone_password => params[:keystone_password], :keystone_enabled => true, :keystone_user => 'cinder', @@ -44,12 +44,12 @@ describe 'openstack::cinder::controller' do :bind_host => '0.0.0.0', :enabled => true ) - should contain_class('cinder::scheduler').with( + is_expected.to contain_class('cinder::scheduler').with( :scheduler_driver => 'cinder.scheduler.simple.SimpleScheduler', :package_ensure => 'present', :enabled => true ) - should contain_class('cinder::glance').with( + is_expected.to contain_class('cinder::glance').with( :glance_api_servers => '127.0.0.1:9292' ) end @@ -63,7 +63,7 @@ describe 'openstack::cinder::controller' do end it do - should contain_class('cinder').with( + is_expected.to contain_class('cinder').with( :use_syslog => true, :log_facility => 'LOG_LOCAL0' ) @@ -77,7 +77,7 @@ describe 'openstack::cinder::controller' do end it do - expect { subject }.to raise_error(Puppet::Error, /Unsupported db_type sqlite/) + expect { catalogue }.to raise_error(Puppet::Error, /Unsupported db_type sqlite/) end end diff --git a/spec/classes/openstack_cinder_storage_spec.rb b/spec/classes/openstack_cinder_storage_spec.rb index 796bb89..96c5178 100644 --- a/spec/classes/openstack_cinder_storage_spec.rb +++ b/spec/classes/openstack_cinder_storage_spec.rb @@ -10,11 +10,11 @@ describe 'openstack::cinder::storage' do end let :facts do - { :osfamily => 'Redhat' } + { :osfamily => 'RedHat' } end it 'should configure cinder and cinder::volume using defaults and required parameters' do - should contain_class('cinder').with( + is_expected.to contain_class('cinder').with( :sql_connection => params[:sql_connection], :rabbit_userid => 'guest', :rabbit_password => params[:rabbit_password], @@ -29,18 +29,18 @@ describe 'openstack::cinder::storage' do :debug => false, :verbose => false ) - should contain_class('cinder::volume').with( + is_expected.to contain_class('cinder::volume').with( :package_ensure => 'present', :enabled => true ) - should contain_class('cinder::volume::iscsi').with( + is_expected.to contain_class('cinder::volume::iscsi').with( :iscsi_ip_address => '127.0.0.1', :volume_group => 'cinder-volumes' ) - should contain_class('cinder::glance').with( + is_expected.to contain_class('cinder::glance').with( :glance_api_servers => '127.0.0.1:9292' ) - should_not contain_class('cinder::setup_test_volume') + is_expected.to_not contain_class('cinder::setup_test_volume') end describe 'with a volume driver other than iscsi' do @@ -49,7 +49,7 @@ describe 'openstack::cinder::storage' do :volume_driver => 'netapp' ) end - it { should_not contain_class('cinder::volume::iscsi') } + it { is_expected.to_not contain_class('cinder::volume::iscsi') } end describe 'when setting up test volumes for iscsi' do @@ -58,14 +58,14 @@ describe 'openstack::cinder::storage' do :setup_test_volume => true ) end - it { should contain_class('cinder::setup_test_volume').with( + it { is_expected.to contain_class('cinder::setup_test_volume').with( :volume_name => 'cinder-volumes' )} describe 'when volume_group is set' do before do params.merge!(:volume_group => 'foo') end - it { should contain_class('cinder::setup_test_volume').with( + it { is_expected.to contain_class('cinder::setup_test_volume').with( :volume_name => 'foo' )} end @@ -81,7 +81,7 @@ describe 'openstack::cinder::storage' do ) end - it { should contain_class('cinder::volume::rbd').with( + it { is_expected.to contain_class('cinder::volume::rbd').with( :rbd_user => 'rbd', :rbd_pool => 'rbd_pool', :rbd_secret_uuid => 'secret' @@ -98,7 +98,7 @@ describe 'openstack::cinder::storage' do ) end - it { should contain_class('cinder').with( + it { is_expected.to contain_class('cinder').with( :use_syslog => true, :log_facility => 'LOG_LOCAL0' ) } diff --git a/spec/classes/openstack_client_spec.rb b/spec/classes/openstack_client_spec.rb index 73eb8b0..3ebb4ca 100644 --- a/spec/classes/openstack_client_spec.rb +++ b/spec/classes/openstack_client_spec.rb @@ -7,41 +7,41 @@ describe 'openstack::client' do end describe 'with default params' do - it { should contain_class('ceilometer::client') } - it { should contain_class('cinder::client') } - it { should contain_class('glance::client') } - it { should contain_class('keystone::client') } - it { should contain_class('nova::client') } - it { should contain_class('neutron::client') } + it { is_expected.to contain_class('ceilometer::client') } + it { is_expected.to contain_class('cinder::client') } + it { is_expected.to contain_class('glance::client') } + it { is_expected.to contain_class('keystone::client') } + it { is_expected.to contain_class('nova::client') } + it { is_expected.to contain_class('neutron::client') } end describe 'without ceilometer' do let (:params) { {:ceilometer => false }} - it { should_not contain_class('ceilometer::client') } + it { is_expected.to_not contain_class('ceilometer::client') } end describe 'without cinder' do let (:params) { {:cinder => false }} - it { should_not contain_class('cinder::client') } + it { is_expected.to_not contain_class('cinder::client') } end describe 'without glance' do let (:params) { {:glance => false }} - it { should_not contain_class('glance::client') } + it { is_expected.to_not contain_class('glance::client') } end describe 'without keystone' do let (:params) { {:keystone => false }} - it { should_not contain_class('keystone::client') } + it { is_expected.to_not contain_class('keystone::client') } end describe 'without nova' do let (:params) { {:nova => false }} - it { should_not contain_class('nova::client') } + it { is_expected.to_not contain_class('nova::client') } end describe 'without neutron' do let (:params) { {:neutron => false }} - it { should_not contain_class('neutron::client') } + it { is_expected.to_not contain_class('neutron::client') } end end diff --git a/spec/classes/openstack_compute_spec.rb b/spec/classes/openstack_compute_spec.rb index ff03679..9f25bd1 100644 --- a/spec/classes/openstack_compute_spec.rb +++ b/spec/classes/openstack_compute_spec.rb @@ -30,7 +30,7 @@ describe 'openstack::compute' do describe "when using default class parameters" do it { - should contain_class('nova').with( + is_expected.to contain_class('nova').with( :sql_connection => 'mysql://nova:pass@127.0.0.1/nova', :rabbit_host => '127.0.0.1', :rabbit_hosts => false, @@ -43,22 +43,22 @@ describe 'openstack::compute' do :log_facility => 'LOG_USER', :verbose => false ) - should_not contain_resources('nova_config').with_purge(true) - should contain_class('nova::compute').with( + is_expected.to_not contain_resources('nova_config').with_purge(true) + is_expected.to contain_class('nova::compute').with( :enabled => true, :vnc_enabled => true, :vncserver_proxyclient_address => '127.0.0.2', :vncproxy_host => false, :force_config_drive => false ) - should contain_class('nova::compute::libvirt').with( + is_expected.to contain_class('nova::compute::libvirt').with( :libvirt_type => 'kvm', :vncserver_listen => '127.0.0.2' ) - should contain_nova_config('DEFAULT/multi_host').with( :value => false ) - should contain_nova_config('DEFAULT/send_arp_for_ha').with( :value => false ) - should_not contain_class('nova::api') - should contain_class('nova::network').with({ + is_expected.to contain_nova_config('DEFAULT/multi_host').with( :value => false ) + is_expected.to contain_nova_config('DEFAULT/send_arp_for_ha').with( :value => false ) + is_expected.to_not contain_class('nova::api') + is_expected.to contain_class('nova::network').with({ :enabled => false, :install_service => false, :private_interface => 'eth0', @@ -71,7 +71,7 @@ describe 'openstack::compute' do :enabled => false, :install_service => false }) - should contain_class('openstack::cinder::storage').with( + is_expected.to contain_class('openstack::cinder::storage').with( :sql_connection => 'mysql://cinder:cinder_pass@127.0.0.1/cinder', :rabbit_password => 'rabbit_pw', :rabbit_userid => 'openstack', @@ -113,7 +113,7 @@ describe 'openstack::compute' do ) end it do - should contain_class('nova').with( + is_expected.to contain_class('nova').with( :sql_connection => 'mysql://nova_user:pass@127.0.0.1/novadb', :rabbit_host => 'my_host', :rabbit_hosts => ['rabbit:5673', 'rabbit2:5674'], @@ -124,21 +124,21 @@ describe 'openstack::compute' do :glance_api_servers => ['controller:9292'], :verbose => true ) - should contain_class('nova::compute').with( + is_expected.to contain_class('nova::compute').with( :enabled => true, :vnc_enabled => false, :vncserver_proxyclient_address => '127.0.0.1', :vncproxy_host => '127.0.0.2', :force_config_drive => true ) - should contain_class('nova::compute::libvirt').with( + is_expected.to contain_class('nova::compute::libvirt').with( :libvirt_type => 'qemu', :vncserver_listen => '127.0.0.1' ) - should contain_nova_config('DEFAULT/multi_host').with( :value => false ) - should contain_nova_config('DEFAULT/send_arp_for_ha').with( :value => false ) - should_not contain_class('nova::api') - should contain_class('nova::network').with({ + is_expected.to contain_nova_config('DEFAULT/multi_host').with( :value => false ) + is_expected.to contain_nova_config('DEFAULT/send_arp_for_ha').with( :value => false ) + is_expected.to_not contain_class('nova::api') + is_expected.to contain_class('nova::network').with({ :enabled => false, :install_service => false, :private_interface => 'eth1', @@ -156,7 +156,7 @@ describe 'openstack::compute' do :manage_volumes => false ) end - it { should_not contain_class('openstack::cinder::storage') } + it { is_expected.to_not contain_class('openstack::cinder::storage') } end @@ -169,7 +169,7 @@ describe 'openstack::compute' do ) end it do - should contain_class('openstack::cinder::storage').with( + is_expected.to contain_class('openstack::cinder::storage').with( :sql_connection => 'mysql://cinder:cinder_pass@127.0.0.1/cinder', :rabbit_password => 'rabbit_pw', :rabbit_userid => 'openstack', @@ -201,18 +201,18 @@ describe 'openstack::compute' do end it 'should configure nova for multi-host' do - #should contain_class('keystone::python') - should contain_nova_config('DEFAULT/multi_host').with(:value => true) - should contain_nova_config('DEFAULT/send_arp_for_ha').with( :value => true) - should contain_class('nova::network').with({ + #is_expected.to contain_class('keystone::python') + is_expected.to contain_nova_config('DEFAULT/multi_host').with(:value => true) + is_expected.to contain_nova_config('DEFAULT/send_arp_for_ha').with( :value => true) + is_expected.to contain_class('nova::network').with({ 'enabled' => true, 'install_service' => true }) - should_not contain_class('openstack::neutron') + is_expected.to_not contain_class('openstack::neutron') end describe 'with defaults' do - it { should contain_class('nova::api').with( + it { is_expected.to contain_class('nova::api').with( :enabled => true, :admin_tenant_name => 'services', :admin_user => 'nova', @@ -236,7 +236,7 @@ describe 'openstack::compute' do ) end - it { should contain_class('nova::network').with({ + it { is_expected.to contain_class('nova::network').with({ :private_interface => 'eth1', :public_interface => 'eth2', :fixed_range => '12.0.0.0/24', @@ -256,7 +256,7 @@ describe 'openstack::compute' do end it { - expect { should raise_error(Puppet::Error) } + expect { is_expected.to raise_error(Puppet::Error) } } end @@ -270,9 +270,9 @@ describe 'openstack::compute' do end it { - should contain_nova_config('DEFAULT/multi_host').with({ 'value' => true}) - should contain_class('nova::api') - should contain_class('nova::network').with({ + is_expected.to contain_nova_config('DEFAULT/multi_host').with({ 'value' => true}) + is_expected.to contain_class('nova::api') + is_expected.to contain_class('nova::network').with({ 'enabled' => true, 'install_service' => true }) @@ -294,7 +294,7 @@ describe 'openstack::compute' do end it 'should configure neutron' do - should contain_class('openstack::neutron').with( + is_expected.to contain_class('openstack::neutron').with( :db_host => '127.0.0.1', :ovs_local_ip => params[:internal_address], :rabbit_host => params[:rabbit_host], @@ -316,11 +316,11 @@ describe 'openstack::compute' do :verbose => false ) - should contain_class('nova::compute::neutron').with( + is_expected.to contain_class('nova::compute::neutron').with( :libvirt_vif_driver => 'nova.virt.libvirt.vif.LibvirtGenericVIFDriver' ) - should contain_class('nova::network::neutron').with( + is_expected.to contain_class('nova::network::neutron').with( :neutron_admin_password => 'neutron_user_password', :neutron_auth_strategy => 'keystone', :neutron_url => "http://127.0.0.2:9696", @@ -330,10 +330,10 @@ describe 'openstack::compute' do :security_group_api => 'neutron' ) - should_not contain_class('neutron::server') - should_not contain_class('neutron::plugins::ovs') - should_not contain_class('neutron::agents::dhcp') - should_not contain_class('neutron::agents::l3') + is_expected.to_not contain_class('neutron::server') + is_expected.to_not contain_class('neutron::plugins::ovs') + is_expected.to_not contain_class('neutron::agents::dhcp') + is_expected.to_not contain_class('neutron::agents::l3') end end @@ -348,17 +348,17 @@ describe 'openstack::compute' do end it do - should contain_class('nova').with( + is_expected.to contain_class('nova').with( :use_syslog => true, :log_facility => 'LOG_LOCAL0' ) - should contain_class('openstack::neutron').with( + is_expected.to contain_class('openstack::neutron').with( :use_syslog => true, :log_facility => 'LOG_LOCAL0' ) - should contain_class('openstack::cinder::storage').with( + is_expected.to contain_class('openstack::cinder::storage').with( :use_syslog => true, :log_facility => 'LOG_LOCAL0' ) diff --git a/spec/classes/openstack_controller_spec.rb b/spec/classes/openstack_controller_spec.rb index 89c3e40..82b6a33 100644 --- a/spec/classes/openstack_controller_spec.rb +++ b/spec/classes/openstack_controller_spec.rb @@ -63,7 +63,7 @@ describe 'openstack::controller' do end it do - expect { subject }.to raise_error(Puppet::Error) + expect { catalogue }.to raise_error(Puppet::Error) end end @@ -84,38 +84,38 @@ describe 'openstack::controller' do end it 'should configure mysql server' do - param_value(subject, 'class', 'mysql::server', 'enabled').should be_true - config_hash = param_value(subject, 'class', 'mysql::server', 'config_hash') - config_hash['bind_address'].should == '0.0.0.0' - config_hash['root_password'].should == 'sql_pass' + expect(param_value(catalogue, 'class', 'mysql::server', 'enabled')).to eq(true) + config_hash = param_value(catalogue, 'class', 'mysql::server', 'config_hash') + expect(config_hash['bind_address']).to eq('0.0.0.0') + expect(config_hash['root_password']).to eq('sql_pass') end it 'should contain openstack db config' do - should contain_class('keystone::db::mysql').with( + is_expected.to contain_class('keystone::db::mysql').with( :user => 'keystone', :password => 'keystone_pass', :dbname => 'keystone', :allowed_hosts => '%' ) - should contain_class('glance::db::mysql').with( + is_expected.to contain_class('glance::db::mysql').with( :user => 'glance', :password => 'glance_pass', :dbname => 'glance', :allowed_hosts => '%' ) - should contain_class('nova::db::mysql').with( + is_expected.to contain_class('nova::db::mysql').with( :user => 'nova', :password => 'nova_pass', :dbname => 'nova', :allowed_hosts => '%' ) - should contain_class('cinder::db::mysql').with( + is_expected.to contain_class('cinder::db::mysql').with( :user => 'cinder', :password => 'cinder_pass', :dbname => 'cinder', :allowed_hosts => '%' ) - should contain_class('neutron::db::mysql').with( + is_expected.to contain_class('neutron::db::mysql').with( :user => 'neutron', :password => 'q_db_pass', :dbname => 'neutron', @@ -124,7 +124,7 @@ describe 'openstack::controller' do end - it { should contain_class('mysql::server::account_security')} + it { is_expected.to contain_class('mysql::server::account_security')} end @@ -137,8 +137,8 @@ describe 'openstack::controller' do ) end it do - should_not contain_class('neutron::db::mysql') - should_not contain_class('cinder::db::mysql') + is_expected.to_not contain_class('neutron::db::mysql') + is_expected.to_not contain_class('cinder::db::mysql') end end @@ -152,14 +152,14 @@ describe 'openstack::controller' do end it 'should configure mysql server' do - param_value(subject, 'class', 'mysql::server', 'enabled').should be_false - config_hash = param_value(subject, 'class', 'mysql::server', 'config_hash') - config_hash['bind_address'].should == '0.0.0.0' - config_hash['root_password'].should == 'sql_pass' + expect(param_value(catalogue, 'class', 'mysql::server', 'enabled')).to eq(false) + config_hash = param_value(catalogue, 'class', 'mysql::server', 'config_hash') + expect(config_hash['bind_address']).to eq('0.0.0.0') + expect(config_hash['root_password']).to eq('sql_pass') end ['keystone', 'nova', 'glance', 'cinder', 'neutron'].each do |x| - it { should_not contain_class("#{x}::db::mysql") } + it { is_expected.to_not contain_class("#{x}::db::mysql") } end end @@ -170,14 +170,14 @@ describe 'openstack::controller' do ) end - it { should_not contain_class('mysql::server::account_security')} + it { is_expected.to_not contain_class('mysql::server::account_security')} end context 'with default SSL params, disabled' do - it 'SSL in mysql should be disabled' do - config_hash = param_value(subject, 'class', 'mysql::server', 'config_hash') - config_hash['ssl'].should == false + it 'SSL in mysql is_expected.to be disabled' do + config_hash = param_value(catalogue, 'class', 'mysql::server', 'config_hash') + expect(config_hash['ssl']).to eq(false) end end @@ -193,11 +193,11 @@ describe 'openstack::controller' do end it 'should configure mysql server' do - config_hash = param_value(subject, 'class', 'mysql::server', 'config_hash') - config_hash['ssl'].should == true - config_hash['ssl_ca'].should == '/etc/mysql/ca.pem' - config_hash['ssl_cert'].should == '/etc/mysql/server.pem' - config_hash['ssl_key'].should == '/etc/mysql/server.key' + config_hash = param_value(catalogue, 'class', 'mysql::server', 'config_hash') + expect(config_hash['ssl']).to eq(true) + expect(config_hash['ssl_ca']).to eq('/etc/mysql/ca.pem') + expect(config_hash['ssl_cert']).to eq('/etc/mysql/server.pem') + expect(config_hash['ssl_key']).to eq('/etc/mysql/server.key') end end @@ -214,7 +214,7 @@ describe 'openstack::controller' do it 'should configure default keystone configuration' do - should contain_class('openstack::keystone').with( + is_expected.to contain_class('openstack::keystone').with( :swift => false, :swift_user_password => false, :swift_public_address => false, @@ -224,7 +224,7 @@ describe 'openstack::controller' do :log_facility => 'LOG_USER' ) - should contain_class('keystone').with( + is_expected.to contain_class('keystone').with( :verbose => false, :debug => false, :catalog_type => 'sql', @@ -235,12 +235,12 @@ describe 'openstack::controller' do :sql_connection => "mysql://keystone:keystone_pass@127.0.0.1/keystone" ) - should contain_class('keystone::roles::admin').with( + is_expected.to contain_class('keystone::roles::admin').with( :email => 'some_user@some_fake_email_address.foo', :password => 'ChangeMe', :admin_tenant => 'admin' ) - should contain_class('keystone::endpoint').with( + is_expected.to contain_class('keystone::endpoint').with( :public_address => '10.0.0.1', :public_protocol => 'http', :internal_address => '127.0.0.1', @@ -253,7 +253,7 @@ describe 'openstack::controller' do 'glance' => 'glance_pass' }.each do |type, pw| - should contain_class("#{type}::keystone::auth").with( + is_expected.to contain_class("#{type}::keystone::auth").with( :password => pw, :public_address => '10.0.0.1', :public_protocol => 'http', @@ -274,7 +274,7 @@ describe 'openstack::controller' do ) end it 'should configure swift auth in keystone' do - should contain_class('openstack::keystone').with( + is_expected.to contain_class('openstack::keystone').with( :swift => true, :swift_user_password => 'foo', :swift_public_address => '10.0.0.2', @@ -291,11 +291,11 @@ describe 'openstack::controller' do end it 'should not configure endpoints' do - should contain_class('keystone').with(:enabled => false) - should_not contain_class('keystone::roles::admin') - should_not contain_class('keystone::endpoint') - should_not contain_class('glance::keystone::auth') - should_not contain_class('nova::keystone::auth') + is_expected.to contain_class('keystone').with(:enabled => false) + is_expected.to_not contain_class('keystone::roles::admin') + is_expected.to_not contain_class('keystone::endpoint') + is_expected.to_not contain_class('glance::keystone::auth') + is_expected.to_not contain_class('nova::keystone::auth') end end @@ -306,10 +306,10 @@ describe 'openstack::controller' do end it 'should propagate it to the endpoints' do - should contain_class('keystone::endpoint').with(:public_protocol => 'https') - should contain_class('glance::keystone::auth').with(:public_protocol => 'https') - should contain_class('nova::keystone::auth').with(:public_protocol => 'https') - should contain_class('cinder::keystone::auth').with(:public_protocol => 'https') + is_expected.to contain_class('keystone::endpoint').with(:public_protocol => 'https') + is_expected.to contain_class('glance::keystone::auth').with(:public_protocol => 'https') + is_expected.to contain_class('nova::keystone::auth').with(:public_protocol => 'https') + is_expected.to contain_class('cinder::keystone::auth').with(:public_protocol => 'https') end end @@ -323,14 +323,14 @@ describe 'openstack::controller' do end it 'should set addresses in subclasses' do - should contain_class('keystone::endpoint').with( + is_expected.to contain_class('keystone::endpoint').with( :public_address => '1.1.1.1', :internal_address => '2.2.2.2', :admin_address => '3.3.3.3' ) ['nova', 'cinder', 'glance'].each do |type| - should contain_class("#{type}::keystone::auth").with( + is_expected.to contain_class("#{type}::keystone::auth").with( :public_address => '1.1.1.1', :internal_address => '2.2.2.2', :admin_address => '3.3.3.3' @@ -351,7 +351,7 @@ describe 'openstack::controller' do end it 'should configure keystone with SSL mysql connection' do - should contain_class('keystone').with( + is_expected.to contain_class('keystone').with( :sql_connection => "mysql://keystone:keystone_pass@127.0.0.1/keystone?ssl_ca=/etc/mysql/ca.pem" ) end @@ -359,7 +359,7 @@ describe 'openstack::controller' do end it do - should contain_class('memcached').with( + is_expected.to contain_class('memcached').with( :listen_ip => '127.0.0.1' ) end @@ -371,7 +371,7 @@ describe 'openstack::controller' do context 'when enabled' do it 'should contain enabled glance with defaults' do - should contain_class('openstack::glance').with( + is_expected.to contain_class('openstack::glance').with( :verbose => false, :debug => false, :registry_host => '0.0.0.0', @@ -380,7 +380,7 @@ describe 'openstack::controller' do :log_facility => 'LOG_USER' ) - should contain_class('glance::api').with( + is_expected.to contain_class('glance::api').with( :verbose => false, :debug => false, :auth_type => 'keystone', @@ -394,7 +394,7 @@ describe 'openstack::controller' do :enabled => true ) - should contain_class('glance::registry').with( + is_expected.to contain_class('glance::registry').with( :verbose => false, :debug => false, :auth_type => 'keystone', @@ -407,7 +407,7 @@ describe 'openstack::controller' do :enabled => true ) - should contain_class('glance::backend::file') + is_expected.to contain_class('glance::backend::file') end end context 'when not enabled' do @@ -417,11 +417,11 @@ describe 'openstack::controller' do end it 'should disable glance services' do - should contain_class('glance::api').with( + is_expected.to contain_class('glance::api').with( :enabled => false ) - should contain_class('glance::registry').with( + is_expected.to contain_class('glance::registry').with( :enabled => false ) end @@ -449,7 +449,7 @@ describe 'openstack::controller' do end it 'should override params for glance' do - should contain_class('openstack::glance').with( + is_expected.to contain_class('openstack::glance').with( :verbose => false, :debug => false, :registry_host => '127.0.0.2', @@ -458,7 +458,7 @@ describe 'openstack::controller' do :log_facility => 'LOG_LOCAL0' ) - should contain_class('glance::api').with( + is_expected.to contain_class('glance::api').with( :verbose => false, :debug => false, :registry_host => '127.0.0.2', @@ -472,7 +472,7 @@ describe 'openstack::controller' do :sql_idle_timeout => '30' ) - should contain_class('glance::registry').with( + is_expected.to contain_class('glance::registry').with( :verbose => false, :debug => false, :auth_type => 'keystone', @@ -494,7 +494,7 @@ describe 'openstack::controller' do :glance_rbd_store_pool => 'mypool' ) - should contain_class('glance::backend::rbd').with( + is_expected.to contain_class('glance::backend::rbd').with( :rbd_store_user => 'myuser', :rbd_store_pool => 'mypool' ) @@ -513,7 +513,7 @@ describe 'openstack::controller' do end it 'should configure glance with SSL mysql connection' do - should contain_class('glance::api').with( + is_expected.to contain_class('glance::api').with( :sql_connection => "mysql://glance:glance_pass@127.0.0.1/glance?ssl_ca=/etc/mysql/ca.pem" ) end @@ -537,7 +537,7 @@ describe 'openstack::controller' do context 'with default params' do it 'should contain enabled nova services' do - should contain_class('openstack::nova::controller').with( + is_expected.to contain_class('openstack::nova::controller').with( :db_host => '127.0.0.1', :sql_idle_timeout => '3600', :network_manager => 'nova.network.manager.FlatDHCPManager', @@ -570,7 +570,7 @@ describe 'openstack::controller' do :rabbit_hosts => false, :rabbit_cluster_nodes => false, :rabbit_virtual_host => '/', - :glance_api_servers => '', + :glance_api_servers => nil, :vnc_enabled => true, :vncproxy_host => '10.0.0.1', :use_syslog => false, @@ -580,15 +580,15 @@ describe 'openstack::controller' do :enabled => true ) - should_not contain_resources('nova_config').with_purge(true) - should contain_class('nova::rabbitmq').with( + is_expected.to_not contain_resources('nova_config').with_purge(true) + is_expected.to contain_class('nova::rabbitmq').with( :userid => 'openstack', :password => 'rabbit_pw', :cluster_disk_nodes => false, :virtual_host => '/', :enabled => true ) - should contain_class('nova').with( + is_expected.to contain_class('nova').with( :sql_connection => 'mysql://nova:nova_pass@127.0.0.1/nova', :rabbit_host => '127.0.0.1', :rabbit_hosts => false, @@ -601,7 +601,7 @@ describe 'openstack::controller' do :verbose => false, :memcached_servers => false ) - should contain_class('nova::api').with( + is_expected.to contain_class('nova::api').with( :enabled => true, :admin_tenant_name => 'services', :admin_user => 'nova', @@ -610,36 +610,36 @@ describe 'openstack::controller' do :auth_host => '127.0.0.1', :api_bind_address => '0.0.0.0' ) - should contain_class('nova::cert').with(:enabled => true) - should contain_class('nova::consoleauth').with(:enabled => true) - should contain_class('nova::scheduler').with(:enabled => true) - should contain_class('nova::objectstore').with(:enabled => true) - should contain_class('nova::conductor').with(:enabled => true) - should contain_class('nova::vncproxy').with( + is_expected.to contain_class('nova::cert').with(:enabled => true) + is_expected.to contain_class('nova::consoleauth').with(:enabled => true) + is_expected.to contain_class('nova::scheduler').with(:enabled => true) + is_expected.to contain_class('nova::objectstore').with(:enabled => true) + is_expected.to contain_class('nova::conductor').with(:enabled => true) + is_expected.to contain_class('nova::vncproxy').with( :enabled => true, :host => '10.0.0.1' ) end - it { should_not contain_nova_config('DEFAULT/auto_assign_floating_ip') } + it { is_expected.to_not contain_nova_config('DEFAULT/auto_assign_floating_ip') } end context 'when auto assign floating ip is assigned' do let :params do default_params.merge(:auto_assign_floating_ip => true) end - it { should contain_nova_config('DEFAULT/auto_assign_floating_ip').with(:value => true)} + it { is_expected.to contain_nova_config('DEFAULT/auto_assign_floating_ip').with(:value => true)} end context 'when not enabled' do let :params do default_params.merge(:enabled => false) end it 'should disable everything' do - should contain_class('nova::rabbitmq').with(:enabled => false) - should contain_class('nova::api').with(:enabled => false) - should contain_class('nova::cert').with(:enabled => false) - should contain_class('nova::consoleauth').with(:enabled => false) - should contain_class('nova::scheduler').with(:enabled => false) - should contain_class('nova::objectstore').with(:enabled => false) - should contain_class('nova::vncproxy').with(:enabled => false) + is_expected.to contain_class('nova::rabbitmq').with(:enabled => false) + is_expected.to contain_class('nova::api').with(:enabled => false) + is_expected.to contain_class('nova::cert').with(:enabled => false) + is_expected.to contain_class('nova::consoleauth').with(:enabled => false) + is_expected.to contain_class('nova::scheduler').with(:enabled => false) + is_expected.to contain_class('nova::objectstore').with(:enabled => false) + is_expected.to contain_class('nova::vncproxy').with(:enabled => false) end end context 'when params are overridden' do @@ -651,13 +651,13 @@ describe 'openstack::controller' do ) end it 'should override params for nova' do - should contain_class('openstack::nova::controller').with( + is_expected.to contain_class('openstack::nova::controller').with( :sql_idle_timeout => '30', :use_syslog => true, :log_facility => 'LOG_LOCAL0' ) - should contain_class('nova').with( + is_expected.to contain_class('nova').with( :sql_idle_timeout => '30' ) end @@ -667,7 +667,7 @@ describe 'openstack::controller' do context 'config for horizon' do it 'should contain enabled horizon' do - should contain_class('horizon').with( + is_expected.to contain_class('horizon').with( :secret_key => 'secret_key', :cache_server_ip => '127.0.0.1', :cache_server_port => '11211', @@ -680,7 +680,7 @@ describe 'openstack::controller' do let :params do default_params.merge(:horizon => false) end - it { should_not contain_class('horizon') } + it { is_expected.to_not contain_class('horizon') } end end @@ -692,11 +692,11 @@ describe 'openstack::controller' do default_params.merge(:cinder => false) end it 'should not contain cinder classes' do - should_not contain_class('openstack::cinder::all') - should_not contain_class('cinder') - should_not contain_class('cinder::api') - should_not contain_class('cinder::scheduler') - should_not contain_class('cinder::volume') + is_expected.to_not contain_class('openstack::cinder::all') + is_expected.to_not contain_class('cinder') + is_expected.to_not contain_class('cinder::api') + is_expected.to_not contain_class('cinder::scheduler') + is_expected.to_not contain_class('cinder::volume') end end @@ -705,7 +705,7 @@ describe 'openstack::controller' do default_params end it 'should configure cinder using defaults' do - should contain_class('openstack::cinder::all').with( + is_expected.to contain_class('openstack::cinder::all').with( :bind_host => '0.0.0.0', :sql_idle_timeout => '3600', :keystone_password => 'cinder_pass', @@ -729,14 +729,14 @@ describe 'openstack::controller' do :verbose => false ) - should contain_class('cinder').with( + is_expected.to contain_class('cinder').with( :debug => false, :verbose => false, :sql_connection => 'mysql://cinder:cinder_pass@127.0.0.1/cinder?charset=utf8', :rabbit_password => 'rabbit_pw' ) - should contain_class('cinder::api').with_keystone_password('cinder_pass') - should contain_class('cinder::scheduler') + is_expected.to contain_class('cinder::api').with_keystone_password('cinder_pass') + is_expected.to contain_class('cinder::scheduler') end end @@ -760,7 +760,7 @@ describe 'openstack::controller' do ) end it 'should configure cinder using custom parameters' do - should contain_class('openstack::cinder::all').with( + is_expected.to contain_class('openstack::cinder::all').with( :sql_idle_timeout => '30', :keystone_password => 'foo', :rabbit_userid => 'rabbituser', @@ -779,7 +779,7 @@ describe 'openstack::controller' do ) - should contain_class('cinder').with( + is_expected.to contain_class('cinder').with( :debug => true, :verbose => true, :sql_connection => 'mysql://baz:bar@127.0.0.2/blah?charset=utf8', @@ -787,8 +787,8 @@ describe 'openstack::controller' do :rabbit_password => 'rabbit_pw2', :rabbit_userid => 'rabbituser' ) - should contain_class('cinder::api').with_keystone_password('foo') - should contain_class('cinder::scheduler') + is_expected.to contain_class('cinder::api').with_keystone_password('foo') + is_expected.to contain_class('cinder::scheduler') end end @@ -830,17 +830,17 @@ describe 'openstack::controller' do end it 'should not fail when required ovs parameters are not set' do - should contain_class('openstack::controller') + is_expected.to contain_class('openstack::controller') end end - it { should_not contain_class('nova::network') } + it { is_expected.to_not contain_class('nova::network') } - it { should contain_class('nova::network::neutron').with(:security_group_api => 'neutron') } + it { is_expected.to contain_class('nova::network::neutron').with(:security_group_api => 'neutron') } it 'should configure neutron' do - should contain_class('openstack::neutron').with( + is_expected.to contain_class('openstack::neutron').with( :db_host => '127.0.0.1', :sql_idle_timeout => '30', :rabbit_host => '127.0.0.1', @@ -885,7 +885,7 @@ describe 'openstack::controller' do let :params do default_params.merge(:neutron => false, :multi_host => false) end - it {should contain_class('nova::network').with( + it {is_expected.to contain_class('nova::network').with( :private_interface => 'eth0', :public_interface => 'eth1', :fixed_range => '10.0.0.0/24', @@ -903,8 +903,8 @@ describe 'openstack::controller' do let :params do default_params.merge(:neutron => false, :multi_host => true) end - it { should contain_nova_config('DEFAULT/multi_host').with(:value => true)} - it {should contain_class('nova::network').with( + it { is_expected.to contain_nova_config('DEFAULT/multi_host').with(:value => true)} + it {is_expected.to contain_class('nova::network').with( :create_networks => true, :enabled => true, :install_service => true diff --git a/spec/classes/openstack_glance_spec.rb b/spec/classes/openstack_glance_spec.rb index d09d374..710f373 100644 --- a/spec/classes/openstack_glance_spec.rb +++ b/spec/classes/openstack_glance_spec.rb @@ -19,7 +19,7 @@ describe 'openstack::glance' do describe 'with only required parameters' do it 'should configure with applicable defaults' do - should contain_class('glance::api').with( + is_expected.to contain_class('glance::api').with( :verbose => false, :debug => false, :registry_host => '0.0.0.0', @@ -36,7 +36,7 @@ describe 'openstack::glance' do :log_facility => 'LOG_USER', :enabled => true ) - should contain_class('glance::registry').with( + is_expected.to contain_class('glance::registry').with( :verbose => false, :debug => false, :bind_host => '0.0.0.0', @@ -52,7 +52,7 @@ describe 'openstack::glance' do :log_facility => 'LOG_USER', :enabled => true ) - should contain_class('glance::backend::file') + is_expected.to contain_class('glance::backend::file') end end @@ -61,7 +61,7 @@ describe 'openstack::glance' do params.merge!(:db_type => 'sqlite' ) end it 'should fail' do - expect { subject }.to raise_error(Puppet::Error, /db_type sqlite is not supported/) + expect { catalogue }.to raise_error(Puppet::Error, /db_type sqlite is not supported/) end end @@ -70,7 +70,7 @@ describe 'openstack::glance' do params.merge!(:backend => 'ceph') end it 'should fail' do - expect { subject }.to raise_error(Puppet::Error, /Unsupported backend ceph/) + expect { catalogue }.to raise_error(Puppet::Error, /Unsupported backend ceph/) end end @@ -85,9 +85,9 @@ describe 'openstack::glance' do end it 'should configure swift as the backend' do - should_not contain_class('glance::backend::file') + is_expected.to_not contain_class('glance::backend::file') - should contain_class('glance::backend::swift').with( + is_expected.to contain_class('glance::backend::swift').with( :swift_store_user => 'dan', :swift_store_key => '123', :swift_store_auth_address => 'http://127.0.0.1:5000/v2.0/', @@ -101,7 +101,7 @@ describe 'openstack::glance' do end it 'should fail' do expect do - subject + catalogue end.to raise_error(Puppet::Error, /swift_store_key must be set when configuring swift/) end end @@ -111,7 +111,7 @@ describe 'openstack::glance' do end it 'should fail' do expect do - subject + catalogue end.to raise_error(Puppet::Error, /swift_store_user must be set when configuring swift/) end end @@ -128,11 +128,11 @@ describe 'openstack::glance' do end it 'should configure rbd as the backend' do - should_not contain_class('glance::backend::file') + is_expected.to_not contain_class('glance::backend::file') - should_not contain_class('glance::backend::swift') + is_expected.to_not contain_class('glance::backend::swift') - should contain_class('glance::backend::rbd').with( + is_expected.to contain_class('glance::backend::rbd').with( :rbd_store_user => 'don', :rbd_store_pool => 'images' ) @@ -148,7 +148,7 @@ describe 'openstack::glance' do end it 'should configure mysql properly' do - should contain_class('glance::registry').with( + is_expected.to contain_class('glance::registry').with( :sql_connection => 'mysql://glance:glance_db_pass@127.0.0.1/glance?ssl_ca=/etc/mysql/ca.pem' ) end @@ -163,12 +163,12 @@ describe 'openstack::glance' do end it 'should set parameters in included classes' do - should contain_class('glance::api').with( + is_expected.to contain_class('glance::api').with( :use_syslog => true, :log_facility => 'LOG_LOCAL0' ) - should contain_class('glance::registry').with( + is_expected.to contain_class('glance::registry').with( :use_syslog => true, :log_facility => 'LOG_LOCAL0' ) diff --git a/spec/classes/openstack_horizon_spec.rb b/spec/classes/openstack_horizon_spec.rb index 4e53458..1bd82d6 100644 --- a/spec/classes/openstack_horizon_spec.rb +++ b/spec/classes/openstack_horizon_spec.rb @@ -12,7 +12,7 @@ describe 'openstack::horizon' do let :facts do { - :osfamily => 'Redhat', + :osfamily => 'RedHat', :memorysize => '1GB', :processorcount => '1', :concat_basedir => '/tmp', @@ -21,12 +21,12 @@ describe 'openstack::horizon' do end it 'should configure horizon and memcache using default parameters and secret key' do - should contain_class('memcached').with( + is_expected.to contain_class('memcached').with( :listen_ip => '127.0.0.1', :tcp_port => '11211', :udp_port => '11211' ) - should contain_class('horizon').with( + is_expected.to contain_class('horizon').with( :cache_server_ip => '127.0.0.1', :cache_server_port => '11211', :secret_key => 'super_secret', @@ -46,8 +46,8 @@ describe 'openstack::horizon' do ) end it 'should configure horizon without memcached using default parameters and secret key' do - should_not contain_class('memcached') - should contain_class('horizon').with( + is_expected.to_not contain_class('memcached') + is_expected.to contain_class('horizon').with( :cache_server_ip => '127.0.0.1', :cache_server_port => '11211', :secret_key => 'super_secret', @@ -69,7 +69,7 @@ describe 'openstack::horizon' do ) end it 'should override params for memcached' do - should contain_class('memcached').with( + is_expected.to contain_class('memcached').with( :listen_ip => '10.10.10.10' ) end diff --git a/spec/classes/openstack_keystone_spec.rb b/spec/classes/openstack_keystone_spec.rb index 68d9d79..d153e50 100644 --- a/spec/classes/openstack_keystone_spec.rb +++ b/spec/classes/openstack_keystone_spec.rb @@ -30,7 +30,7 @@ describe 'openstack::keystone' do describe 'with only required params (and defaults for everything else)' do it 'should configure keystone and all default endpoints' do - should contain_class('keystone').with( + is_expected.to contain_class('keystone').with( :verbose => false, :debug => false, :bind_host => '0.0.0.0', @@ -45,7 +45,7 @@ describe 'openstack::keystone' do :log_facility => 'LOG_USER' ) [ 'glance', 'cinder', 'neutron' ].each do |type| - should contain_class("#{type}::keystone::auth").with( + is_expected.to contain_class("#{type}::keystone::auth").with( :password => params["#{type}_user_password".intern], :public_address => params[:public_address], :admin_address => params[:public_address], @@ -53,7 +53,7 @@ describe 'openstack::keystone' do :region => 'RegionOne' ) end - should contain_class('nova::keystone::auth').with( + is_expected.to contain_class('nova::keystone::auth').with( :password => params[:nova_user_password], :public_address => params[:public_address], :admin_address => params[:public_address], @@ -69,12 +69,12 @@ describe 'openstack::keystone' do required_params.merge(:nova => false) end - it { should_not contain_class('nova::keystone::auth') } + it { is_expected.to_not contain_class('nova::keystone::auth') } end describe 'without swift' do - it { should_not contain_class('swift::keystone::auth') } + it { is_expected.to_not contain_class('swift::keystone::auth') } end describe 'swift' do @@ -84,7 +84,7 @@ describe 'openstack::keystone' do end it 'should fail when the password is not set' do expect do - subject + catalogue end.to raise_error(Puppet::Error) end end @@ -93,7 +93,7 @@ describe 'openstack::keystone' do required_params.merge(:swift => true, :swift_user_password => 'dude') end it do - should contain_class('swift::keystone::auth').with( + is_expected.to contain_class('swift::keystone::auth').with( :password => 'dude', :region => 'RegionOne' ) @@ -102,7 +102,7 @@ describe 'openstack::keystone' do end describe 'without heat' do - it { should_not contain_class('heat::keystone::auth') } + it { is_expected.to_not contain_class('heat::keystone::auth') } end describe 'heat' do @@ -112,7 +112,7 @@ describe 'openstack::keystone' do end it 'should fail when the password is not set' do expect do - subject + catalogue end.to raise_error(Puppet::Error) end end @@ -121,7 +121,7 @@ describe 'openstack::keystone' do required_params.merge(:heat => true, :heat_user_password => 'dude') end it do - should contain_class('heat::keystone::auth').with( + is_expected.to contain_class('heat::keystone::auth').with( :password => 'dude', :public_address => '127.0.0.1', :region => 'RegionOne' @@ -131,7 +131,7 @@ describe 'openstack::keystone' do end describe 'without heat_cfn' do - it { should_not contain_class('heat::keystone::auth_cfn') } + it { is_expected.to_not contain_class('heat::keystone::auth_cfn') } end describe 'heat_cfn' do @@ -141,7 +141,7 @@ describe 'openstack::keystone' do end it 'should fail when the password is not set' do expect do - subject + catalogue end.to raise_error(Puppet::Error) end end @@ -150,7 +150,7 @@ describe 'openstack::keystone' do required_params.merge(:heat_cfn => true, :heat_cfn_user_password => 'dude') end it do - should contain_class('heat::keystone::auth_cfn').with( + is_expected.to contain_class('heat::keystone::auth_cfn').with( :password => 'dude', :public_address => '127.0.0.1', :region => 'RegionOne' @@ -168,7 +168,7 @@ describe 'openstack::keystone' do end it 'should configure mysql properly' do - should contain_class('keystone').with( + is_expected.to contain_class('keystone').with( :sql_connection => 'mysql://keystone:pass@127.0.0.1/keystone?ssl_ca=/etc/mysql/ca.pem' ) end @@ -183,7 +183,7 @@ describe 'openstack::keystone' do end it 'should set parameters in included classes' do - should contain_class('keystone').with( + is_expected.to contain_class('keystone').with( :use_syslog => true, :log_facility => 'LOG_LOCAL0' ) diff --git a/spec/classes/openstack_neutron_spec.rb b/spec/classes/openstack_neutron_spec.rb index 3723a3c..b2c99a2 100644 --- a/spec/classes/openstack_neutron_spec.rb +++ b/spec/classes/openstack_neutron_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe 'openstack::neutron' do let :facts do - {:osfamily => 'Redhat'} + {:osfamily => 'RedHat'} end let :params do @@ -20,13 +20,13 @@ describe 'openstack::neutron' do end it 'should fail b/c database password is required' do expect do - subject + catalogue end.to raise_error(Puppet::Error, /db password must be set/) end end context 'install neutron with default and database password' do it 'should perform default configuration' do - should contain_class('neutron').with( + is_expected.to contain_class('neutron').with( :enabled => true, :bind_host => '0.0.0.0', :rabbit_host => '127.0.0.1', @@ -40,11 +40,11 @@ describe 'openstack::neutron' do :verbose => false, :debug => false ) - should contain_class('neutron::server').with( + is_expected.to contain_class('neutron::server').with( :auth_host => '127.0.0.1', :auth_password => 'q_user_pass' ) - should contain_class('neutron::plugins::ovs').with( + is_expected.to contain_class('neutron::plugins::ovs').with( :sql_connection => "mysql://neutron:bar@127.0.0.1/neutron?charset=utf8", :tenant_network_type => 'gre' ) @@ -56,8 +56,8 @@ describe 'openstack::neutron' do params.merge!(:enable_server => false) end it 'should not configure server' do - should_not contain_class('neutron::server') - should_not contain_class('neutron::plugins::ovs') + is_expected.to_not contain_class('neutron::server') + is_expected.to_not contain_class('neutron::plugins::ovs') end end @@ -70,7 +70,7 @@ describe 'openstack::neutron' do :ovs_local_ip => '10.0.0.2' ) end - it { should contain_class('neutron::agents::ovs').with( + it { is_expected.to contain_class('neutron::agents::ovs').with( :bridge_uplinks => ['br-ex:eth0'], :bridge_mappings => ['default:br-ex'], :enable_tunneling => true, @@ -83,7 +83,7 @@ describe 'openstack::neutron' do before do params.merge!(:enable_dhcp_agent => true) end - it { should contain_class('neutron::agents::dhcp').with( + it { is_expected.to contain_class('neutron::agents::dhcp').with( :use_namespaces => true, :debug => false ) } @@ -93,7 +93,7 @@ describe 'openstack::neutron' do before do params.merge!(:enable_l3_agent => true) end - it { should contain_class('neutron::agents::l3').with( + it { is_expected.to contain_class('neutron::agents::l3').with( :use_namespaces => true, :debug => false ) } @@ -107,7 +107,7 @@ describe 'openstack::neutron' do end it 'should fail' do expect do - subject + catalogue end.to raise_error(Puppet::Error, /metadata_shared_secret parameter must be set/) end context 'with a shared secret' do @@ -116,7 +116,7 @@ describe 'openstack::neutron' do :shared_secret => 'foo' ) end - it { should contain_class('neutron::agents::metadata').with( + it { is_expected.to contain_class('neutron::agents::metadata').with( :auth_password => 'q_user_pass', :shared_secret => 'foo', :auth_url => 'http://localhost:35357/v2.0', @@ -133,7 +133,7 @@ describe 'openstack::neutron' do :log_facility => 'LOG_LOCAL0' ) end - it { should contain_class('neutron').with( + it { is_expected.to contain_class('neutron').with( :use_syslog => true, :log_facility => 'LOG_LOCAL0' ) } @@ -145,7 +145,7 @@ describe 'openstack::neutron' do end it 'should fail' do expect do - subject + catalogue end.to raise_error(Puppet::Error, /Unsupported db type: foo./) end end diff --git a/spec/classes/openstack_nova_controller_spec.rb b/spec/classes/openstack_nova_controller_spec.rb index 8647449..97ae6c0 100644 --- a/spec/classes/openstack_nova_controller_spec.rb +++ b/spec/classes/openstack_nova_controller_spec.rb @@ -25,20 +25,20 @@ describe 'openstack::nova::controller' do default_params end - it { should contain_class('openstack::nova::controller') } + it { is_expected.to contain_class('openstack::nova::controller') } context 'when configuring neutron' do it 'should configure nova with neutron' do - should contain_class('nova::rabbitmq').with( + is_expected.to contain_class('nova::rabbitmq').with( :userid => 'openstack', :password => 'rabbit_pass', :enabled => true, :cluster_disk_nodes => false, :virtual_host => '/' ) - should contain_class('nova').with( + is_expected.to contain_class('nova').with( :sql_connection => 'mysql://nova:nova_db_pass@127.0.0.1/nova', :rabbit_userid => 'openstack', :rabbit_password => 'rabbit_pass', @@ -54,7 +54,7 @@ describe 'openstack::nova::controller' do :log_facility => 'LOG_USER' ) - should contain_class('nova::api').with( + is_expected.to contain_class('nova::api').with( :enabled => true, :admin_tenant_name => 'services', :admin_user => 'nova', @@ -65,7 +65,7 @@ describe 'openstack::nova::controller' do :neutron_metadata_proxy_shared_secret => 'secret' ) - should contain_class('nova::network::neutron').with( + is_expected.to contain_class('nova::network::neutron').with( :neutron_admin_password => 'neutron_user_pass', :neutron_auth_strategy => 'keystone', :neutron_url => "http://127.0.0.1:9696", @@ -76,10 +76,10 @@ describe 'openstack::nova::controller' do ) ['nova::scheduler', 'nova::objectstore', 'nova::cert', 'nova::consoleauth', 'nova::conductor'].each do |x| - should contain_class(x).with_enabled(true) + is_expected.to contain_class(x).with_enabled(true) end - should contain_class('nova::vncproxy').with( + is_expected.to contain_class('nova::vncproxy').with( :host => '127.0.0.1', :enabled => true ) @@ -93,7 +93,7 @@ describe 'openstack::nova::controller' do ) end it 'should configure nova with memcached' do - should contain_class('nova').with( + is_expected.to contain_class('nova').with( :memcached_servers => ['memcached01:11211', 'memcached02:11211'] ) end @@ -107,7 +107,7 @@ describe 'openstack::nova::controller' do ) end it 'should configure SSL' do - should contain_class('nova').with( + is_expected.to contain_class('nova').with( :sql_connection => 'mysql://nova:nova_db_pass@127.0.0.1/nova?ssl_ca=/etc/mysql/ca.pem' ) end @@ -121,7 +121,7 @@ describe 'openstack::nova::controller' do ) end it do - should contain_class('nova').with( + is_expected.to contain_class('nova').with( :use_syslog => true, :log_facility => 'LOG_LOCAL0' ) diff --git a/spec/classes/openstack_provision_spec.rb b/spec/classes/openstack_provision_spec.rb index 6be61d2..162f1d2 100644 --- a/spec/classes/openstack_provision_spec.rb +++ b/spec/classes/openstack_provision_spec.rb @@ -17,7 +17,7 @@ describe 'openstack::provision' do } end - it { should contain_glance_image(params[:image_name_alt]).with( + it { is_expected.to contain_glance_image(params[:image_name_alt]).with( :ensure => 'present', :is_public => 'yes', :container_format => 'bare', @@ -26,7 +26,7 @@ describe 'openstack::provision' do ) } - it { should contain_glance_image(params[:image_name]).with( + it { is_expected.to contain_glance_image(params[:image_name]).with( :ensure => 'present', :is_public => 'yes', :container_format => 'bare', @@ -44,7 +44,7 @@ describe 'openstack::provision' do } end - it { should contain_glance_image(params[:image_name]).with( + it { is_expected.to contain_glance_image(params[:image_name]).with( :ensure => 'present', :is_public => 'yes', :container_format => 'bare', @@ -64,19 +64,19 @@ describe 'openstack::provision' do } end - it { should contain_class('tempest').with( + it { is_expected.to contain_class('tempest').with( :resize_available => true, :change_password_available => true, :tempest_repo_revision => 'stable/grizzly' ) } it 'should configure neutron networks' do - should contain_neutron_network('public').with( + is_expected.to contain_neutron_network('public').with( 'ensure' => 'present', 'router_external' => true, 'tenant_name' => 'admin' ) - should contain_neutron_network('private').with( + is_expected.to contain_neutron_network('private').with( 'ensure' => 'present', 'tenant_name' => 'demo' ) @@ -93,7 +93,7 @@ describe 'openstack::provision' do } end - it { should contain_class('tempest').with( + it { is_expected.to contain_class('tempest').with( :tempest_repo_revision => 'stable/grizzly' ) } end diff --git a/spec/classes/openstack_repo_spec.rb b/spec/classes/openstack_repo_spec.rb index b544525..7dc6a2b 100644 --- a/spec/classes/openstack_repo_spec.rb +++ b/spec/classes/openstack_repo_spec.rb @@ -15,13 +15,13 @@ describe 'openstack::repo' do end it do - should contain_yumrepo('rdo-release').with( + is_expected.to contain_yumrepo('rdo-release').with( :baseurl => 'http://repos.fedorapeople.org/repos/openstack/openstack-havana/epel-6/' ) - should contain_file('/etc/pki/rpm-gpg/RPM-GPG-KEY-RDO-Havana') + is_expected.to contain_file('/etc/pki/rpm-gpg/RPM-GPG-KEY-RDO-Havana') - should contain_yumrepo('epel') - should contain_file('/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6') + is_expected.to contain_yumrepo('epel') + is_expected.to contain_file('/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6') end end @@ -38,13 +38,13 @@ describe 'openstack::repo' do end it do - should contain_yumrepo('rdo-release').with( + is_expected.to contain_yumrepo('rdo-release').with( :baseurl => 'http://repos.fedorapeople.org/repos/openstack/openstack-grizzly/epel-6/' ) - should contain_file('/etc/pki/rpm-gpg/RPM-GPG-KEY-RDO-Grizzly') + is_expected.to contain_file('/etc/pki/rpm-gpg/RPM-GPG-KEY-RDO-Grizzly') - should contain_yumrepo('epel') - should contain_file('/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6') + is_expected.to contain_yumrepo('epel') + is_expected.to contain_file('/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6') end end @@ -62,10 +62,10 @@ describe 'openstack::repo' do end it do - should contain_yumrepo('rdo-release').with( + is_expected.to contain_yumrepo('rdo-release').with( :baseurl => 'http://repos.fedorapeople.org/repos/openstack/openstack-havana/fedora-18/' ) - should contain_file('/etc/pki/rpm-gpg/RPM-GPG-KEY-RDO-Havana') + is_expected.to contain_file('/etc/pki/rpm-gpg/RPM-GPG-KEY-RDO-Havana') end end @@ -84,10 +84,10 @@ describe 'openstack::repo' do end it do - should contain_yumrepo('rdo-release').with( + is_expected.to contain_yumrepo('rdo-release').with( :baseurl => 'http://repos.fedorapeople.org/repos/openstack/openstack-grizzly/fedora-18/' ) - should contain_file('/etc/pki/rpm-gpg/RPM-GPG-KEY-RDO-Grizzly') + is_expected.to contain_file('/etc/pki/rpm-gpg/RPM-GPG-KEY-RDO-Grizzly') end end @@ -108,7 +108,7 @@ describe 'openstack::repo' do end it do - should contain_apt__source('ubuntu-cloud-archive').with_release('precise-updates/havana') + is_expected.to contain_apt__source('ubuntu-cloud-archive').with_release('precise-updates/havana') end end @@ -129,7 +129,7 @@ describe 'openstack::repo' do end it do - should contain_apt__source('ubuntu-cloud-archive').with_release('precise-updates/grizzly') + is_expected.to contain_apt__source('ubuntu-cloud-archive').with_release('precise-updates/grizzly') end end end diff --git a/spec/classes/openstack_repo_uca_spec.rb b/spec/classes/openstack_repo_uca_spec.rb index 11d161a..dad1860 100644 --- a/spec/classes/openstack_repo_uca_spec.rb +++ b/spec/classes/openstack_repo_uca_spec.rb @@ -15,7 +15,7 @@ describe 'openstack::repo::uca' do } end it do - should contain_apt__source('ubuntu-cloud-archive').with( + is_expected.to contain_apt__source('ubuntu-cloud-archive').with( :release => 'precise-updates/grizzly' ) end @@ -38,7 +38,7 @@ describe 'openstack::repo::uca' do end it do - should contain_apt__source('ubuntu-cloud-archive').with( + is_expected.to contain_apt__source('ubuntu-cloud-archive').with( :release => 'precise-proposed/folsom' ) end diff --git a/spec/classes/openstack_swift_storage-node.rb b/spec/classes/openstack_swift_storage-node.rb index f9001e2..7d18033 100644 --- a/spec/classes/openstack_swift_storage-node.rb +++ b/spec/classes/openstack_swift_storage-node.rb @@ -14,15 +14,15 @@ describe 'openstack::swift::storage-node' do end it 'should configure using the default values' do - should contain_class('swift').with( + is_expected.to contain_class('swift').with( :swift_hash_suffix => 'swift_secret', :package_ensure => 'present', ) - should contain_define('swift::storage::loopback').with( + is_expected.to contain_define('swift::storage::loopback').with( :base_dir => '/srv/loopback-device', :mnt_base_dir => '/srv/node', ) - should contain_class('swift::storage::all').with( + is_expected.to contain_class('swift::storage::all').with( :storage_local_net_ip => '192.168.1.2', ) end @@ -35,15 +35,15 @@ describe 'openstack::swift::storage-node' do ) end it 'should configure using the configured values' do - should contain_class('swift').with( + is_expected.to contain_class('swift').with( :swift_hash_suffix => 'swift_secret', :package_ensure => 'present', ) - should contain_define('swift::storage::disk').with( + is_expected.to contain_define('swift::storage::disk').with( :mnt_base_dir => '/srv/node', :byte_size => '1024', ) - should contain_class('swift::storage::all').with( + is_expected.to contain_class('swift::storage::all').with( :storage_local_net_ip => '192.168.1.2', ) end diff --git a/spec/classes/openstack_test_file_spec.rb b/spec/classes/openstack_test_file_spec.rb index 95ef24c..8bb5ec1 100644 --- a/spec/classes/openstack_test_file_spec.rb +++ b/spec/classes/openstack_test_file_spec.rb @@ -2,8 +2,8 @@ require 'spec_helper' describe 'openstack::test_file' do it do - should contain_file('/tmp/test_nova.sh').with_mode('0751') - should_not contain_file('/tmp/test_nova.sh').with_content(/add-floating-ip/) - should contain_file('/tmp/test_nova.sh').with_content(/floatingip-create/) + is_expected.to contain_file('/tmp/test_nova.sh').with_mode('0751') + is_expected.to_not contain_file('/tmp/test_nova.sh').with_content(/add-floating-ip/) + is_expected.to contain_file('/tmp/test_nova.sh').with_content(/floatingip-create/) end end