Skip to content

Commit

Permalink
Merge pull request redhat-openstack#266 from nibalizer/beaker_vhost
Browse files Browse the repository at this point in the history
Beaker tests for vhost and policy
  • Loading branch information
cmurphy committed Dec 17, 2014
2 parents f7306ff + 3741e86 commit 325de42
Show file tree
Hide file tree
Showing 5 changed files with 122 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.

47 changes: 47 additions & 0 deletions spec/acceptance/policy_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
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)
apply_manifest(pp, :catch_changes => true)
end

it 'should have the policy' do
shell('rabbitmqctl list_policies -p myhost') do |r|
expect(r.stdout).to match(/myhost.*ha-all.*ha-sync-mode/)
expect(r.exit_code).to be_zero
end
end

end
end
38 changes: 38 additions & 0 deletions spec/acceptance/user_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
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)
apply_manifest(pp, :catch_changes => true)
end

it 'should have the user' do
shell('rabbitmqctl list_users') do |r|
expect(r.stdout).to match(/dan.*administrator/)
expect(r.exit_code).to be_zero
end
end

end
end
37 changes: 37 additions & 0 deletions spec/acceptance/vhost_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
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)
apply_manifest(pp, :catch_changes => true)
end

it 'should have the vhost' do
shell('rabbitmqctl list_vhosts') do |r|
expect(r.stdout).to match(/myhost/)
expect(r.exit_code).to be_zero
end
end

end
end

0 comments on commit 325de42

Please sign in to comment.