2014-01-17 16:04:13 +00:00
|
|
|
# encoding: UTF-8
|
|
|
|
require 'chefspec'
|
|
|
|
require 'chefspec/berkshelf'
|
2014-03-28 17:40:44 +01:00
|
|
|
|
|
|
|
ChefSpec::Coverage.start! { add_filter 'openstack-ops-messaging' }
|
|
|
|
|
2014-02-27 10:59:01 -06:00
|
|
|
LOG_LEVEL = :fatal
|
|
|
|
REDHAT_OPTS = {
|
2014-01-17 16:04:13 +00:00
|
|
|
platform: 'redhat',
|
2017-11-27 00:09:44 -08:00
|
|
|
version: '7.3',
|
2017-08-23 22:37:44 -04:00
|
|
|
log_level: LOG_LEVEL,
|
2016-07-03 10:18:14 -07:00
|
|
|
}.freeze
|
2014-02-27 10:59:01 -06:00
|
|
|
UBUNTU_OPTS = {
|
2014-01-17 16:04:13 +00:00
|
|
|
platform: 'ubuntu',
|
2017-11-27 00:09:44 -08:00
|
|
|
version: '16.04',
|
2017-08-23 22:37:44 -04:00
|
|
|
log_level: LOG_LEVEL,
|
2016-07-03 10:18:14 -07:00
|
|
|
}.freeze
|
2013-06-18 19:27:06 -04:00
|
|
|
|
2014-02-27 10:59:01 -06:00
|
|
|
shared_context 'ops_messaging_stubs' do
|
|
|
|
before do
|
2014-07-29 11:51:48 -05:00
|
|
|
allow_any_instance_of(Chef::Recipe).to receive(:address_for)
|
2014-02-27 10:59:01 -06:00
|
|
|
.with('lo')
|
|
|
|
.and_return '127.0.0.1'
|
2014-07-29 11:51:48 -05:00
|
|
|
allow_any_instance_of(Chef::Recipe).to receive(:address_for)
|
2017-11-27 00:09:44 -08:00
|
|
|
.with('enp0s3')
|
2014-02-27 10:59:01 -06:00
|
|
|
.and_return '33.44.55.66'
|
2014-07-29 11:51:48 -05:00
|
|
|
allow_any_instance_of(Chef::Recipe).to receive(:search)
|
2016-02-11 07:42:46 +01:00
|
|
|
.with(:node, 'recipes:openstack-ops-messaging\\:\\:rabbitmq-server AND chef_environment:_default')
|
2014-02-27 10:59:01 -06:00
|
|
|
.and_return [
|
2015-05-29 12:06:02 -05:00
|
|
|
{ 'hostname' => 'host2' },
|
2017-08-23 22:37:44 -04:00
|
|
|
{ 'hostname' => 'host1' },
|
2015-05-29 12:06:02 -05:00
|
|
|
]
|
2014-07-29 11:51:48 -05:00
|
|
|
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
|
2014-02-27 10:59:01 -06:00
|
|
|
.with('user', anything)
|
|
|
|
.and_return 'rabbit-pass'
|
2014-07-29 11:51:48 -05:00
|
|
|
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
|
2014-02-27 10:59:01 -06:00
|
|
|
.with('service', 'rabbit_cookie')
|
|
|
|
.and_return 'erlang-cookie'
|
|
|
|
end
|
2013-06-18 19:27:06 -04:00
|
|
|
end
|