From e3951699f4f31fae874317bb0bf5fcdb7c9b111d Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Tue, 6 Dec 2016 11:23:47 +0300 Subject: [PATCH] Adapt to new management plugin (rabbitmq/rabbitmq-management#236) --- bin/ci/before_build | 4 ++++ .../integration/connection_recovery_spec.rb | 9 ++++++-- .../integration/connection_stop_spec.rb | 22 ++++++++++++++----- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/bin/ci/before_build b/bin/ci/before_build index 72c5ca246..d07a1e1d2 100755 --- a/bin/ci/before_build +++ b/bin/ci/before_build @@ -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().'" diff --git a/spec/higher_level_api/integration/connection_recovery_spec.rb b/spec/higher_level_api/integration/connection_recovery_spec.rb index 5a2c156d3..81ecf2594 100644 --- a/spec/higher_level_api/integration/connection_recovery_spec.rb +++ b/spec/higher_level_api/integration/connection_recovery_spec.rb @@ -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 diff --git a/spec/higher_level_api/integration/connection_stop_spec.rb b/spec/higher_level_api/integration/connection_stop_spec.rb index 8403afeaf..7c06ae191 100644 --- a/spec/higher_level_api/integration/connection_stop_spec.rb +++ b/spec/higher_level_api/integration/connection_stop_spec.rb @@ -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 } @@ -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 @@ -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 @@ -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 @@ -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