Skip to content

Commit

Permalink
Install erlang from packagecloud in acceptance tests
Browse files Browse the repository at this point in the history
Now we install rabbitmq from packagecloud by default. Install erlang
from the same source so that we use the latest versions available for
both rabbitmq and erlang.
  • Loading branch information
kajinamit committed Mar 18, 2023
1 parent dca42e6 commit 73b519b
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 77 deletions.
20 changes: 4 additions & 16 deletions spec/acceptance/class_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@
context 'default class inclusion' do
let(:pp) do
<<-EOS
class { 'erlang': repo_source => 'packagecloud' } ->
class { 'rabbitmq': }
if $facts['os']['family'] == 'RedHat' {
class { 'erlang': epel_enable => true}
Class['erlang'] -> Class['rabbitmq']
}
EOS
end

Expand Down Expand Up @@ -51,13 +48,10 @@ class { 'erlang': epel_enable => true}
context 'disable and stop service' do
let(:pp) do
<<-EOS
class { 'erlang': repo_source => 'packagecloud' } ->
class { 'rabbitmq':
service_ensure => 'stopped',
}
if $facts['os']['family'] == 'RedHat' {
class { 'erlang': epel_enable => true}
Class['erlang'] -> Class['rabbitmq']
}
EOS
end

Expand All @@ -72,22 +66,16 @@ class { 'erlang': epel_enable => true}
context 'service is unmanaged' do
it 'runs successfully' do
pp_pre = <<-EOS
class { 'erlang': repo_source => 'packagecloud' } ->
class { 'rabbitmq': }
if $facts['os']['family'] == 'RedHat' {
class { 'erlang': epel_enable => true}
Class['erlang'] -> Class['rabbitmq']
}
EOS

pp = <<-EOS
class { 'erlang': repo_source => 'packagecloud' } ->
class { 'rabbitmq':
service_manage => false,
service_ensure => 'stopped',
}
if $facts['os']['family'] == 'RedHat' {
class { 'erlang': epel_enable => true}
Class['erlang'] -> Class['rabbitmq']
}
EOS

