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