Skip to content

Commit

Permalink
Extended acceptance test with a static cluster config
Browse files Browse the repository at this point in the history
This will verify if a cluster config for a live-only cluster
is valid.
  • Loading branch information
Michiel Hendriks committed Nov 14, 2023
1 parent 1af323f commit 61554c4
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion spec/acceptance/activemq_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
require 'spec_helper_acceptance'

RSpec::Matchers.define_negated_matcher :not_match, :match

describe 'activemq' do
let(:activemq_checksum) { 'a73331cb959bb0ba9667414682c279bc9ce2aec4c8fecbcdee4670bf9d63bf66010c8c55a6b727b1ad6d51bbccadd663b96a70b867721d9388d54a9391c6af85' }
let(:activemq_group) { 'activemq' }
Expand Down Expand Up @@ -41,13 +43,28 @@
admin_password => '#{activemq_instance_password}',
admin_user => '#{activemq_instance_user}',
checksum => '#{activemq_checksum}',
cluster => false,
cluster => true,
cluster_password => '#{activemq_instance_password}',
cluster_user => '#{activemq_instance_user}',
cluster_name => 'activemq-cluster',
cluster_topology => {
'#{activemq_instance_name}' => {
target_host => 'localhost',
bind => '127.0.0.1',
},
'instance2' => {
target_host => 'localhost',
bind => '127.0.0.2',
}
},
server_discovery => 'static',
download_url => 'http://archive.apache.org/dist/activemq/activemq-artemis/#{activemq_version}/%s',
instances => {
'#{activemq_instance_name}' => {
bind => '127.0.0.1',
port => 61616,
web_port => 8161,
ha_policy => 'live-only',
acceptors => {
artemis => { port => 61616 },
amqp => { port => 5672 },
Expand All @@ -72,6 +89,14 @@
it { expect(file("#{activemq_instance_base}/#{activemq_instance_name}/etc/artemis.profile").content).to match(%r{^ARTEMIS_HOME}) }
it { expect(file("#{activemq_instance_base}/#{activemq_instance_name}/etc/artemis.profile").content).to match(%r{^JAVA_ARGS}) }

# Test that 'artemis-instance1' is not in the static-connectors list
it {
expect(file("#{activemq_instance_base}/#{activemq_instance_name}/etc/broker.xml").content.gsub(%r{.*<static-connectors[^>]*>(.*)</static-connectors>.*}ms, '\1'))
.to match(%r{instance2})
.and not_match(%r{:activemq_instance_name})
}
it { expect(file("#{activemq_instance_base}/#{activemq_instance_name}/etc/broker.xml").content).to match(%r{allow-direct-connections-only="true"}) }

it 'sets up the service' do
expect(service("activemq@#{activemq_instance_name}")).to be_running
expect(service("activemq@#{activemq_instance_name}")).to be_enabled
Expand Down

0 comments on commit 61554c4

Please sign in to comment.