Merge "Spec: updates for rspec-puppet 2.x and rspec 3.x"

This commit is contained in:
Jenkins 2015-03-16 08:14:20 +00:00 committed by Gerrit Code Review
commit 3d8d00d613
23 changed files with 180 additions and 210 deletions

View File

@ -2,8 +2,7 @@ source 'https://rubygems.org'
group :development, :test do
gem 'puppetlabs_spec_helper', :require => false
gem 'rspec-puppet', '~> 1.0.1'
gem 'rake', '10.1.1'
gem 'rspec-puppet', '~> 2.0.0', :require => false
gem 'puppet-lint', '~> 1.1'
gem 'metadata-json-lint'

View File

@ -14,55 +14,30 @@ describe 'manila::api' do
req_params
end
it { should contain_service('manila-api').with(
it { is_expected.to contain_service('manila-api').with(
'hasstatus' => true,
'ensure' => 'running'
)}
it 'should configure manila api correctly' do
should contain_manila_config('DEFAULT/auth_strategy').with(
:value => 'keystone'
)
should contain_manila_config('DEFAULT/osapi_share_listen').with(
:value => '0.0.0.0'
)
should contain_manila_api_paste_ini('filter:authtoken/service_protocol').with(
:value => 'http'
)
should contain_manila_api_paste_ini('filter:authtoken/service_host').with(
:value => 'localhost'
)
should contain_manila_api_paste_ini('filter:authtoken/service_port').with(
:value => '5000'
)
should contain_manila_api_paste_ini('filter:authtoken/auth_protocol').with(
:value => 'http'
)
should contain_manila_api_paste_ini('filter:authtoken/auth_host').with(
:value => 'localhost'
)
should contain_manila_api_paste_ini('filter:authtoken/auth_port').with(
:value => '35357'
)
should contain_manila_api_paste_ini('filter:authtoken/auth_admin_prefix').with(
:ensure => 'absent'
)
should contain_manila_api_paste_ini('filter:authtoken/admin_tenant_name').with(
:value => 'services'
)
should contain_manila_api_paste_ini('filter:authtoken/admin_user').with(
:value => 'manila'
)
should contain_manila_api_paste_ini('filter:authtoken/admin_password').with(
is_expected.to contain_manila_config('DEFAULT/auth_strategy').with(:value => 'keystone')
is_expected.to contain_manila_config('DEFAULT/osapi_share_listen').with(:value => '0.0.0.0')
is_expected.to contain_manila_api_paste_ini('filter:authtoken/service_protocol').with(:value => 'http')
is_expected.to contain_manila_api_paste_ini('filter:authtoken/service_host').with(:value => 'localhost')
is_expected.to contain_manila_api_paste_ini('filter:authtoken/service_port').with(:value => '5000')
is_expected.to contain_manila_api_paste_ini('filter:authtoken/auth_protocol').with(:value => 'http')
is_expected.to contain_manila_api_paste_ini('filter:authtoken/auth_host').with(:value => 'localhost')
is_expected.to contain_manila_api_paste_ini('filter:authtoken/auth_port').with(:value => '35357')
is_expected.to contain_manila_api_paste_ini('filter:authtoken/auth_admin_prefix').with(:ensure => 'absent')
is_expected.to contain_manila_api_paste_ini('filter:authtoken/admin_tenant_name').with(:value => 'services')
is_expected.to contain_manila_api_paste_ini('filter:authtoken/admin_user').with(:value => 'manila')
is_expected.to contain_manila_api_paste_ini('filter:authtoken/admin_password').with(
:value => 'foo',
:secret => true
)
is_expected.to contain_manila_api_paste_ini('filter:authtoken/auth_uri').with(:value => 'http://localhost:5000/')
should contain_manila_api_paste_ini('filter:authtoken/auth_uri').with(
:value => 'http://localhost:5000/'
)
should_not contain_manila_config('DEFAULT/os_region_name')
is_expected.to_not contain_manila_config('DEFAULT/os_region_name')
end
end
@ -71,7 +46,7 @@ describe 'manila::api' do
req_params.merge({'os_region_name' => 'MyRegion'})
end
it 'should configure the region for nova' do
should contain_manila_config('DEFAULT/os_region_name').with(
is_expected.to contain_manila_config('DEFAULT/os_region_name').with(
:value => 'MyRegion'
)
end
@ -82,7 +57,7 @@ describe 'manila::api' do
req_params.merge({'keystone_auth_uri' => 'http://foo.bar:8080/v2.0/'})
end
it 'should configure manila auth_uri correctly' do
should contain_manila_api_paste_ini('filter:authtoken/auth_uri').with(
is_expected.to contain_manila_api_paste_ini('filter:authtoken/auth_uri').with(
:value => 'http://foo.bar:8080/v2.0/'
)
end
@ -93,14 +68,14 @@ describe 'manila::api' do
req_params.merge({'bind_host' => '192.168.1.3'})
end
it 'should configure manila api correctly' do
should contain_manila_config('DEFAULT/osapi_share_listen').with(
is_expected.to contain_manila_config('DEFAULT/osapi_share_listen').with(
:value => '192.168.1.3'
)
end
end
[ '/keystone', '/keystone/admin', '' ].each do |keystone_auth_admin_prefix|
describe "with keystone_auth_admin_prefix containing incorrect value #{keystone_auth_admin_prefix}" do
[ '/keystone', '/keystone/admin' ].each do |keystone_auth_admin_prefix|
describe "with keystone_auth_admin_prefix containing correct value #{keystone_auth_admin_prefix}" do
let :params do
{
:keystone_auth_admin_prefix => keystone_auth_admin_prefix,
@ -108,7 +83,7 @@ describe 'manila::api' do
}
end
it { should contain_manila_api_paste_ini('filter:authtoken/auth_admin_prefix').with(
it { is_expected.to contain_manila_api_paste_ini('filter:authtoken/auth_admin_prefix').with(
:value => keystone_auth_admin_prefix
)}
end
@ -130,7 +105,7 @@ describe 'manila::api' do
}
end
it { expect { should contain_manila_api_paste_ini('filter:authtoken/auth_admin_prefix') }.to \
it { expect { is_expected.to contain_manila_api_paste_ini('filter:authtoken/auth_admin_prefix') }.to \
raise_error(Puppet::Error, /validate_re\(\): "#{keystone_auth_admin_prefix}" does not match/) }
end
end
@ -140,10 +115,10 @@ describe 'manila::api' do
req_params.merge({'enabled' => false})
end
it 'should stop the service' do
should contain_service('manila-api').with_ensure('stopped')
is_expected.to contain_service('manila-api').with_ensure('stopped')
end
it 'should contain db_sync exec' do
should_not contain_exec('manila-manage db_sync')
is_expected.to_not contain_exec('manila-manage db_sync')
end
end
@ -152,7 +127,7 @@ describe 'manila::api' do
req_params.merge({'manage_service' => false})
end
it 'should not change the state of the service' do
should contain_service('manila-api').without_ensure
is_expected.to contain_service('manila-api').without_ensure
end
end
@ -161,7 +136,7 @@ describe 'manila::api' do
req_params.merge({ :ratelimits => '(GET, "*", .*, 100, MINUTE);(POST, "*", .*, 200, MINUTE)' })
end
it { should contain_manila_api_paste_ini('filter:ratelimit/limits').with(
it { is_expected.to contain_manila_api_paste_ini('filter:ratelimit/limits').with(
:value => '(GET, "*", .*, 100, MINUTE);(POST, "*", .*, 200, MINUTE)'
)}
end

View File

@ -44,7 +44,7 @@ describe 'manila::backends' do
end
it 'configures manila.conf with default params' do
should contain_manila_config('DEFAULT/enabled_share_backends').with_value(p[:enabled_share_backends].join(','))
is_expected.to contain_manila_config('DEFAULT/enabled_share_backends').with_value(p[:enabled_share_backends].join(','))
end
end

View File

@ -1,7 +1,7 @@
require 'spec_helper'
describe 'manila::client' do
it { should contain_package('python-manilaclient').with_ensure('present') }
it { is_expected.to contain_package('python-manilaclient').with_ensure('present') }
let :facts do
{:osfamily => 'Debian'}
end
@ -9,6 +9,6 @@ describe 'manila::client' do
let :params do
{:package_ensure => 'latest'}
end
it { should contain_package('python-manilaclient').with_ensure('latest') }
it { is_expected.to contain_package('python-manilaclient').with_ensure('latest') }
end
end

View File

@ -19,7 +19,7 @@ describe 'manila::db::mysql' do
let :params do
req_params
end
it { should contain_openstacklib__db__mysql('manila').with(
it { is_expected.to contain_openstacklib__db__mysql('manila').with(
:user => 'manila',
:password_hash => '*D821809F681A40A6E379B50D0463EFAE20BDD122',
:host => '127.0.0.1',

View File

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

View File

@ -5,7 +5,7 @@ describe 'manila::db::sync' do
let :facts do
{:osfamily => 'Debian'}
end
it { should contain_exec('manila-manage db_sync').with(
it { is_expected.to contain_exec('manila-manage db_sync').with(
:command => 'manila-manage db sync',
:path => '/usr/bin',
:user => 'manila',

View File

@ -14,24 +14,24 @@ describe 'manila::keystone::auth' do
it 'should contain auth info' do
should contain_keystone_user('manila').with(
is_expected.to contain_keystone_user('manila').with(
:ensure => 'present',
:password => 'pw',
:email => 'manila@localhost',
:tenant => 'services'
)
should contain_keystone_user_role('manila@services').with(
is_expected.to contain_keystone_user_role('manila@services').with(
:ensure => 'present',
:roles => 'admin'
)
should contain_keystone_service('manila').with(
is_expected.to contain_keystone_service('manila').with(
:ensure => 'present',
:type => 'share',
:description => 'Manila Service'
)
end
it { should contain_keystone_endpoint('RegionOne/manila').with(
it { is_expected.to contain_keystone_endpoint('RegionOne/manila').with(
:ensure => 'present',
:public_url => 'http://127.0.0.1:8786/v1/%(tenant_id)s',
:admin_url => 'http://127.0.0.1:8786/v1/%(tenant_id)s',
@ -55,7 +55,7 @@ describe 'manila::keystone::auth' do
)
end
it { should contain_keystone_endpoint('RegionThree/manila').with(
it { is_expected.to contain_keystone_endpoint('RegionThree/manila').with(
:ensure => 'present',
:public_url => 'https://10.0.42.1:4242/v42/%(tenant_id)s',
:admin_url => 'https://10.0.42.2:4242/v42/%(tenant_id)s',
@ -71,7 +71,7 @@ describe 'manila::keystone::auth' do
:configure_endpoint => false
)
end
it { should_not contain_keystone_endpoint('RegionOne/manila') }
it { is_expected.to_not contain_keystone_endpoint('RegionOne/manila') }
end
end

View File

@ -11,7 +11,7 @@ describe 'manila::qpid' do
it 'should contain all of the default resources' do
should contain_class('qpid::server').with(
is_expected.to contain_class('qpid::server').with(
:service_ensure => 'running',
:port => '5672'
)
@ -20,7 +20,7 @@ describe 'manila::qpid' do
it 'should contain user' do
should contain_qpid_user('guest').with(
is_expected.to contain_qpid_user('guest').with(
:password => 'guest',
:file => '/var/lib/qpidd/qpidd.sasldb',
:realm => 'OPENSTACK',
@ -40,8 +40,8 @@ describe 'manila::qpid' do
it 'should be disabled' do
should_not contain_qpid_user('guest')
should contain_class('qpid::server').with(
is_expected.to_not contain_qpid_user('guest')
is_expected.to contain_class('qpid::server').with(
:service_ensure => 'stopped'
)

View File

@ -4,13 +4,13 @@ describe 'manila::quota' do
describe 'with default parameters' do
it 'contains default values' do
should contain_manila_config('DEFAULT/quota_shares').with(
is_expected.to contain_manila_config('DEFAULT/quota_shares').with(
:value => 10)
should contain_manila_config('DEFAULT/quota_snapshots').with(
is_expected.to contain_manila_config('DEFAULT/quota_snapshots').with(
:value => 10)
should contain_manila_config('DEFAULT/quota_gigabytes').with(
is_expected.to contain_manila_config('DEFAULT/quota_gigabytes').with(
:value => 1000)
should contain_manila_config('DEFAULT/quota_driver').with(
is_expected.to contain_manila_config('DEFAULT/quota_driver').with(
:value => 'manila.quota.DbQuotaDriver')
end
end
@ -22,13 +22,13 @@ describe 'manila::quota' do
:quota_gigabytes => 100000 }
end
it 'contains overrided values' do
should contain_manila_config('DEFAULT/quota_shares').with(
is_expected.to contain_manila_config('DEFAULT/quota_shares').with(
:value => 1000)
should contain_manila_config('DEFAULT/quota_snapshots').with(
is_expected.to contain_manila_config('DEFAULT/quota_snapshots').with(
:value => 1000)
should contain_manila_config('DEFAULT/quota_gigabytes').with(
is_expected.to contain_manila_config('DEFAULT/quota_gigabytes').with(
:value => 100000)
should contain_manila_config('DEFAULT/quota_driver').with(
is_expected.to contain_manila_config('DEFAULT/quota_driver').with(
:value => 'manila.quota.DbQuotaDriver')
end
end

View File

@ -12,13 +12,13 @@ describe 'manila::rabbitmq' do
it 'should contain all of the default resources' do
should contain_class('rabbitmq::server').with(
is_expected.to contain_class('rabbitmq::server').with(
:service_ensure => 'running',
:port => '5672',
:delete_guest_user => false
)
should contain_rabbitmq_vhost('/').with(
is_expected.to contain_rabbitmq_vhost('/').with(
:provider => 'rabbitmqctl'
)
end
@ -36,13 +36,13 @@ describe 'manila::rabbitmq' do
it 'should contain user and permissions' do
should contain_rabbitmq_user('dan').with(
is_expected.to contain_rabbitmq_user('dan').with(
:admin => true,
:password => 'pass',
:provider => 'rabbitmqctl'
)
should contain_rabbitmq_user_permissions('dan@/').with(
is_expected.to contain_rabbitmq_user_permissions('dan@/').with(
:configure_permission => '.*',
:write_permission => '.*',
:read_permission => '.*',
@ -64,15 +64,15 @@ describe 'manila::rabbitmq' do
it 'should be disabled' do
should_not contain_rabbitmq_user('dan')
should_not contain_rabbitmq_user_permissions('dan@/')
should contain_class('rabbitmq::server').with(
is_expected.to_not contain_rabbitmq_user('dan')
is_expected.to_not contain_rabbitmq_user_permissions('dan@/')
is_expected.to contain_class('rabbitmq::server').with(
:service_ensure => 'stopped',
:port => '5672',
:delete_guest_user => false
)
should_not contain_rabbitmq_vhost('/')
is_expected.to_not contain_rabbitmq_vhost('/')
end
end

View File

@ -10,15 +10,15 @@ describe 'manila::scheduler' do
describe 'with default parameters' do
it { should contain_class('manila::params') }
it { is_expected.to contain_class('manila::params') }
it { should contain_package('manila-scheduler').with(
it { is_expected.to contain_package('manila-scheduler').with(
:name => 'manila-scheduler',
:ensure => 'present',
:before => 'Service[manila-scheduler]'
) }
it { should contain_service('manila-scheduler').with(
it { is_expected.to contain_service('manila-scheduler').with(
:name => 'manila-scheduler',
:enable => true,
:ensure => 'running',
@ -35,8 +35,8 @@ describe 'manila::scheduler' do
}
end
it { should contain_manila_config('DEFAULT/scheduler_driver').with_value('manila.scheduler.filter_scheduler.FilterScheduler') }
it { should contain_package('manila-scheduler').with_ensure('present') }
it { is_expected.to contain_manila_config('DEFAULT/scheduler_driver').with_value('manila.scheduler.filter_scheduler.FilterScheduler') }
it { is_expected.to contain_package('manila-scheduler').with_ensure('present') }
end
describe 'with manage_service false' do
@ -45,7 +45,7 @@ describe 'manila::scheduler' do
}
end
it 'should not change the state of the service' do
should contain_service('manila-scheduler').without_ensure
is_expected.to contain_service('manila-scheduler').without_ensure
end
end
end
@ -59,9 +59,9 @@ describe 'manila::scheduler' do
describe 'with default parameters' do
it { should contain_class('manila::params') }
it { is_expected.to contain_class('manila::params') }
it { should contain_service('manila-scheduler').with(
it { is_expected.to contain_service('manila-scheduler').with(
:name => 'openstack-manila-scheduler',
:enable => true,
:ensure => 'running',
@ -75,7 +75,7 @@ describe 'manila::scheduler' do
{ :scheduler_driver => 'manila.scheduler.filter_scheduler.FilterScheduler' }
end
it { should contain_manila_config('DEFAULT/scheduler_driver').with_value('manila.scheduler.filter_scheduler.FilterScheduler') }
it { is_expected.to contain_manila_config('DEFAULT/scheduler_driver').with_value('manila.scheduler.filter_scheduler.FilterScheduler') }
end
end
end

View File

@ -17,13 +17,13 @@ describe 'manila::share::generic' do
describe 'generic share driver' do
it 'configures generic share driver' do
should contain_manila_config('DEFAULT/share_driver').with_value(
is_expected.to contain_manila_config('DEFAULT/share_driver').with_value(
'manila.share.drivers.generic.GenericShareDriver')
should contain_manila_config('DEFAULT/share_helpers').with_value(
is_expected.to contain_manila_config('DEFAULT/share_helpers').with_value(
'CIFS=manila.share.drivers.generic.CIFSHelper,'\
'NFS=manila.share.drivers.generic.NFSHelper')
params.each_pair do |config,value|
should contain_manila_config("DEFAULT/#{config}").with_value( value )
is_expected.to contain_manila_config("DEFAULT/#{config}").with_value( value )
end
end
end

View File

@ -11,11 +11,11 @@ describe 'manila::share::glusterfs' do
end
it 'configures glusterfs share driver' do
should contain_manila_config('DEFAULT/share_driver').with_value(
is_expected.to contain_manila_config('DEFAULT/share_driver').with_value(
'manila.share.drivers.glusterfs.GlusterfsShareDriver')
should contain_manila_config('DEFAULT/glusterfs_volumes_config').with_value(
is_expected.to contain_manila_config('DEFAULT/glusterfs_volumes_config').with_value(
'/etc/manila/glusterfs_volumes')
should contain_manila_config('DEFAULT/glusterfs_mount_point_base').with_value(
is_expected.to contain_manila_config('DEFAULT/glusterfs_mount_point_base').with_value(
'$state_path/mnt')
end

View File

@ -29,15 +29,15 @@ describe 'manila::share::netapp' do
end
it 'configures netapp share driver' do
should contain_manila_config('DEFAULT/share_driver').with_value(
is_expected.to contain_manila_config('DEFAULT/share_driver').with_value(
'manila.share.drivers.netapp.cluster_mode.NetAppClusteredShareDriver')
params_hash.each_pair do |config,value|
should contain_manila_config("DEFAULT/#{config}").with_value( value )
is_expected.to contain_manila_config("DEFAULT/#{config}").with_value( value )
end
end
it 'marks netapp_password as secret' do
should contain_manila_config('DEFAULT/netapp_nas_password').with_secret( true )
is_expected.to contain_manila_config('DEFAULT/netapp_nas_password').with_secret( true )
end
end

View File

@ -7,11 +7,11 @@ describe 'manila::share' do
'class { "manila": rabbit_password => "fpp", sql_connection => "mysql://a:b@c/d" }'
end
it { should contain_package('manila-share').with(
it { is_expected.to contain_package('manila-share').with(
:name => platform_params[:package_name],
:ensure => 'present'
) }
it { should contain_service('manila-share').with(
it { is_expected.to contain_service('manila-share').with(
'hasstatus' => true
)}
@ -20,7 +20,7 @@ describe 'manila::share' do
{ 'manage_service' => false }
end
it 'should not change the state of the service' do
should contain_service('manila-share').without_ensure
is_expected.to contain_service('manila-share').without_ensure
end
end
end

View File

@ -13,71 +13,71 @@ describe 'manila' do
req_params
end
it { should contain_class('manila::params') }
it { should contain_class('mysql::bindings::python') }
it { is_expected.to contain_class('manila::params') }
it { is_expected.to contain_class('mysql::bindings::python') }
it 'should contain default config' do
should contain_manila_config('DEFAULT/sql_idle_timeout').with(
is_expected.to contain_manila_config('DEFAULT/sql_idle_timeout').with(
:value => '3600'
)
should contain_manila_config('DEFAULT/rpc_backend').with(
is_expected.to contain_manila_config('DEFAULT/rpc_backend').with(
:value => 'manila.openstack.common.rpc.impl_kombu'
)
should contain_manila_config('DEFAULT/control_exchange').with(
is_expected.to contain_manila_config('DEFAULT/control_exchange').with(
:value => 'openstack'
)
should contain_manila_config('DEFAULT/rabbit_password').with(
is_expected.to contain_manila_config('DEFAULT/rabbit_password').with(
:value => 'guest',
:secret => true
)
should contain_manila_config('DEFAULT/rabbit_host').with(
is_expected.to contain_manila_config('DEFAULT/rabbit_host').with(
:value => '127.0.0.1'
)
should contain_manila_config('DEFAULT/rabbit_port').with(
is_expected.to contain_manila_config('DEFAULT/rabbit_port').with(
:value => '5672'
)
should contain_manila_config('DEFAULT/rabbit_hosts').with(
is_expected.to contain_manila_config('DEFAULT/rabbit_hosts').with(
:value => '127.0.0.1:5672'
)
should contain_manila_config('DEFAULT/rabbit_ha_queues').with(
is_expected.to contain_manila_config('DEFAULT/rabbit_ha_queues').with(
:value => false
)
should contain_manila_config('DEFAULT/rabbit_virtual_host').with(
is_expected.to contain_manila_config('DEFAULT/rabbit_virtual_host').with(
:value => '/'
)
should contain_manila_config('DEFAULT/rabbit_userid').with(
is_expected.to contain_manila_config('DEFAULT/rabbit_userid').with(
:value => 'guest'
)
should contain_manila_config('DEFAULT/sql_connection').with(
is_expected.to contain_manila_config('DEFAULT/sql_connection').with(
:value => 'mysql://user:password@host/database',
:secret => true
)
should contain_manila_config('DEFAULT/verbose').with(
is_expected.to contain_manila_config('DEFAULT/verbose').with(
:value => false
)
should contain_manila_config('DEFAULT/debug').with(
is_expected.to contain_manila_config('DEFAULT/debug').with(
:value => false
)
should contain_manila_config('DEFAULT/storage_availability_zone').with(
is_expected.to contain_manila_config('DEFAULT/storage_availability_zone').with(
:value => 'nova'
)
should contain_manila_config('DEFAULT/api_paste_config').with(
is_expected.to contain_manila_config('DEFAULT/api_paste_config').with(
:value => '/etc/manila/api-paste.ini'
)
should contain_manila_config('DEFAULT/rootwrap_config').with(
is_expected.to contain_manila_config('DEFAULT/rootwrap_config').with(
:value => '/etc/manila/rootwrap.conf'
)
should contain_manila_config('DEFAULT/log_dir').with(:value => '/var/log/manila')
is_expected.to contain_manila_config('DEFAULT/log_dir').with(:value => '/var/log/manila')
end
it { should contain_file('/etc/manila/manila.conf').with(
it { is_expected.to contain_file('/etc/manila/manila.conf').with(
:owner => 'manila',
:group => 'manila',
:mode => '0600',
:require => 'Package[manila]'
) }
it { should contain_file('/etc/manila/api-paste.ini').with(
it { is_expected.to contain_file('/etc/manila/api-paste.ini').with(
:owner => 'manila',
:group => 'manila',
:mode => '0600',
@ -91,12 +91,12 @@ describe 'manila' do
end
it 'should contain many' do
should_not contain_manila_config('DEFAULT/rabbit_host')
should_not contain_manila_config('DEFAULT/rabbit_port')
should contain_manila_config('DEFAULT/rabbit_hosts').with(
is_expected.to_not contain_manila_config('DEFAULT/rabbit_host')
is_expected.to_not contain_manila_config('DEFAULT/rabbit_port')
is_expected.to contain_manila_config('DEFAULT/rabbit_hosts').with(
:value => 'rabbit1:5672,rabbit2:5672'
)
should contain_manila_config('DEFAULT/rabbit_ha_queues').with(
is_expected.to contain_manila_config('DEFAULT/rabbit_ha_queues').with(
:value => true
)
end
@ -108,12 +108,12 @@ describe 'manila' do
end
it 'should contain many' do
should_not contain_manila_config('DEFAULT/rabbit_host')
should_not contain_manila_config('DEFAULT/rabbit_port')
should contain_manila_config('DEFAULT/rabbit_hosts').with(
is_expected.to_not contain_manila_config('DEFAULT/rabbit_host')
is_expected.to_not contain_manila_config('DEFAULT/rabbit_port')
is_expected.to contain_manila_config('DEFAULT/rabbit_hosts').with(
:value => 'rabbit1:5672'
)
should contain_manila_config('DEFAULT/rabbit_ha_queues').with(
is_expected.to contain_manila_config('DEFAULT/rabbit_ha_queues').with(
:value => true
)
end
@ -129,21 +129,21 @@ describe 'manila' do
}
end
it { should contain_manila_config('DEFAULT/sql_connection').with_value('mysql://user:password@host/database') }
it { should contain_manila_config('DEFAULT/rpc_backend').with_value('manila.openstack.common.rpc.impl_qpid') }
it { should contain_manila_config('DEFAULT/qpid_hostname').with_value('localhost') }
it { should contain_manila_config('DEFAULT/qpid_port').with_value('5672') }
it { should contain_manila_config('DEFAULT/qpid_username').with_value('guest') }
it { should contain_manila_config('DEFAULT/qpid_password').with_value('guest').with_secret(true) }
it { should contain_manila_config('DEFAULT/qpid_reconnect').with_value(true) }
it { should contain_manila_config('DEFAULT/qpid_reconnect_timeout').with_value('0') }
it { should contain_manila_config('DEFAULT/qpid_reconnect_limit').with_value('0') }
it { should contain_manila_config('DEFAULT/qpid_reconnect_interval_min').with_value('0') }
it { should contain_manila_config('DEFAULT/qpid_reconnect_interval_max').with_value('0') }
it { should contain_manila_config('DEFAULT/qpid_reconnect_interval').with_value('0') }
it { should contain_manila_config('DEFAULT/qpid_heartbeat').with_value('60') }
it { should contain_manila_config('DEFAULT/qpid_protocol').with_value('tcp') }
it { should contain_manila_config('DEFAULT/qpid_tcp_nodelay').with_value(true) }
it { is_expected.to contain_manila_config('DEFAULT/sql_connection').with_value('mysql://user:password@host/database') }
it { is_expected.to contain_manila_config('DEFAULT/rpc_backend').with_value('manila.openstack.common.rpc.impl_qpid') }
it { is_expected.to contain_manila_config('DEFAULT/qpid_hostname').with_value('localhost') }
it { is_expected.to contain_manila_config('DEFAULT/qpid_port').with_value('5672') }
it { is_expected.to contain_manila_config('DEFAULT/qpid_username').with_value('guest') }
it { is_expected.to contain_manila_config('DEFAULT/qpid_password').with_value('guest').with_secret(true) }
it { is_expected.to contain_manila_config('DEFAULT/qpid_reconnect').with_value(true) }
it { is_expected.to contain_manila_config('DEFAULT/qpid_reconnect_timeout').with_value('0') }
it { is_expected.to contain_manila_config('DEFAULT/qpid_reconnect_limit').with_value('0') }
it { is_expected.to contain_manila_config('DEFAULT/qpid_reconnect_interval_min').with_value('0') }
it { is_expected.to contain_manila_config('DEFAULT/qpid_reconnect_interval_max').with_value('0') }
it { is_expected.to contain_manila_config('DEFAULT/qpid_reconnect_interval').with_value('0') }
it { is_expected.to contain_manila_config('DEFAULT/qpid_heartbeat').with_value('60') }
it { is_expected.to contain_manila_config('DEFAULT/qpid_protocol').with_value('tcp') }
it { is_expected.to contain_manila_config('DEFAULT/qpid_tcp_nodelay').with_value(true) }
end
describe 'with qpid rpc and no qpid_sasl_mechanisms' do
@ -155,7 +155,7 @@ describe 'manila' do
}
end
it { should contain_manila_config('DEFAULT/qpid_sasl_mechanisms').with_ensure('absent') }
it { is_expected.to contain_manila_config('DEFAULT/qpid_sasl_mechanisms').with_ensure('absent') }
end
describe 'with qpid rpc and qpid_sasl_mechanisms string' do
@ -168,7 +168,7 @@ describe 'manila' do
}
end
it { should contain_manila_config('DEFAULT/qpid_sasl_mechanisms').with_value('PLAIN') }
it { is_expected.to contain_manila_config('DEFAULT/qpid_sasl_mechanisms').with_value('PLAIN') }
end
describe 'with qpid rpc and qpid_sasl_mechanisms array' do
@ -181,7 +181,7 @@ describe 'manila' do
}
end
it { should contain_manila_config('DEFAULT/qpid_sasl_mechanisms').with_value('DIGEST-MD5 GSSAPI PLAIN') }
it { is_expected.to contain_manila_config('DEFAULT/qpid_sasl_mechanisms').with_value('DIGEST-MD5 GSSAPI PLAIN') }
end
describe 'with SSL enabled' do
@ -196,11 +196,11 @@ describe 'manila' do
end
it do
should contain_manila_config('DEFAULT/rabbit_use_ssl').with_value(true)
should contain_manila_config('DEFAULT/kombu_ssl_ca_certs').with_value('/path/to/ssl/ca/certs')
should contain_manila_config('DEFAULT/kombu_ssl_certfile').with_value('/path/to/ssl/cert/file')
should contain_manila_config('DEFAULT/kombu_ssl_keyfile').with_value('/path/to/ssl/keyfile')
should contain_manila_config('DEFAULT/kombu_ssl_version').with_value('TLSv1')
is_expected.to contain_manila_config('DEFAULT/rabbit_use_ssl').with_value(true)
is_expected.to contain_manila_config('DEFAULT/kombu_ssl_ca_certs').with_value('/path/to/ssl/ca/certs')
is_expected.to contain_manila_config('DEFAULT/kombu_ssl_certfile').with_value('/path/to/ssl/cert/file')
is_expected.to contain_manila_config('DEFAULT/kombu_ssl_keyfile').with_value('/path/to/ssl/keyfile')
is_expected.to contain_manila_config('DEFAULT/kombu_ssl_version').with_value('TLSv1')
end
end
@ -212,11 +212,11 @@ describe 'manila' do
end
it do
should contain_manila_config('DEFAULT/rabbit_use_ssl').with_value(true)
should contain_manila_config('DEFAULT/kombu_ssl_ca_certs').with_ensure('absent')
should contain_manila_config('DEFAULT/kombu_ssl_certfile').with_ensure('absent')
should contain_manila_config('DEFAULT/kombu_ssl_keyfile').with_ensure('absent')
should contain_manila_config('DEFAULT/kombu_ssl_version').with_value('TLSv1')
is_expected.to contain_manila_config('DEFAULT/rabbit_use_ssl').with_value(true)
is_expected.to contain_manila_config('DEFAULT/kombu_ssl_ca_certs').with_ensure('absent')
is_expected.to contain_manila_config('DEFAULT/kombu_ssl_certfile').with_ensure('absent')
is_expected.to contain_manila_config('DEFAULT/kombu_ssl_keyfile').with_ensure('absent')
is_expected.to contain_manila_config('DEFAULT/kombu_ssl_version').with_value('TLSv1')
end
end
@ -229,11 +229,11 @@ describe 'manila' do
end
it do
should contain_manila_config('DEFAULT/rabbit_use_ssl').with_value(false)
should contain_manila_config('DEFAULT/kombu_ssl_ca_certs').with_ensure('absent')
should contain_manila_config('DEFAULT/kombu_ssl_certfile').with_ensure('absent')
should contain_manila_config('DEFAULT/kombu_ssl_keyfile').with_ensure('absent')
should contain_manila_config('DEFAULT/kombu_ssl_version').with_ensure('absent')
is_expected.to contain_manila_config('DEFAULT/rabbit_use_ssl').with_value(false)
is_expected.to contain_manila_config('DEFAULT/kombu_ssl_ca_certs').with_ensure('absent')
is_expected.to contain_manila_config('DEFAULT/kombu_ssl_certfile').with_ensure('absent')
is_expected.to contain_manila_config('DEFAULT/kombu_ssl_keyfile').with_ensure('absent')
is_expected.to contain_manila_config('DEFAULT/kombu_ssl_version').with_ensure('absent')
end
end
@ -242,7 +242,7 @@ describe 'manila' do
req_params
end
it { should contain_manila_config('DEFAULT/use_syslog').with_value(false) }
it { is_expected.to contain_manila_config('DEFAULT/use_syslog').with_value(false) }
end
describe 'with syslog enabled' do
@ -252,8 +252,8 @@ describe 'manila' do
})
end
it { should contain_manila_config('DEFAULT/use_syslog').with_value(true) }
it { should contain_manila_config('DEFAULT/syslog_log_facility').with_value('LOG_USER') }
it { is_expected.to contain_manila_config('DEFAULT/use_syslog').with_value(true) }
it { is_expected.to contain_manila_config('DEFAULT/syslog_log_facility').with_value('LOG_USER') }
end
describe 'with syslog enabled and custom settings' do
@ -264,13 +264,13 @@ describe 'manila' do
})
end
it { should contain_manila_config('DEFAULT/use_syslog').with_value(true) }
it { should contain_manila_config('DEFAULT/syslog_log_facility').with_value('LOG_LOCAL0') }
it { is_expected.to contain_manila_config('DEFAULT/use_syslog').with_value(true) }
it { is_expected.to contain_manila_config('DEFAULT/syslog_log_facility').with_value('LOG_LOCAL0') }
end
describe 'with log_dir disabled' do
let(:params) { req_params.merge!({:log_dir => false}) }
it { should contain_manila_config('DEFAULT/log_dir').with_ensure('absent') }
it { is_expected.to contain_manila_config('DEFAULT/log_dir').with_ensure('absent') }
end
describe 'with amqp_durable_queues disabled' do
@ -278,7 +278,7 @@ describe 'manila' do
req_params
end
it { should contain_manila_config('DEFAULT/amqp_durable_queues').with_value(false) }
it { is_expected.to contain_manila_config('DEFAULT/amqp_durable_queues').with_value(false) }
end
describe 'with amqp_durable_queues enabled' do
@ -288,7 +288,7 @@ describe 'manila' do
})
end
it { should contain_manila_config('DEFAULT/amqp_durable_queues').with_value(true) }
it { is_expected.to contain_manila_config('DEFAULT/amqp_durable_queues').with_value(true) }
end
describe 'with sqlite' do
@ -299,13 +299,13 @@ describe 'manila' do
}
end
it { should contain_manila_config('DEFAULT/sql_connection').with(
it { is_expected.to contain_manila_config('DEFAULT/sql_connection').with(
:value => 'sqlite:////var/lib/manila/manila.sqlite',
:secret => true
) }
it { should_not contain_class('mysql::python') }
it { should_not contain_class('mysql::bindings') }
it { should_not contain_class('mysql::bindings::python') }
it { is_expected.to_not contain_class('mysql::python') }
it { is_expected.to_not contain_class('mysql::bindings') }
it { is_expected.to_not contain_class('mysql::bindings::python') }
end
describe 'with SSL socket options set' do
@ -319,9 +319,9 @@ describe 'manila' do
}
end
it { should contain_manila_config('DEFAULT/ssl_ca_file').with_value('/path/to/ca') }
it { should contain_manila_config('DEFAULT/ssl_cert_file').with_value('/path/to/cert') }
it { should contain_manila_config('DEFAULT/ssl_key_file').with_value('/path/to/key') }
it { is_expected.to contain_manila_config('DEFAULT/ssl_ca_file').with_value('/path/to/ca') }
it { is_expected.to contain_manila_config('DEFAULT/ssl_cert_file').with_value('/path/to/cert') }
it { is_expected.to contain_manila_config('DEFAULT/ssl_key_file').with_value('/path/to/key') }
end
describe 'with SSL socket options set to false' do
@ -335,9 +335,9 @@ describe 'manila' do
}
end
it { should contain_manila_config('DEFAULT/ssl_ca_file').with_ensure('absent') }
it { should contain_manila_config('DEFAULT/ssl_cert_file').with_ensure('absent') }
it { should contain_manila_config('DEFAULT/ssl_key_file').with_ensure('absent') }
it { is_expected.to contain_manila_config('DEFAULT/ssl_ca_file').with_ensure('absent') }
it { is_expected.to contain_manila_config('DEFAULT/ssl_cert_file').with_ensure('absent') }
it { is_expected.to contain_manila_config('DEFAULT/ssl_key_file').with_ensure('absent') }
end
describe 'with SSL socket options set wrongly configured' do
@ -350,11 +350,7 @@ describe 'manila' do
}
end
it 'should raise an error' do
expect {
should compile
}.to raise_error Puppet::Error, /The cert_file parameter is required when use_ssl is set to true/
end
it_raises 'a Puppet::Error', /The cert_file parameter is required when use_ssl is set to true/
end
end

View File

@ -20,15 +20,15 @@ describe 'manila::backend::generic' do
describe 'generic share driver' do
it 'configures generic share driver' do
should contain_manila_config('hippo/share_backend_name').with(
is_expected.to contain_manila_config('hippo/share_backend_name').with(
:value => 'hippo')
should contain_manila_config('hippo/share_driver').with_value(
is_expected.to contain_manila_config('hippo/share_driver').with_value(
'manila.share.drivers.generic.GenericShareDriver')
should contain_manila_config('hippo/share_helpers').with_value(
'CIFS=manila.share.drivers.generic.CIFSHelper,'\
is_expected.to contain_manila_config('hippo/share_helpers').with_value(
'CIFS=manila.share.drivers.generic.CIFSHelper,'\
'NFS=manila.share.drivers.generic.NFSHelper')
params.each_pair do |config,value|
should contain_manila_config("hippo/#{config}").with_value( value )
is_expected.to contain_manila_config("hippo/#{config}").with_value( value )
end
end
end

View File

@ -13,13 +13,13 @@ describe 'manila::backend::glusterfs' do
end
it 'configures glusterfs share driver' do
should contain_manila_config('mygluster/share_backend_name').with_value(
is_expected.to contain_manila_config('mygluster/share_backend_name').with_value(
'mygluster')
should contain_manila_config('mygluster/share_driver').with_value(
is_expected.to contain_manila_config('mygluster/share_driver').with_value(
'manila.share.drivers.glusterfs.GlusterfsShareDriver')
should contain_manila_config('mygluster/glusterfs_volumes_config').with_value(
is_expected.to contain_manila_config('mygluster/glusterfs_volumes_config').with_value(
'/etc/manila/glusterfs_volumes')
should contain_manila_config('mygluster/glusterfs_mount_point_base').with_value(
is_expected.to contain_manila_config('mygluster/glusterfs_mount_point_base').with_value(
'$state_path/mnt')
end
end

View File

@ -30,15 +30,15 @@ describe 'manila::backend::netapp' do
end
it 'configures netapp share driver' do
should contain_manila_config("mynetapp/share_driver").with_value(
is_expected.to contain_manila_config("mynetapp/share_driver").with_value(
'manila.share.drivers.netapp.cluster_mode.NetAppClusteredShareDriver')
params_hash.each_pair do |config,value|
should contain_manila_config("mynetapp/#{config}").with_value( value )
is_expected.to contain_manila_config("mynetapp/#{config}").with_value( value )
end
end
it 'marks netapp_password as secret' do
should contain_manila_config("mynetapp/netapp_nas_password").with_secret( true )
is_expected.to contain_manila_config("mynetapp/netapp_nas_password").with_secret( true )
end
end

View File

@ -27,7 +27,7 @@ describe 'manila::service_instance' do
it 'configures service instance' do
expect {
params.each_pair do |config,value|
should contain_manila_config("DEFAULT/#{config}").with_value( value )
is_expected.to contain_manila_config("DEFAULT/#{config}").with_value( value )
end
}.to raise_error(Puppet::Error, /Missing required parameter service_image_location/)
end
@ -40,7 +40,7 @@ describe 'manila::service_instance' do
}) }
it 'creates Glance image' do
should contain_glance_image(req_params[:service_image_name]).with(
is_expected.to contain_glance_image(req_params[:service_image_name]).with(
:ensure => 'present',
:is_public => 'yes',
:container_format => 'bare',

View File

@ -17,7 +17,7 @@ describe 'manila::type_set' do
end
it 'should have its execs' do
should contain_exec('manila type-key sith set monchichi=hippo').with(
is_expected.to contain_exec('manila type-key sith set monchichi=hippo').with(
:command => 'manila type-key sith set monchichi=hippo',
:environment => [
'OS_TENANT_NAME=admin',

View File

@ -17,7 +17,7 @@ describe 'manila::type' do
end
it 'should have its execs' do
should contain_exec('manila type-create hippo').with(
is_expected.to contain_exec('manila type-create hippo').with(
:command => 'manila type-create hippo',
:environment => [
'OS_TENANT_NAME=admin',
@ -26,7 +26,7 @@ describe 'manila::type' do
'OS_AUTH_URL=http://127.127.127.1:5000/v2.0/'],
:unless => 'manila type-list | grep hippo',
:require => 'Package[python-manilaclient]')
should contain_exec('manila type-key hippo set volume_backend_name=name1')
should contain_exec('manila type-key hippo set volume_backend_name=name2')
is_expected.to contain_exec('manila type-key hippo set volume_backend_name=name1')
is_expected.to contain_exec('manila type-key hippo set volume_backend_name=name2')
end
end