cookbook-openstack-dns/spec/spec_helper.rb
Lance Albertson c6042984e7 CentOS 8 support
- Update ChefSpec

Depends-On: https://review.opendev.org/c/openstack/cookbook-openstack-network/+/815172
Change-Id: I617cdb3879dbb1827dff542888808f96dd988c1e
Signed-off-by: Lance Albertson <lance@osuosl.org>
2021-10-22 16:35:18 -07:00

84 lines
2.5 KiB
Ruby

require 'chefspec'
require 'chefspec/berkshelf'
require 'chef/application'
require 'securerandom'
RSpec.configure do |config|
config.color = true
config.formatter = :documentation
config.log_level = :warn
config.file_cache_path = '/var/chef/cache'
end
REDHAT_7 = {
platform: 'redhat',
version: '7',
}.freeze
REDHAT_8 = {
platform: 'redhat',
version: '8',
}.freeze
ALL_RHEL = [
REDHAT_7,
REDHAT_8,
].freeze
UBUNTU_OPTS = {
platform: 'ubuntu',
version: '18.04',
}.freeze
shared_context 'dns-stubs' do
before do
allow_any_instance_of(Chef::Recipe).to receive(:rabbit_transport_url)
.with('dns')
.and_return('rabbit://guest:mypass@127.0.0.1:5672')
allow_any_instance_of(Chef::Recipe).to receive(:rabbit_servers)
.and_return '1.1.1.1:5672,2.2.2.2:5672'
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('db', 'designate')
.and_return('db-pass')
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('service', 'openstack-dns')
.and_return('designate-pass')
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('token', 'designate_rndc')
.and_return('rndc-key')
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('user', 'admin')
.and_return('admin')
end
end
shared_context 'neutron-stubs' do
before do
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('token', 'openstack_identity_bootstrap_token')
.and_return('bootstrap-token')
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('token', 'neutron_metadata_secret')
.and_return('metadata-secret')
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('db', anything)
.and_return('neutron')
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('service', 'openstack-network')
.and_return('neutron-pass')
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('user', 'guest')
.and_return('mq-pass')
allow(Chef::Application).to receive(:fatal!)
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('service', 'openstack-compute')
.and_return('nova-pass')
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('user', 'admin')
.and_return('admin-pass')
allow_any_instance_of(Chef::Recipe).to receive(:rabbit_transport_url)
.with('network')
.and_return('rabbit://guest:mypass@127.0.0.1:5672')
end
end