diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb index c0b557673..b5b50cd34 100644 --- a/spec/acceptance/class_spec.rb +++ b/spec/acceptance/class_spec.rb @@ -83,7 +83,6 @@ class { 'erlang': epel_enable => true} } EOS - apply_manifest(pp_pre, :catch_failures => true) apply_manifest(pp, :catch_failures => true) end diff --git a/spec/acceptance/nodesets/ubuntu-server-1310-x64.yml b/spec/acceptance/nodesets/ubuntu-server-1310-x64.yml deleted file mode 100644 index f4b2366f3..000000000 --- a/spec/acceptance/nodesets/ubuntu-server-1310-x64.yml +++ /dev/null @@ -1,11 +0,0 @@ -HOSTS: - ubuntu-server-1310-x64: - roles: - - master - platform: ubuntu-13.10-amd64 - box : ubuntu-server-1310-x64-vbox4210-nocm - box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-1310-x64-virtualbox-nocm.box - hypervisor : vagrant -CONFIG: - log_level : debug - type: git diff --git a/spec/acceptance/policy_spec.rb b/spec/acceptance/policy_spec.rb new file mode 100644 index 000000000..26858ecc5 --- /dev/null +++ b/spec/acceptance/policy_spec.rb @@ -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 diff --git a/spec/acceptance/user_spec.rb b/spec/acceptance/user_spec.rb new file mode 100644 index 000000000..6aab665a4 --- /dev/null +++ b/spec/acceptance/user_spec.rb @@ -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 diff --git a/spec/acceptance/vhost_spec.rb b/spec/acceptance/vhost_spec.rb new file mode 100644 index 000000000..ef1c2a342 --- /dev/null +++ b/spec/acceptance/vhost_spec.rb @@ -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