]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/rabbitmq/spec/acceptance/clustering_spec.rb
move to puppetlabs rabbitmq module
[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 'should run 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 $::osfamily == '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 { should_not contain 'TESTCOOKIE' }
25     end
26
27   end
28   context 'rabbitmq::wipe_db_on_cookie_change => true' do
29     it 'should run successfully' do
30       pp = <<-EOS
31       class { 'rabbitmq': 
32         config_cluster           => true,
33         cluster_nodes            => ['rabbit1', 'rabbit2'],
34         cluster_node_type        => 'ram',
35         erlang_cookie            => 'TESTCOOKIE',
36         wipe_db_on_cookie_change => true,
37       }
38       if $::osfamily == 'RedHat' {
39         class { 'erlang': epel_enable => true}
40         Class['erlang'] -> Class['rabbitmq']
41       }
42       EOS
43
44       apply_manifest(pp, :catch_failures => true)
45     end
46
47     describe file('/etc/rabbitmq/rabbitmq.config') do
48       it { should be_file }
49       it { should contain 'cluster_nodes' }
50       it { should contain 'rabbit@rabbit1' }
51       it { should contain 'rabbit@rabbit2' }
52       it { should contain 'ram' }
53     end
54
55     describe file('/var/lib/rabbitmq/.erlang.cookie') do
56       it { should be_file }
57       it { should contain 'TESTCOOKIE' }
58     end
59   end
60 end