1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
require 'spec_helper_acceptance'
describe 'rabbitmq clustering' do
context 'rabbitmq::wipe_db_on_cookie_change => false' do
it 'runs successfully' do
pp = <<-EOS
class { 'rabbitmq':
config_cluster => true,
cluster_nodes => ['rabbit1', 'rabbit2'],
cluster_node_type => 'ram',
erlang_cookie => 'TESTCOOKIE',
wipe_db_on_cookie_change => false,
}
if $facts['os']['family'] == 'RedHat' {
class { 'erlang': epel_enable => true}
Class['erlang'] -> Class['rabbitmq']
}
EOS
apply_manifest(pp, expect_failures: true)
end
describe file('/var/lib/rabbitmq/.erlang.cookie') do
it { is_expected.not_to contain 'TESTCOOKIE' }
end
end
context 'rabbitmq::wipe_db_on_cookie_change => true' do
it 'runs successfully' do
pp = <<-EOS
class { 'rabbitmq':
config_cluster => true,
cluster_nodes => ['rabbit1', 'rabbit2'],
cluster_node_type => 'ram',
erlang_cookie => 'TESTCOOKIE',
wipe_db_on_cookie_change => true,
}
if $facts['os']['family'] == 'RedHat' {
class { 'erlang': epel_enable => true}
Class['erlang'] -> Class['rabbitmq']
}
EOS
apply_manifest(pp, catch_failures: true)
end
describe file('/etc/rabbitmq/rabbitmq.config') do
it { is_expected.to be_file }
it { is_expected.to contain 'cluster_nodes' }
it { is_expected.to contain 'rabbit@rabbit1' }
it { is_expected.to contain 'rabbit@rabbit2' }
it { is_expected.to contain 'ram' }
end
describe file('/var/lib/rabbitmq/.erlang.cookie') do
it { is_expected.to be_file }
it { is_expected.to contain 'TESTCOOKIE' }
end
end
end
|