1 require 'spec_helper_acceptance'
3 describe 'rabbitmq policy on a vhost:' do
4 context 'create policy resource' do
5 it 'runs successfully' do
7 if $facts['os']['family'] == 'RedHat' {
8 class { 'erlang': epel_enable => true }
9 Class['erlang'] -> Class['rabbitmq']
12 service_manage => true,
14 delete_guest_user => true,
18 rabbitmq_vhost { 'myhost':
22 rabbitmq_policy { 'ha-all@myhost':
28 'ha-sync-mode' => 'automatic',
32 rabbitmq_policy { 'eu-federation@myhost':
37 'federation-upstream-set' => 'all',
42 apply_manifest(pp, catch_failures: true)
43 apply_manifest(pp, catch_changes: true)
45 # Apply twice to ensure no changes the second time.
46 apply_manifest(pp, catch_failures: true)
47 expect(apply_manifest(pp, catch_changes: true).exit_code).to be_zero
50 # rubocop:disable RSpec/MultipleExpectations
51 it 'has the policy' do
52 shell('rabbitmqctl list_policies -p myhost') do |r|
53 expect(r.stdout).to match(%r{myhost.*ha-all.*ha-sync-mode})
54 expect(r.stdout).to match(%r{myhost.*eu-federation})
55 expect(r.exit_code).to be_zero
58 # rubocop:enable RSpec/MultipleExpectations