Skip to content

Commit

Permalink
Beaker tests for vhost and policy
Browse files Browse the repository at this point in the history
Adds a beaker tests for rabbitmq_policy and tests vhost while its
there. Also removes the saucy nodeset because saucy is super EOL.
Also removes some errant whitespace I found.
  • Loading branch information
nibalizer committed Dec 5, 2014
1 parent 53adb36 commit dac9d75
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 12 deletions.
1 change: 0 additions & 1 deletion spec/acceptance/class_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ class { 'erlang': epel_enable => true}
}
EOS


apply_manifest(pp_pre, :catch_failures => true)
apply_manifest(pp, :catch_failures => true)
end
Expand Down
11 changes: 0 additions & 11 deletions spec/acceptance/nodesets/ubuntu-server-1310-x64.yml

This file was deleted.

46 changes: 46 additions & 0 deletions spec/acceptance/policy_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
require 'spec_helper_acceptance'

describe 'rabbitmq policy on a vhost:' do


context "create policy resource" do
it 'should run successfully' do
pp = <<-EOS
if $::osfamily == 'RedHat' {
class { 'erlang': epel_enable => true }
Class['erlang'] -> Class['::rabbitmq']
}
class { '::rabbitmq':
service_manage => true,
port => '5672',
delete_guest_user => true,
admin_enable => true,
} ->
rabbitmq_vhost { 'myhost':
ensure => present,
} ->
rabbitmq_policy { 'ha-all@myhost':
pattern => '.*',
priority => 0,
applyto => 'all',
definition => {
'ha-mode' => 'all',
'ha-sync-mode' => 'automatic',
},
}
EOS

apply_manifest(pp, :catch_failures => true)
end

describe command('rabbitmqctl list_policies -p myhost') do
its(:stdout) { should match /myhost/ }
its(:stdout) { should match /ha-all/ }
its(:stdout) { should match /ha-sync-mode/ }
its(:stdout) { should match /\.\*/ }
end

end
end
35 changes: 35 additions & 0 deletions spec/acceptance/user_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
require 'spec_helper_acceptance'

describe 'rabbitmq user:' do


context "create user resource" do
it 'should run successfully' do
pp = <<-EOS
if $::osfamily == 'RedHat' {
class { 'erlang': epel_enable => true }
Class['erlang'] -> Class['::rabbitmq']
}
class { '::rabbitmq':
service_manage => true,
port => '5672',
delete_guest_user => true,
admin_enable => true,
} ->
rabbitmq_user { 'dan':
admin => true,
password => 'bar',
}
EOS

apply_manifest(pp, :catch_failures => true)
end

describe command('rabbitmqctl list_users | grep dan') do
its(:stdout) { should match /dan/ }
its(:stdout) { should match /administrator/ }
end

end
end
33 changes: 33 additions & 0 deletions spec/acceptance/vhost_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
require 'spec_helper_acceptance'

describe 'rabbitmq vhost:' do


context "create vhost resource" do
it 'should run successfully' do
pp = <<-EOS
if $::osfamily == 'RedHat' {
class { 'erlang': epel_enable => true }
Class['erlang'] -> Class['::rabbitmq']
}
class { '::rabbitmq':
service_manage => true,
port => '5672',
delete_guest_user => true,
admin_enable => true,
} ->
rabbitmq_vhost { 'myhost':
ensure => present,
}
EOS

apply_manifest(pp, :catch_failures => true)
end

describe command('rabbitmqctl list_vhosts | grep myhost') do
its(:stdout) { should match /myhost/ }
end

end
end

0 comments on commit dac9d75

Please sign in to comment.