apply_manifest(pp_pre, catch_failures: true)
Expand Down
15 changes: 3 additions & 12 deletions spec/acceptance/clustering_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
context 'rabbitmq::wipe_db_on_cookie_change => false' do
it 'runs successfully' do
pp = <<-EOS
class { 'erlang': repo_source => 'packagecloud' } ->
class { 'rabbitmq':
cluster => { 'name' => 'rabbit_cluster', 'init_node' => $facts['fqdn'] },
config_cluster => true,
Expand All @@ -15,10 +16,6 @@ class { 'rabbitmq':
erlang_cookie => 'TESTCOOKIE',
wipe_db_on_cookie_change => false,
}
if $facts['os']['family'] == 'RedHat' {
class { 'erlang': epel_enable => true}
Class['erlang'] -> Class['rabbitmq']
}
EOS

apply_manifest(pp, expect_failures: true)
Expand All @@ -32,6 +29,7 @@ class { 'erlang': epel_enable => true}
context 'rabbitmq::wipe_db_on_cookie_change => true' do
it 'runs successfully' do
pp = <<-EOS
class { 'erlang': repo_source => 'packagecloud' } ->
class { 'rabbitmq':
cluster => { 'name' => 'rabbit_cluster', 'init_node' => $facts['fqdn'] },
config_cluster => true,
Expand All @@ -41,10 +39,6 @@ class { 'rabbitmq':
erlang_cookie => 'TESTCOOKIE',
wipe_db_on_cookie_change => true,
}
if $facts['os']['family'] == 'RedHat' {
class { 'erlang': epel_enable => true}
Class['erlang'] -> Class['rabbitmq']
}
EOS

apply_manifest(pp, catch_failures: true)
Expand Down Expand Up @@ -78,6 +72,7 @@ class { 'erlang': epel_enable => true}
context 'rabbitmq::cluster[:local_node] = foobar' do
it 'runs successfully' do
pp = <<-EOS
class { 'erlang': repo_source => 'packagecloud' } ->
class { 'rabbitmq':
cluster => { 'name' => 'rabbit_cluster', 'init_node' => 'foobar', 'local_node' => 'foobar' },
config_cluster => true,
Expand All @@ -86,10 +81,6 @@ class { 'rabbitmq':
environment_variables => { 'RABBITMQ_USE_LONGNAME' => true, 'NODENAME' => 'rabbit@foobar' },
erlang_cookie => 'TESTCOOKIE',
}
if $facts['os']['family'] == 'RedHat' {
class { 'erlang': epel_enable => true}
Class['erlang'] -> Class['rabbitmq']
}
EOS

apply_manifest(pp, expect_failures: true)
Expand Down
5 changes: 1 addition & 4 deletions spec/acceptance/delete_guest_user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@
context 'delete_guest_user' do
it 'runs successfully' do
pp = <<-EOS
class { 'erlang': repo_source => 'packagecloud' } ->
class { 'rabbitmq':
port => 5672,
delete_guest_user => true,
}
if $facts['os']['family'] == 'RedHat' {
class { 'erlang': epel_enable => true}
Class['erlang'] -> Class['rabbitmq']
}
EOS

apply_manifest(pp, catch_failures: true)
Expand Down
5 changes: 1 addition & 4 deletions spec/acceptance/parameter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
context 'create parameter resource' do
it 'runs successfully' do
pp = <<-EOS
if $facts['os']['family'] == 'RedHat' {
class { 'erlang': epel_enable => true }
Class['erlang'] -> Class['rabbitmq']
}
class { 'erlang': repo_source => 'packagecloud' } ->
class { 'rabbitmq':
service_manage => true,
port => 5672,
Expand Down
5 changes: 1 addition & 4 deletions spec/acceptance/policy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
context 'create policy resource' do
it 'runs successfully' do
pp = <<-EOS
if $facts['os']['family'] == 'RedHat' {
class { 'erlang': epel_enable => true }
Class['erlang'] -> Class['rabbitmq']
}
class { 'erlang': repo_source => 'packagecloud' } ->
class { 'rabbitmq':
service_manage => true,
port => 5672,
Expand Down
15 changes: 3 additions & 12 deletions spec/acceptance/queue_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
context 'create binding and queue resources when using default management port' do
it 'runs successfully' do
pp = <<-EOS
if $facts['os']['family'] == 'RedHat' {
class { 'erlang': epel_enable => true }
Class['erlang'] -> Class['rabbitmq']
}
class { 'erlang': repo_source => 'packagecloud' } ->
class { 'rabbitmq':
service_manage => true,
port => 5672,
Expand Down Expand Up @@ -80,10 +77,7 @@ class { 'rabbitmq':
context 'create multiple bindings when same source / destination / vhost but different routing keys' do
it 'runs successfully' do
pp = <<-EOS
if $facts['os']['family'] == 'RedHat' {
class { 'erlang': epel_enable => true }
Class['erlang'] -> Class['rabbitmq']
}
class { 'erlang': repo_source => 'packagecloud' } ->
class { 'rabbitmq':
service_manage => true,
port => 5672,
Expand Down Expand Up @@ -168,10 +162,7 @@ class { 'rabbitmq':
context 'create binding and queue resources when using a non-default management port' do
it 'runs successfully' do
pp = <<-EOS
if $facts['os']['family'] == 'RedHat' {
class { 'erlang': epel_enable => true }
Class['erlang'] -> Class['rabbitmq']
}
class { 'erlang': repo_source => 'packagecloud' } ->
class { 'rabbitmq':
service_manage => true,
port => 5672,
Expand Down
20 changes: 4 additions & 16 deletions spec/acceptance/rabbitmqadmin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@
context 'downloads the cli tools' do
it 'runs successfully' do
pp = <<-EOS
class { 'erlang': repo_source => 'packagecloud' } ->
class { 'rabbitmq':
admin_enable => true,
service_manage => true,
}
if $facts['os']['family'] == 'RedHat' {
class { 'erlang': epel_enable => true}
Class['erlang'] -> Class['rabbitmq']
}
EOS

apply_manifest(pp, catch_failures: true)
Expand All @@ -27,14 +24,11 @@ class { 'erlang': epel_enable => true}
context 'does nothing if service is unmanaged' do
it 'runs successfully' do
pp = <<-EOS
class { 'erlang': repo_source => 'packagecloud' } ->
class { 'rabbitmq':
admin_enable => true,
service_manage => false,
}
if $facts['os']['family'] == 'RedHat' {
class { 'erlang': epel_enable => true}
Class['erlang'] -> Class['rabbitmq']
}
EOS

shell('rm -f /var/lib/rabbitmq/rabbitmqadmin')
Expand All @@ -50,28 +44,22 @@ class { 'erlang': epel_enable => true}
it 'runs successfully' do
# make sure credential change takes effect before admin_enable
pp_pre = <<-EOS
class { 'erlang': repo_source => 'packagecloud' } ->
class { 'rabbitmq':
service_manage => true,
default_user => 'foobar',
default_pass => 'bazblam',
}
if $facts['os']['family'] == 'RedHat' {
class { 'erlang': epel_enable => true}
Class['erlang'] -> Class['rabbitmq']
}
EOS

pp = <<-EOS
class { 'erlang': repo_source => 'packagecloud' } ->
class { 'rabbitmq':
admin_enable => true,
service_manage => true,
default_user => 'foobar',
default_pass => 'bazblam',
}
if $facts['os']['family'] == 'RedHat' {
class { 'erlang': epel_enable => true}
Class['erlang'] -> Class['rabbitmq']
}
EOS

shell('rm -f /var/lib/rabbitmq/rabbitmqadmin')
Expand Down
5 changes: 1 addition & 4 deletions spec/acceptance/user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
context 'create user resource' do
it 'runs successfully' do
pp = <<-EOS
if $facts['os']['family'] == 'RedHat' {
class { 'erlang': epel_enable => true }
Class['erlang'] -> Class['rabbitmq']
}
class { 'erlang': repo_source => 'packagecloud' } ->
class { 'rabbitmq':
service_manage => true,
port => 5672,
Expand Down
5 changes: 1 addition & 4 deletions spec/acceptance/vhost_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
context 'create vhost resource' do
it 'runs successfully' do
pp = <<-EOS
if $facts['os']['family'] == 'RedHat' {
class { 'erlang': epel_enable => true }
Class['erlang'] -> Class['rabbitmq']
}
class { 'erlang': repo_source => 'packagecloud' } ->
class { 'rabbitmq':
service_manage => true,
port => 5672,
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
when 'Debian'
install_module_from_forge_on(host, 'puppetlabs-apt', '>= 4.1.0 < 9.0.0')
when 'RedHat'
install_module_from_forge_on(host, 'garethr-erlang', '>= 0.3.0 < 1.0.0')
install_module_from_forge_on(host, 'puppet-erlang', '>= 1.0.0 < 2.0.0')
if fact_on(host, 'os.selinux.enabled')
# Make sure selinux is disabled so the tests work.
on host, puppet('resource', 'exec', 'setenforce 0', 'path=/bin:/sbin:/usr/bin:/usr/sbin', 'onlyif=which setenforce && getenforce | grep Enforcing')
Expand Down

0 comments on commit 73b519b

Please sign in to comment.