Skip to content

Commit 325de42

Browse files
committed
Merge pull request #266 from nibalizer/beaker_vhost
Beaker tests for vhost and policy
2 parents f7306ff + 3741e86 commit 325de42

File tree

5 files changed

+122
-12
lines changed

5 files changed

+122
-12
lines changed

spec/acceptance/class_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ class { 'erlang': epel_enable => true}
8383
}
8484
EOS
8585

86-
8786
apply_manifest(pp_pre, :catch_failures => true)
8887
apply_manifest(pp, :catch_failures => true)
8988
end

spec/acceptance/nodesets/ubuntu-server-1310-x64.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

spec/acceptance/policy_spec.rb

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
require 'spec_helper_acceptance'
2+
3+
describe 'rabbitmq policy on a vhost:' do
4+
5+
6+
context "create policy resource" do
7+
it 'should run successfully' do
8+
pp = <<-EOS
9+
if $::osfamily == 'RedHat' {
10+
class { 'erlang': epel_enable => true }
11+
Class['erlang'] -> Class['::rabbitmq']
12+
}
13+
class { '::rabbitmq':
14+
service_manage => true,
15+
port => '5672',
16+
delete_guest_user => true,
17+
admin_enable => true,
18+
} ->
19+
20+
rabbitmq_vhost { 'myhost':
21+
ensure => present,
22+
} ->
23+
24+
rabbitmq_policy { 'ha-all@myhost':
25+
pattern => '.*',
26+
priority => 0,
27+
applyto => 'all',
28+
definition => {
29+
'ha-mode' => 'all',
30+
'ha-sync-mode' => 'automatic',
31+
},
32+
}
33+
EOS
34+
35+
apply_manifest(pp, :catch_failures => true)
36+
apply_manifest(pp, :catch_changes => true)
37+
end
38+
39+
it 'should have the policy' do
40+
shell('rabbitmqctl list_policies -p myhost') do |r|
41+
expect(r.stdout).to match(/myhost.*ha-all.*ha-sync-mode/)
42+
expect(r.exit_code).to be_zero
43+
end
44+
end
45+
46+
end
47+
end

spec/acceptance/user_spec.rb

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
require 'spec_helper_acceptance'
2+
3+
describe 'rabbitmq user:' do
4+
5+
6+
context "create user resource" do
7+
it 'should run successfully' do
8+
pp = <<-EOS
9+
if $::osfamily == 'RedHat' {
10+
class { 'erlang': epel_enable => true }
11+
Class['erlang'] -> Class['::rabbitmq']
12+
}
13+
class { '::rabbitmq':
14+
service_manage => true,
15+
port => '5672',
16+
delete_guest_user => true,
17+
admin_enable => true,
18+
} ->
19+
20+
rabbitmq_user { 'dan':
21+
admin => true,
22+
password => 'bar',
23+
}
24+
EOS
25+
26+
apply_manifest(pp, :catch_failures => true)
27+
apply_manifest(pp, :catch_changes => true)
28+
end
29+
30+
it 'should have the user' do
31+
shell('rabbitmqctl list_users') do |r|
32+
expect(r.stdout).to match(/dan.*administrator/)
33+
expect(r.exit_code).to be_zero
34+
end
35+
end
36+
37+
end
38+
end

spec/acceptance/vhost_spec.rb

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
require 'spec_helper_acceptance'
2+
3+
describe 'rabbitmq vhost:' do
4+
5+
6+
context "create vhost resource" do
7+
it 'should run successfully' do
8+
pp = <<-EOS
9+
if $::osfamily == 'RedHat' {
10+
class { 'erlang': epel_enable => true }
11+
Class['erlang'] -> Class['::rabbitmq']
12+
}
13+
class { '::rabbitmq':
14+
service_manage => true,
15+
port => '5672',
16+
delete_guest_user => true,
17+
admin_enable => true,
18+
} ->
19+
20+
rabbitmq_vhost { 'myhost':
21+
ensure => present,
22+
}
23+
EOS
24+
25+
apply_manifest(pp, :catch_failures => true)
26+
apply_manifest(pp, :catch_changes => true)
27+
end
28+
29+
it 'should have the vhost' do
30+
shell('rabbitmqctl list_vhosts') do |r|
31+
expect(r.stdout).to match(/myhost/)
32+
expect(r.exit_code).to be_zero
33+
end
34+
end
35+
36+
end
37+
end

0 commit comments

Comments
 (0)