bunny 1.7.1 → 2.0.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CONTRIBUTING.md +14 -0
- data/ChangeLog.md +21 -6
- data/Gemfile +1 -1
- data/LICENSE +1 -1
- data/README.md +22 -23
- data/bunny.gemspec +1 -1
- data/lib/bunny/channel.rb +12 -0
- data/lib/bunny/concurrent/continuation_queue.rb +30 -13
- data/lib/bunny/exchange.rb +0 -5
- data/lib/bunny/jruby/socket.rb +1 -2
- data/lib/bunny/queue.rb +9 -0
- data/lib/bunny/session.rb +7 -6
- data/lib/bunny/version.rb +1 -1
- data/spec/higher_level_api/integration/basic_ack_spec.rb +9 -9
- data/spec/higher_level_api/integration/basic_cancel_spec.rb +4 -4
- data/spec/higher_level_api/integration/basic_consume_spec.rb +22 -22
- data/spec/higher_level_api/integration/basic_consume_with_objects_spec.rb +1 -1
- data/spec/higher_level_api/integration/basic_get_spec.rb +2 -2
- data/spec/higher_level_api/integration/basic_nack_spec.rb +6 -6
- data/spec/higher_level_api/integration/basic_publish_spec.rb +14 -14
- data/spec/higher_level_api/integration/basic_qos_spec.rb +11 -2
- data/spec/higher_level_api/integration/basic_recover_spec.rb +2 -2
- data/spec/higher_level_api/integration/basic_reject_spec.rb +6 -6
- data/spec/higher_level_api/integration/basic_return_spec.rb +1 -1
- data/spec/higher_level_api/integration/channel_close_spec.rb +2 -2
- data/spec/higher_level_api/integration/channel_open_spec.rb +11 -11
- data/spec/higher_level_api/integration/connection_recovery_spec.rb +52 -52
- data/spec/higher_level_api/integration/connection_spec.rb +83 -83
- data/spec/higher_level_api/integration/connection_stop_spec.rb +11 -11
- data/spec/higher_level_api/integration/consistent_hash_exchange_spec.rb +2 -2
- data/spec/higher_level_api/integration/consumer_cancellation_notification_spec.rb +3 -3
- data/spec/higher_level_api/integration/dead_lettering_spec.rb +6 -6
- data/spec/higher_level_api/integration/exchange_bind_spec.rb +1 -1
- data/spec/higher_level_api/integration/exchange_declare_spec.rb +20 -20
- data/spec/higher_level_api/integration/exchange_delete_spec.rb +11 -11
- data/spec/higher_level_api/integration/exchange_unbind_spec.rb +2 -2
- data/spec/higher_level_api/integration/merry_go_round_spec.rb +2 -2
- data/spec/higher_level_api/integration/message_properties_access_spec.rb +27 -27
- data/spec/higher_level_api/integration/predeclared_exchanges_spec.rb +1 -1
- data/spec/higher_level_api/integration/publisher_confirms_spec.rb +19 -19
- data/spec/higher_level_api/integration/publishing_edge_cases_spec.rb +9 -9
- data/spec/higher_level_api/integration/queue_bind_spec.rb +13 -13
- data/spec/higher_level_api/integration/queue_declare_spec.rb +23 -23
- data/spec/higher_level_api/integration/queue_delete_spec.rb +1 -1
- data/spec/higher_level_api/integration/queue_purge_spec.rb +2 -2
- data/spec/higher_level_api/integration/queue_unbind_spec.rb +2 -2
- data/spec/higher_level_api/integration/read_only_consumer_spec.rb +3 -3
- data/spec/higher_level_api/integration/sender_selected_distribution_spec.rb +4 -4
- data/spec/higher_level_api/integration/tls_connection_spec.rb +5 -5
- data/spec/higher_level_api/integration/with_channel_spec.rb +1 -1
- data/spec/issues/issue100_spec.rb +9 -10
- data/spec/issues/issue141_spec.rb +11 -12
- data/spec/issues/issue224_spec.rb +2 -2
- data/spec/issues/issue78_spec.rb +14 -18
- data/spec/issues/issue83_spec.rb +5 -6
- data/spec/issues/issue97_spec.rb +25 -26
- data/spec/lower_level_api/integration/basic_cancel_spec.rb +15 -16
- data/spec/lower_level_api/integration/basic_consume_spec.rb +19 -20
- data/spec/stress/channel_open_stress_spec.rb +1 -1
- data/spec/stress/channel_open_stress_with_single_threaded_connection_spec.rb +6 -7
- data/spec/stress/concurrent_consumers_stress_spec.rb +6 -7
- data/spec/stress/concurrent_publishers_stress_spec.rb +6 -7
- data/spec/stress/connection_open_close_spec.rb +6 -6
- data/spec/stress/long_running_consumer_spec.rb +6 -7
- data/spec/unit/bunny_spec.rb +5 -5
- data/spec/unit/concurrent/atomic_fixnum_spec.rb +6 -6
- data/spec/unit/concurrent/condition_spec.rb +3 -3
- data/spec/unit/concurrent/linked_continuation_queue_spec.rb +2 -2
- data/spec/unit/concurrent/synchronized_sorted_set_spec.rb +16 -16
- data/spec/unit/system_timer_spec.rb +2 -2
- data/spec/unit/version_delivery_tag_spec.rb +3 -3
- metadata +8 -7
@@ -2,18 +2,17 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
unless ENV["CI"]
|
4
4
|
describe Bunny::Channel, "#basic_publish" do
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
c
|
5
|
+
before :all do
|
6
|
+
@connection = Bunny.new(:user => "bunny_gem",
|
7
|
+
:password => "bunny_password",
|
8
|
+
:vhost => "bunny_testbed",
|
9
|
+
:write_timeout => 0,
|
10
|
+
:read_timeout => 0)
|
11
|
+
@connection.start
|
13
12
|
end
|
14
13
|
|
15
14
|
after :all do
|
16
|
-
connection.close if connection.open?
|
15
|
+
@connection.close if @connection.open?
|
17
16
|
end
|
18
17
|
|
19
18
|
|
@@ -22,7 +21,7 @@ unless ENV["CI"]
|
|
22
21
|
let(:m) { 10 }
|
23
22
|
|
24
23
|
it "successfully publishers them all" do
|
25
|
-
ch = connection.create_channel
|
24
|
+
ch = @connection.create_channel
|
26
25
|
|
27
26
|
q = ch.queue("", :exclusive => true)
|
28
27
|
x = ch.default_exchange
|
@@ -1,22 +1,21 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe "Registering 2nd exclusive consumer on queue" do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
c
|
4
|
+
before :all do
|
5
|
+
@connection = Bunny.new(:user => "bunny_gem", :password => "bunny_password", :vhost => "bunny_testbed")
|
6
|
+
@connection.start
|
8
7
|
end
|
9
8
|
|
10
9
|
after :each do
|
11
|
-
connection.close if connection.open?
|
10
|
+
@connection.close if @connection.open?
|
12
11
|
end
|
13
12
|
|
14
13
|
|
15
14
|
it "raises a meaningful exception" do
|
16
15
|
xs = []
|
17
16
|
|
18
|
-
ch1 = connection.create_channel
|
19
|
-
ch2 = connection.create_channel
|
17
|
+
ch1 = @connection.create_channel
|
18
|
+
ch2 = @connection.create_channel
|
20
19
|
q1 = ch1.queue("", :auto_delete => true)
|
21
20
|
q2 = ch2.queue(q1.name, :auto_delete => true, :passive => true)
|
22
21
|
|
@@ -25,19 +24,19 @@ describe "Registering 2nd exclusive consumer on queue" do
|
|
25
24
|
end
|
26
25
|
sleep 0.1
|
27
26
|
|
28
|
-
|
27
|
+
expect do
|
29
28
|
q2.subscribe(:exclusive => true) do |_, _, _|
|
30
29
|
end
|
31
|
-
end.
|
30
|
+
end.to raise_error(Bunny::AccessRefused)
|
32
31
|
|
33
|
-
ch1.
|
34
|
-
ch2.
|
32
|
+
expect(ch1).to be_open
|
33
|
+
expect(ch2).to be_closed
|
35
34
|
|
36
35
|
q1.publish("abc")
|
37
36
|
sleep 0.1
|
38
37
|
|
39
38
|
# verify that the first consumer is fine
|
40
|
-
xs.
|
39
|
+
expect(xs).to eq ["abc"]
|
41
40
|
|
42
41
|
q1.delete
|
43
42
|
end
|
@@ -28,10 +28,10 @@ unless ENV["CI"]
|
|
28
28
|
x.publish(as, :routing_key => q.name, :persistent => true)
|
29
29
|
|
30
30
|
sleep(1)
|
31
|
-
q.message_count.
|
31
|
+
expect(q.message_count).to eq 1
|
32
32
|
|
33
33
|
_, _, payload = q.pop
|
34
|
-
payload.bytesize.
|
34
|
+
expect(payload.bytesize).to eq as.bytesize
|
35
35
|
|
36
36
|
ch.close
|
37
37
|
end
|
data/spec/issues/issue78_spec.rb
CHANGED
@@ -2,20 +2,16 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
unless ENV["CI"]
|
4
4
|
describe Bunny::Queue, "#subscribe" do
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
let(:connection2) do
|
11
|
-
c = Bunny.new(:user => "bunny_gem", :password => "bunny_password", :vhost => "bunny_testbed")
|
12
|
-
c.start
|
13
|
-
c
|
5
|
+
before :all do
|
6
|
+
@connection1 = Bunny.new(:user => "bunny_gem", :password => "bunny_password", :vhost => "bunny_testbed")
|
7
|
+
@connection1.start
|
8
|
+
@connection2 = Bunny.new(:user => "bunny_gem", :password => "bunny_password", :vhost => "bunny_testbed")
|
9
|
+
@connection2.start
|
14
10
|
end
|
15
11
|
|
16
12
|
after :all do
|
17
|
-
connection1.close if connection1.open?
|
18
|
-
connection2.close if connection2.open?
|
13
|
+
@connection1.close if @connection1.open?
|
14
|
+
@connection2.close if @connection2.open?
|
19
15
|
end
|
20
16
|
|
21
17
|
|
@@ -23,8 +19,8 @@ unless ENV["CI"]
|
|
23
19
|
it "consumes messages" do
|
24
20
|
delivered_data = []
|
25
21
|
|
26
|
-
ch1 = connection1.create_channel
|
27
|
-
ch2 = connection1.create_channel
|
22
|
+
ch1 = @connection1.create_channel
|
23
|
+
ch2 = @connection1.create_channel
|
28
24
|
|
29
25
|
q = ch1.queue("", :exclusive => true)
|
30
26
|
q.subscribe(:manual_ack => false, :block => false) do |delivery_info, properties, payload|
|
@@ -36,7 +32,7 @@ unless ENV["CI"]
|
|
36
32
|
x.publish("abc", :routing_key => q.name)
|
37
33
|
sleep 0.7
|
38
34
|
|
39
|
-
delivered_data.
|
35
|
+
expect(delivered_data).to eq ["abc"]
|
40
36
|
|
41
37
|
ch1.close
|
42
38
|
ch2.close
|
@@ -49,8 +45,8 @@ unless ENV["CI"]
|
|
49
45
|
it "consumes messages" do
|
50
46
|
delivered_data = []
|
51
47
|
|
52
|
-
ch1 = connection1.create_channel
|
53
|
-
ch2 = connection1.create_channel
|
48
|
+
ch1 = @connection1.create_channel
|
49
|
+
ch2 = @connection1.create_channel
|
54
50
|
|
55
51
|
q = ch1.queue(queue_name, :exclusive => true)
|
56
52
|
x = ch2.default_exchange
|
@@ -58,14 +54,14 @@ unless ENV["CI"]
|
|
58
54
|
x.publish("data#{i}", :routing_key => queue_name)
|
59
55
|
end
|
60
56
|
sleep 0.7
|
61
|
-
q.message_count.
|
57
|
+
expect(q.message_count).to eq 3
|
62
58
|
|
63
59
|
q.subscribe(:manual_ack => false, :block => false) do |delivery_info, properties, payload|
|
64
60
|
delivered_data << payload
|
65
61
|
end
|
66
62
|
sleep 0.7
|
67
63
|
|
68
|
-
delivered_data.
|
64
|
+
expect(delivered_data).to eq ["data0", "data1", "data2"]
|
69
65
|
|
70
66
|
ch1.close
|
71
67
|
ch2.close
|
data/spec/issues/issue83_spec.rb
CHANGED
@@ -1,19 +1,18 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe Bunny::Channel, "#open" do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
c
|
4
|
+
before :all do
|
5
|
+
@connection = Bunny.new(:user => "bunny_gem", :password => "bunny_password", :vhost => "bunny_testbed")
|
6
|
+
@connection.start
|
8
7
|
end
|
9
8
|
|
10
9
|
after :all do
|
11
|
-
connection.close if connection.open?
|
10
|
+
@connection.close if @connection.open?
|
12
11
|
end
|
13
12
|
|
14
13
|
|
15
14
|
it "properly resets channel exception state" do
|
16
|
-
ch = connection.create_channel
|
15
|
+
ch = @connection.create_channel
|
17
16
|
|
18
17
|
begin
|
19
18
|
ch.queue("bunny.tests.does.not.exist", :passive => true)
|
data/spec/issues/issue97_spec.rb
CHANGED
@@ -1,24 +1,23 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe "Message framing implementation" do
|
4
|
-
|
5
|
-
|
4
|
+
before :all do
|
5
|
+
@connection = Bunny.new(:user => "bunny_gem",
|
6
6
|
:password => "bunny_password",
|
7
7
|
:vhost => "bunny_testbed",
|
8
8
|
:port => ENV.fetch("RABBITMQ_PORT", 5672))
|
9
|
-
|
10
|
-
c
|
9
|
+
@connection.start
|
11
10
|
end
|
12
11
|
|
13
12
|
after :all do
|
14
|
-
connection.close if connection.open?
|
13
|
+
@connection.close if @connection.open?
|
15
14
|
end
|
16
15
|
|
17
16
|
|
18
17
|
unless ENV["CI"]
|
19
18
|
context "with payload ~ 248K in size including non-ASCII characters" do
|
20
19
|
it "successfully frames the message" do
|
21
|
-
ch = connection.create_channel
|
20
|
+
ch = @connection.create_channel
|
22
21
|
|
23
22
|
q = ch.queue("", :exclusive => true)
|
24
23
|
x = ch.default_exchange
|
@@ -27,7 +26,7 @@ describe "Message framing implementation" do
|
|
27
26
|
x.publish(body, :routing_key => q.name, :persistent => true)
|
28
27
|
|
29
28
|
sleep(1)
|
30
|
-
q.message_count.
|
29
|
+
expect(q.message_count).to eq 1
|
31
30
|
|
32
31
|
q.purge
|
33
32
|
ch.close
|
@@ -38,7 +37,7 @@ describe "Message framing implementation" do
|
|
38
37
|
|
39
38
|
context "with payload of several MBs in size" do
|
40
39
|
it "successfully frames the message" do
|
41
|
-
ch = connection.create_channel
|
40
|
+
ch = @connection.create_channel
|
42
41
|
|
43
42
|
q = ch.queue("", :exclusive => true)
|
44
43
|
x = ch.default_exchange
|
@@ -47,10 +46,10 @@ describe "Message framing implementation" do
|
|
47
46
|
x.publish(as, :routing_key => q.name, :persistent => true)
|
48
47
|
|
49
48
|
sleep(1)
|
50
|
-
q.message_count.
|
49
|
+
expect(q.message_count).to eq 1
|
51
50
|
|
52
51
|
_, _, payload = q.pop
|
53
|
-
payload.bytesize.
|
52
|
+
expect(payload.bytesize).to eq as.bytesize
|
54
53
|
|
55
54
|
ch.close
|
56
55
|
end
|
@@ -60,7 +59,7 @@ describe "Message framing implementation" do
|
|
60
59
|
|
61
60
|
context "with empty message body" do
|
62
61
|
it "successfully publishes the message" do
|
63
|
-
ch = connection.create_channel
|
62
|
+
ch = @connection.create_channel
|
64
63
|
|
65
64
|
q = ch.queue("", :exclusive => true)
|
66
65
|
x = ch.default_exchange
|
@@ -68,15 +67,15 @@ describe "Message framing implementation" do
|
|
68
67
|
x.publish("", :routing_key => q.name, :persistent => true)
|
69
68
|
|
70
69
|
sleep(1)
|
71
|
-
q.message_count.
|
70
|
+
expect(q.message_count).to eq 1
|
72
71
|
|
73
72
|
envelope, headers, payload = q.pop
|
74
73
|
|
75
|
-
payload.
|
74
|
+
expect(payload).to eq ""
|
76
75
|
|
77
|
-
headers[:content_type].
|
78
|
-
headers[:delivery_mode].
|
79
|
-
headers[:priority].
|
76
|
+
expect(headers[:content_type]).to eq "application/octet-stream"
|
77
|
+
expect(headers[:delivery_mode]).to eq 2
|
78
|
+
expect(headers[:priority]).to eq 0
|
80
79
|
|
81
80
|
ch.close
|
82
81
|
end
|
@@ -85,7 +84,7 @@ describe "Message framing implementation" do
|
|
85
84
|
|
86
85
|
context "with payload being 2 bytes less than 128K bytes in size" do
|
87
86
|
it "successfully frames the message" do
|
88
|
-
ch = connection.create_channel
|
87
|
+
ch = @connection.create_channel
|
89
88
|
|
90
89
|
q = ch.queue("", :exclusive => true)
|
91
90
|
x = ch.default_exchange
|
@@ -94,7 +93,7 @@ describe "Message framing implementation" do
|
|
94
93
|
x.publish(as, :routing_key => q.name, :persistent => true)
|
95
94
|
|
96
95
|
sleep(1)
|
97
|
-
q.message_count.
|
96
|
+
expect(q.message_count).to eq 1
|
98
97
|
|
99
98
|
q.purge
|
100
99
|
ch.close
|
@@ -103,7 +102,7 @@ describe "Message framing implementation" do
|
|
103
102
|
|
104
103
|
context "with payload being 1 byte less than 128K bytes in size" do
|
105
104
|
it "successfully frames the message" do
|
106
|
-
ch = connection.create_channel
|
105
|
+
ch = @connection.create_channel
|
107
106
|
|
108
107
|
q = ch.queue("", :exclusive => true)
|
109
108
|
x = ch.default_exchange
|
@@ -112,7 +111,7 @@ describe "Message framing implementation" do
|
|
112
111
|
x.publish(as, :routing_key => q.name, :persistent => true)
|
113
112
|
|
114
113
|
sleep(1)
|
115
|
-
q.message_count.
|
114
|
+
expect(q.message_count).to eq 1
|
116
115
|
|
117
116
|
q.purge
|
118
117
|
ch.close
|
@@ -121,7 +120,7 @@ describe "Message framing implementation" do
|
|
121
120
|
|
122
121
|
context "with payload being exactly 128K bytes in size" do
|
123
122
|
it "successfully frames the message" do
|
124
|
-
ch = connection.create_channel
|
123
|
+
ch = @connection.create_channel
|
125
124
|
|
126
125
|
q = ch.queue("", :exclusive => true)
|
127
126
|
x = ch.default_exchange
|
@@ -130,7 +129,7 @@ describe "Message framing implementation" do
|
|
130
129
|
x.publish(as, :routing_key => q.name, :persistent => true)
|
131
130
|
|
132
131
|
sleep(1)
|
133
|
-
q.message_count.
|
132
|
+
expect(q.message_count).to eq 1
|
134
133
|
|
135
134
|
q.purge
|
136
135
|
ch.close
|
@@ -140,7 +139,7 @@ describe "Message framing implementation" do
|
|
140
139
|
|
141
140
|
context "with payload being 1 byte greater than 128K bytes in size" do
|
142
141
|
it "successfully frames the message" do
|
143
|
-
ch = connection.create_channel
|
142
|
+
ch = @connection.create_channel
|
144
143
|
|
145
144
|
q = ch.queue("", :exclusive => true)
|
146
145
|
x = ch.default_exchange
|
@@ -149,7 +148,7 @@ describe "Message framing implementation" do
|
|
149
148
|
x.publish(as, :routing_key => q.name, :persistent => true)
|
150
149
|
|
151
150
|
sleep(1)
|
152
|
-
q.message_count.
|
151
|
+
expect(q.message_count).to eq 1
|
153
152
|
|
154
153
|
q.purge
|
155
154
|
ch.close
|
@@ -158,7 +157,7 @@ describe "Message framing implementation" do
|
|
158
157
|
|
159
158
|
context "with payload being 2 bytes greater than 128K bytes in size" do
|
160
159
|
it "successfully frames the message" do
|
161
|
-
ch = connection.create_channel
|
160
|
+
ch = @connection.create_channel
|
162
161
|
|
163
162
|
q = ch.queue("", :exclusive => true)
|
164
163
|
x = ch.default_exchange
|
@@ -167,7 +166,7 @@ describe "Message framing implementation" do
|
|
167
166
|
x.publish(as, :routing_key => q.name, :persistent => true)
|
168
167
|
|
169
168
|
sleep(1)
|
170
|
-
q.message_count.
|
169
|
+
expect(q.message_count).to eq 1
|
171
170
|
|
172
171
|
q.purge
|
173
172
|
ch.close
|
@@ -1,27 +1,26 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe Bunny::Channel, "#basic_cancel" do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
c
|
4
|
+
before(:all) do
|
5
|
+
@connection = Bunny.new(:user => "bunny_gem", :password => "bunny_password", :vhost => "bunny_testbed")
|
6
|
+
@connection.start
|
8
7
|
end
|
9
8
|
|
10
9
|
after :all do
|
11
|
-
connection.close if connection.open?
|
10
|
+
@connection.close if @connection.open?
|
12
11
|
end
|
13
12
|
|
14
13
|
let(:queue_name) { "bunny.queues.#{rand}" }
|
15
14
|
|
16
15
|
it "returns basic.cancel-ok" do
|
17
|
-
ch = connection.create_channel
|
16
|
+
ch = @connection.create_channel
|
18
17
|
q = ch.queue("", :exclusive => true)
|
19
18
|
|
20
19
|
consume_ok = ch.basic_consume(q, "")
|
21
20
|
cancel_ok = ch.basic_cancel(consume_ok.consumer_tag)
|
22
21
|
|
23
|
-
cancel_ok.
|
24
|
-
cancel_ok.consumer_tag.
|
22
|
+
expect(cancel_ok).to be_instance_of AMQ::Protocol::Basic::CancelOk
|
23
|
+
expect(cancel_ok.consumer_tag).to eq consume_ok.consumer_tag
|
25
24
|
|
26
25
|
ch.close
|
27
26
|
end
|
@@ -33,32 +32,32 @@ describe Bunny::Channel, "#basic_cancel" do
|
|
33
32
|
delivered_data = []
|
34
33
|
|
35
34
|
t = Thread.new do
|
36
|
-
ch = connection.create_channel
|
35
|
+
ch = @connection.create_channel
|
37
36
|
q = ch.queue(queue_name, :auto_delete => true, :durable => false)
|
38
37
|
consume_ok = ch.basic_consume(q, "", true, false) do |_, _, payload|
|
39
38
|
delivered_data << payload
|
40
39
|
end
|
41
40
|
|
42
|
-
consume_ok.consumer_tag.
|
41
|
+
expect(consume_ok.consumer_tag).not_to be_nil
|
43
42
|
cancel_ok = ch.basic_cancel(consume_ok.consumer_tag)
|
44
|
-
cancel_ok.consumer_tag.
|
43
|
+
expect(cancel_ok.consumer_tag).to eq consume_ok.consumer_tag
|
45
44
|
|
46
45
|
ch.close
|
47
46
|
end
|
48
47
|
t.abort_on_exception = true
|
49
48
|
sleep 0.5
|
50
49
|
|
51
|
-
ch = connection.create_channel
|
50
|
+
ch = @connection.create_channel
|
52
51
|
ch.default_exchange.publish("", :routing_key => queue_name)
|
53
52
|
|
54
53
|
sleep 0.7
|
55
|
-
delivered_data.
|
54
|
+
expect(delivered_data).to be_empty
|
56
55
|
end
|
57
56
|
end
|
58
57
|
|
59
58
|
context "when the given consumer tag is invalid (was never registered)" do
|
60
59
|
it "DOES NOT cause a channel error" do
|
61
|
-
ch = connection.create_channel
|
60
|
+
ch = @connection.create_channel
|
62
61
|
|
63
62
|
# RabbitMQ 3.1 does not raise an exception w/ unknown consumer tag. MK.
|
64
63
|
ch.basic_cancel("878798s7df89#{rand}#{Time.now.to_i}")
|
@@ -69,8 +68,8 @@ describe Bunny::Channel, "#basic_cancel" do
|
|
69
68
|
|
70
69
|
context "when the given consumer tag belongs to a different channel" do
|
71
70
|
it "DOES NOT cause a channel error" do
|
72
|
-
ch1 = connection.create_channel
|
73
|
-
ch2 = connection.create_channel
|
71
|
+
ch1 = @connection.create_channel
|
72
|
+
ch2 = @connection.create_channel
|
74
73
|
|
75
74
|
q = ch1.queue("", :exclusive => true)
|
76
75
|
cons = q.subscribe do |_, _, _|
|