Skip to content

Commit

Permalink
Adapt to new management plugin (rabbitmq/rabbitmq-management#236)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelklishin committed Dec 6, 2016
1 parent e2fbeaa commit e395169
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
4 changes: 4 additions & 0 deletions bin/ci/before_build
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,7 @@ rabbit_control 'set_permissions -p bunny_testbed bunny_reader "^---$" "^---$" ".

# requires RabbitMQ 3.0+
# rabbit_plugins 'enable rabbitmq_management'

# Reduce retention policy for faster publishing of stats
rabbit_control "eval 'supervisor2:terminate_child(rabbit_mgmt_sup_sup, rabbit_mgmt_sup), application:set_env(rabbitmq_management, sample_retention_policies, [{global, [{605, 1}]}, {basic, [{605, 1}]}, {detailed, [{10, 1}]}]), rabbit_mgmt_sup_sup:start_child().'"
rabbit_control "eval 'supervisor2:terminate_child(rabbit_mgmt_agent_sup_sup, rabbit_mgmt_agent_sup), application:set_env(rabbitmq_management_agent, sample_retention_policies, [{global, [{605, 1}]}, {basic, [{605, 1}]}, {detailed, [{10, 1}]}]), rabbit_mgmt_agent_sup_sup:start_child().'"
9 changes: 7 additions & 2 deletions spec/higher_level_api/integration/connection_recovery_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,13 @@ def close_all_connections!
# let whatever actions were taken before
# this call a chance to propagate, e.g. to make
# sure that connections are accounted for in the
# stats DB. MK.
sleep 1.05
# stats DB.
#
# See bin/ci/before_build for management plugin
# pre-configuration.
#
# MK.
sleep 1.1
connections.each do |conn_info|
close_ignoring_permitted_exceptions(conn_info.name)
end
Expand Down
22 changes: 16 additions & 6 deletions spec/higher_level_api/integration/connection_stop_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@
let(:http_client) { RabbitMQ::HTTP::Client.new("http://127.0.0.1:15672") }

def close_connection(client_port)
# let whatever actions were taken before
# this call a chance to propagate, e.g. to make
# sure that connections are accounted for in the
# stats DB.
#
# See bin/ci/before_build for management plugin
# pre-configuration.
#
# MK.
sleep 1.1
c = http_client.
list_connections.
find { |conn_info| conn_info.peer_port.to_i == client_port }
Expand All @@ -12,11 +22,11 @@ def close_connection(client_port)
end

def wait_for_recovery
sleep 0.5
sleep 1.5
end

it "can be closed" do
c = Bunny.new(:automatically_recover => false)
c = Bunny.new(automatically_recover: false)
c.start
ch = c.create_channel

Expand All @@ -26,7 +36,7 @@ def wait_for_recovery
end

it "can be closed twice (Session#close is idempotent)" do
c = Bunny.new(:automatically_recover => false)
c = Bunny.new(automatically_recover: false)
c.start
ch = c.create_channel

Expand All @@ -39,7 +49,7 @@ def wait_for_recovery

describe "in a single threaded mode" do
it "can be closed" do
c = Bunny.new(:automatically_recover => false, :threaded => false)
c = Bunny.new(automatically_recover: false, threaded: false)
c.start
ch = c.create_channel

Expand All @@ -52,13 +62,13 @@ def wait_for_recovery

describe "that recovers from connection.close" do
it "can be closed" do
c = Bunny.new(:automatically_recover => true, :recover_from_connection_close => true, :network_recovery_interval => 0.2)
c = Bunny.new(automatically_recover: true, recover_from_connection_close: true, network_recovery_interval: 0.2)
c.start
ch = c.create_channel

expect(c).to be_open
close_connection(c.local_port)
sleep 0.2
sleep 1.1
expect(c).not_to be_open

wait_for_recovery
Expand Down

0 comments on commit e395169

Please sign in to comment.