bunny 2.14.4 → 2.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -5
- data/ChangeLog.md +7 -26
- data/Gemfile +2 -2
- data/README.md +2 -2
- data/bunny.gemspec +4 -4
- data/lib/bunny/queue.rb +0 -3
- data/lib/bunny/session.rb +10 -0
- data/lib/bunny/version.rb +1 -1
- data/repl +1 -1
- data/spec/higher_level_api/integration/basic_cancel_spec.rb +4 -4
- data/spec/higher_level_api/integration/basic_consume_spec.rb +3 -3
- data/spec/higher_level_api/integration/tls_connection_spec.rb +201 -189
- data/spec/issues/issue202_spec.rb +1 -1
- data/spec/issues/issue78_spec.rb +2 -2
- data/spec/unit/exchange_recovery_spec.rb +2 -2
- metadata +13 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6abcaa979facd973a801a4433d3a6985e15e89aa84cc0078cc464af3be6c4542
|
4
|
+
data.tar.gz: d8bc430b598d1a267fe075028e9536efeeb008c72d9387daaaa30c79391d54d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 384472c28da9fabdf01a9e1c403c9009bf000cd8a3256cbffab531f7e5582425d15320255a966b89c5075f1fb1bc029deef21e1d5fd776de2d4f9714e8f1553f
|
7
|
+
data.tar.gz: 2ccbfbde0c9f0a2ff0202cb1160d569cbbdc94095e79d021d59a9e7949fd1579189fddcb61849125d4cfefce7ad0a733943f7d3a54097e7fb2ed83117f15ec1f
|
data/.travis.yml
CHANGED
@@ -11,9 +11,10 @@ before_script:
|
|
11
11
|
script: "bundle exec rake integration_without_recovery"
|
12
12
|
rvm:
|
13
13
|
- ruby-head
|
14
|
-
- "2.
|
15
|
-
- "2.
|
16
|
-
- "2.
|
14
|
+
- "2.7.1"
|
15
|
+
- "2.6.6"
|
16
|
+
- "2.5.8"
|
17
|
+
- "2.4.10"
|
17
18
|
- "2.3.8"
|
18
19
|
notifications:
|
19
20
|
email: michael@rabbitmq.com
|
@@ -22,8 +23,8 @@ services:
|
|
22
23
|
branches:
|
23
24
|
only:
|
24
25
|
- master
|
25
|
-
- 2.
|
26
|
-
- 2.
|
26
|
+
- 2.14.x-stable
|
27
|
+
- 2.13.x-stable
|
27
28
|
env:
|
28
29
|
- CI=true
|
29
30
|
matrix:
|
data/ChangeLog.md
CHANGED
@@ -1,9 +1,4 @@
|
|
1
|
-
## Changes between Bunny 2.14.
|
2
|
-
|
3
|
-
No changes.
|
4
|
-
|
5
|
-
|
6
|
-
## Changes between Bunny 2.14.3 and 2.14.4 (Feb 11th, 2020)
|
1
|
+
## Changes between Bunny 2.14.0 and 2.15.0 (Apr 8th, 2020)
|
7
2
|
|
8
3
|
### More Defensive Thread Join Operations
|
9
4
|
|
@@ -21,20 +16,16 @@ GitHub issue: [#589](https://github.com/ruby-amqp/bunny/issues/589)
|
|
21
16
|
|
22
17
|
Contributed by @fuegas.
|
23
18
|
|
19
|
+
### Dependency Updates
|
24
20
|
|
25
|
-
|
26
|
-
|
27
|
-
### OpenSSL Exceptions Trigger Recovery
|
28
|
-
|
29
|
-
OpenSSL exceptions on a fully established connection will now kick off
|
30
|
-
connection recovery.
|
31
|
-
|
32
|
-
GitHub issue: [#583](https://github.com/ruby-amqp/bunny/issues/583)
|
21
|
+
`amq-protocol` dependency has been bumped to `2.3.1` to support `connection.update-secret`
|
22
|
+
protocol extension.
|
33
23
|
|
34
|
-
|
24
|
+
### Gem Installation Fixed on Windows
|
35
25
|
|
26
|
+
`bin/ci`, a directory with symlinks, is no longer included into the gem.
|
36
27
|
|
37
|
-
|
28
|
+
Contributed by Jack Xiaosong Xu.
|
38
29
|
|
39
30
|
### Lazy Peer Certificate Chain Information Logging
|
40
31
|
|
@@ -47,16 +38,6 @@ GitHub issue: [#578](https://github.com/ruby-amqp/bunny/pull/578)
|
|
47
38
|
Contributed by Garrett Thornburg.
|
48
39
|
|
49
40
|
|
50
|
-
## Changes between Bunny 2.14.0 and 2.14.1 (Feb 26th, 2019)
|
51
|
-
|
52
|
-
### Gem Installation Fixed on Windows
|
53
|
-
|
54
|
-
`bin/ci`, a directory with symlinks, is no longer included into the gem.
|
55
|
-
|
56
|
-
Contributed by Jack Xiaosong Xu.
|
57
|
-
|
58
|
-
GitHub issue: [#573](https://github.com/ruby-amqp/bunny/pull/574)
|
59
|
-
|
60
41
|
## Changes between Bunny 2.13.0 and 2.14.0 (Feb 20th, 2019)
|
61
42
|
|
62
43
|
### Improved Peer Verification Failure Logging
|
data/Gemfile
CHANGED
@@ -33,8 +33,8 @@ group :development do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
group :test do
|
36
|
-
gem "rspec", "~> 3.
|
37
|
-
gem "rabbitmq_http_api_client", "~> 1.
|
36
|
+
gem "rspec", "~> 3.9.0"
|
37
|
+
gem "rabbitmq_http_api_client", "~> 1.13.0", require: "rabbitmq/http/client"
|
38
38
|
gem "toxiproxy", "~> 1.0.3"
|
39
39
|
end
|
40
40
|
|
data/README.md
CHANGED
@@ -71,10 +71,10 @@ a stable public API.
|
|
71
71
|
Change logs per release series:
|
72
72
|
|
73
73
|
* [master](https://github.com/ruby-amqp/bunny/blob/master/ChangeLog.md)
|
74
|
+
* [2.14.x](https://github.com/ruby-amqp/bunny/blob/2.13.x-stable/ChangeLog.md)
|
74
75
|
* [2.13.x](https://github.com/ruby-amqp/bunny/blob/2.13.x-stable/ChangeLog.md)
|
75
76
|
* [2.12.x](https://github.com/ruby-amqp/bunny/blob/2.12.x-stable/ChangeLog.md)
|
76
77
|
* [2.11.x](https://github.com/ruby-amqp/bunny/blob/2.11.x-stable/ChangeLog.md)
|
77
|
-
* [2.10.x](https://github.com/ruby-amqp/bunny/blob/2.10.x-stable/ChangeLog.md)
|
78
78
|
|
79
79
|
|
80
80
|
|
@@ -97,7 +97,7 @@ gem install bunny
|
|
97
97
|
To use Bunny in a project managed with Bundler:
|
98
98
|
|
99
99
|
``` ruby
|
100
|
-
gem "bunny", ">= 2.
|
100
|
+
gem "bunny", ">= 2.14.1"
|
101
101
|
```
|
102
102
|
|
103
103
|
|
data/bunny.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.name = "bunny"
|
9
9
|
s.version = Bunny::VERSION.dup
|
10
10
|
s.homepage = "http://rubybunny.info"
|
11
|
-
s.summary = "
|
12
|
-
s.description = "Easy to use, feature complete Ruby client for RabbitMQ"
|
11
|
+
s.summary = "Popular easy to use Ruby client for RabbitMQ"
|
12
|
+
s.description = "Easy to use, feature complete Ruby client for RabbitMQ 3.3 and later versions."
|
13
13
|
s.license = "MIT"
|
14
14
|
s.required_ruby_version = Gem::Requirement.new(">= 2.2")
|
15
15
|
|
@@ -21,10 +21,10 @@ Gem::Specification.new do |s|
|
|
21
21
|
"Michael S. Klishin",
|
22
22
|
"Stefan Kaes"]
|
23
23
|
|
24
|
-
s.email = ["
|
24
|
+
s.email = ["michael.s.klishin@gmail.com"]
|
25
25
|
|
26
26
|
# Dependencies
|
27
|
-
s.add_runtime_dependency 'amq-protocol', '~> 2.3', '>= 2.3.
|
27
|
+
s.add_runtime_dependency 'amq-protocol', '~> 2.3', '>= 2.3.1'
|
28
28
|
|
29
29
|
# Files.
|
30
30
|
s.extra_rdoc_files = ["README.md"]
|
data/lib/bunny/queue.rb
CHANGED
@@ -158,9 +158,6 @@ module Bunny
|
|
158
158
|
# @option opts [Boolean] :ack (false) [DEPRECATED] Use :manual_ack instead
|
159
159
|
# @option opts [Boolean] :manual_ack (false) Will this consumer use manual acknowledgements?
|
160
160
|
# @option opts [Boolean] :exclusive (false) Should this consumer be exclusive for this queue?
|
161
|
-
# @option opts [Boolean] :block (false) Should the call block the calling thread? This option can be useful for keeping the main thread of
|
162
|
-
# a script alive. It is incompatible with automatic connection recovery
|
163
|
-
# and is not generally recommended.
|
164
161
|
# @option opts [#call] :on_cancellation Block to execute when this consumer is cancelled remotely (e.g. via the RabbitMQ Management plugin)
|
165
162
|
# @option opts [String] :consumer_tag Unique consumer identifier. It is usually recommended to let Bunny generate it for you.
|
166
163
|
# @option opts [Hash] :arguments ({}) Additional (optional) arguments, typically used by RabbitMQ extensions
|
data/lib/bunny/session.rb
CHANGED
@@ -342,6 +342,14 @@ module Bunny
|
|
342
342
|
self
|
343
343
|
end
|
344
344
|
|
345
|
+
def update_secret(value, reason)
|
346
|
+
@transport.send_frame(AMQ::Protocol::Connection::UpdateSecret.encode(value, reason))
|
347
|
+
@last_update_secret_ok = wait_on_continuations
|
348
|
+
raise_if_continuation_resulted_in_a_connection_error!
|
349
|
+
|
350
|
+
@last_update_secret_ok
|
351
|
+
end
|
352
|
+
|
345
353
|
# Socket operation write timeout used by this connection
|
346
354
|
# @return [Integer]
|
347
355
|
# @private
|
@@ -632,6 +640,8 @@ module Bunny
|
|
632
640
|
when AMQ::Protocol::Connection::Unblocked then
|
633
641
|
@blocked = false
|
634
642
|
@unblock_callback.call(method) if @unblock_callback
|
643
|
+
when AMQ::Protocol::Connection::UpdateSecretOk then
|
644
|
+
@continuations.push(method)
|
635
645
|
when AMQ::Protocol::Channel::Close then
|
636
646
|
begin
|
637
647
|
ch = synchronised_find_channel(ch_number)
|
data/lib/bunny/version.rb
CHANGED
data/repl
CHANGED
@@ -20,7 +20,7 @@ describe Bunny::Consumer, "#cancel" do
|
|
20
20
|
t = Thread.new do
|
21
21
|
ch = connection.create_channel
|
22
22
|
q = ch.queue(queue_name, auto_delete: true, durable: false)
|
23
|
-
consumer = q.subscribe
|
23
|
+
consumer = q.subscribe do |_, _, payload|
|
24
24
|
delivered_data << payload
|
25
25
|
end
|
26
26
|
|
@@ -58,7 +58,7 @@ describe Bunny::Consumer, "#cancel" do
|
|
58
58
|
delivered_data << payload
|
59
59
|
end
|
60
60
|
|
61
|
-
q.subscribe_with(consumer
|
61
|
+
q.subscribe_with(consumer)
|
62
62
|
end
|
63
63
|
t.abort_on_exception = true
|
64
64
|
sleep 1.0
|
@@ -91,7 +91,7 @@ describe Bunny::Consumer, "#cancel" do
|
|
91
91
|
delivered_data << payload
|
92
92
|
end
|
93
93
|
|
94
|
-
q.subscribe_with(consumer
|
94
|
+
q.subscribe_with(consumer)
|
95
95
|
end
|
96
96
|
t.abort_on_exception = true
|
97
97
|
sleep 1.0
|
@@ -122,7 +122,7 @@ describe Bunny::Consumer, "#cancel" do
|
|
122
122
|
delivered_data << payload
|
123
123
|
end
|
124
124
|
|
125
|
-
q.subscribe_with(consumer
|
125
|
+
q.subscribe_with(consumer)
|
126
126
|
end
|
127
127
|
t.abort_on_exception = true
|
128
128
|
sleep 1.0
|
@@ -189,17 +189,17 @@ describe Bunny::Queue, "#subscribe" do
|
|
189
189
|
ch = connection.create_channel
|
190
190
|
q = ch.queue(queue_name)
|
191
191
|
|
192
|
-
c1 = q.subscribe(exclusive: false, manual_ack: false
|
192
|
+
c1 = q.subscribe(exclusive: false, manual_ack: false) do |delivery_info, properties, payload|
|
193
193
|
end
|
194
194
|
c1.cancel
|
195
195
|
|
196
|
-
c2 = q.subscribe(exclusive: false, manual_ack: false
|
196
|
+
c2 = q.subscribe(exclusive: false, manual_ack: false) do |delivery_info, properties, payload|
|
197
197
|
delivered_keys << delivery_info.routing_key
|
198
198
|
delivered_data << payload
|
199
199
|
end
|
200
200
|
c2.cancel
|
201
201
|
|
202
|
-
q.subscribe(exclusive: false, manual_ack: false
|
202
|
+
q.subscribe(exclusive: false, manual_ack: false) do |delivery_info, properties, payload|
|
203
203
|
delivered_keys << delivery_info.routing_key
|
204
204
|
delivered_data << payload
|
205
205
|
end
|
@@ -3,248 +3,260 @@ require "spec_helper"
|
|
3
3
|
|
4
4
|
require "socket"
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
puts "Will use certificates from #{CERTIFICATE_DIR}"
|
9
|
-
|
10
|
-
shared_examples_for "successful TLS connection" do
|
11
|
-
it "succeeds" do
|
12
|
-
expect(subject).to be_tls
|
13
|
-
ch = subject.create_channel
|
14
|
-
ch.confirm_select
|
15
|
-
|
16
|
-
q = ch.queue("", exclusive: true)
|
17
|
-
x = ch.default_exchange
|
18
|
-
|
19
|
-
x.publish("xyzzy", routing_key: q.name).
|
20
|
-
publish("xyzzy", routing_key: q.name).
|
21
|
-
publish("xyzzy", routing_key: q.name).
|
22
|
-
publish("xyzzy", routing_key: q.name)
|
23
|
-
|
24
|
-
x.wait_for_confirms
|
25
|
-
expect(q.message_count).to eq 4
|
26
|
-
|
27
|
-
i = 0
|
28
|
-
q.subscribe do |delivery_info, _, payload|
|
29
|
-
i += 1
|
30
|
-
end
|
31
|
-
sleep 1.0
|
32
|
-
expect(i).to eq 4
|
33
|
-
expect(q.message_count).to eq 0
|
34
|
-
|
35
|
-
ch.close
|
36
|
-
end
|
37
|
-
end
|
6
|
+
CERTIFICATE_DIR = ENV.fetch("BUNNY_CERTIFICATE_DIR", "./spec/tls")
|
7
|
+
puts "Will use certificates from #{CERTIFICATE_DIR}"
|
38
8
|
|
39
|
-
|
40
|
-
|
41
|
-
|
9
|
+
shared_examples_for "successful TLS connection" do
|
10
|
+
it "succeeds", skip: ENV["CI"] do
|
11
|
+
expect(subject).to be_tls
|
12
|
+
ch = subject.create_channel
|
13
|
+
ch.confirm_select
|
14
|
+
|
15
|
+
q = ch.queue("", exclusive: true)
|
16
|
+
x = ch.default_exchange
|
17
|
+
|
18
|
+
x.publish("xyzzy", routing_key: q.name).
|
19
|
+
publish("xyzzy", routing_key: q.name).
|
20
|
+
publish("xyzzy", routing_key: q.name).
|
21
|
+
publish("xyzzy", routing_key: q.name)
|
42
22
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
vhost: "bunny_testbed",
|
50
|
-
tls: true,
|
51
|
-
verify_peer: verify_peer,
|
52
|
-
tls_cert: "#{CERTIFICATE_DIR}/client_certificate.pem",
|
53
|
-
tls_key: "#{CERTIFICATE_DIR}/client_key.pem",
|
54
|
-
tls_ca_certificates: ["#{CERTIFICATE_DIR}/ca_certificate.pem"])
|
23
|
+
x.wait_for_confirms
|
24
|
+
expect(q.message_count).to eq 4
|
25
|
+
|
26
|
+
i = 0
|
27
|
+
q.subscribe do |delivery_info, _, payload|
|
28
|
+
i += 1
|
55
29
|
end
|
30
|
+
sleep 1.0
|
31
|
+
expect(i).to eq 4
|
32
|
+
expect(q.message_count).to eq 0
|
56
33
|
|
57
|
-
|
58
|
-
|
34
|
+
ch.close
|
35
|
+
end
|
36
|
+
end
|
59
37
|
|
60
|
-
|
61
|
-
|
62
|
-
|
38
|
+
def local_hostname
|
39
|
+
ENV.fetch("BUNNY_RABBITMQ_HOSTNAME", "localhost")
|
40
|
+
end
|
63
41
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
expect(subject.transport.socket.hostname).to_not be_empty
|
68
|
-
end
|
42
|
+
def no_tls12_supported?
|
43
|
+
not tls12_supported?
|
44
|
+
end
|
69
45
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
46
|
+
def tls12_supported?
|
47
|
+
begin
|
48
|
+
ctx = OpenSSL::SSL::SSLContext.new
|
49
|
+
ctx.min_version = ctx.max_version = OpenSSL::SSL::TLS1_2_VERSION
|
50
|
+
true
|
51
|
+
rescue
|
52
|
+
false
|
53
|
+
end
|
54
|
+
end
|
74
55
|
|
75
|
-
|
76
|
-
|
56
|
+
context "initialized with tls: true", skip: ENV["CI"] do
|
57
|
+
let(:subject) do
|
58
|
+
Bunny.new(
|
59
|
+
hostname: local_hostname(),
|
60
|
+
user: "bunny_gem",
|
61
|
+
password: "bunny_password",
|
62
|
+
vhost: "bunny_testbed",
|
63
|
+
tls: true,
|
64
|
+
verify_peer: verify_peer,
|
65
|
+
tls_cert: "#{CERTIFICATE_DIR}/client_certificate.pem",
|
66
|
+
tls_key: "#{CERTIFICATE_DIR}/client_key.pem",
|
67
|
+
tls_ca_certificates: ["#{CERTIFICATE_DIR}/ca_certificate.pem"])
|
68
|
+
end
|
69
|
+
|
70
|
+
context "peer verification is off" do
|
71
|
+
let(:verify_peer) { false }
|
77
72
|
|
78
|
-
|
79
|
-
|
80
|
-
end
|
73
|
+
it "uses TLS port" do
|
74
|
+
expect(subject.port).to eq AMQ::Protocol::TLS_PORT
|
81
75
|
end
|
82
|
-
end
|
83
76
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
username: "bunny_gem",
|
89
|
-
password: "bunny_password",
|
90
|
-
vhost: "bunny_testbed",
|
91
|
-
tls: true,
|
92
|
-
tls_cert: "#{CERTIFICATE_DIR}/client_certificate.pem",
|
93
|
-
tls_key: "#{CERTIFICATE_DIR}/client_key.pem",
|
94
|
-
tls_ca_certificates: ["#{CERTIFICATE_DIR}/ca_certificate.pem"],
|
95
|
-
verify_peer: false)
|
96
|
-
c.start
|
97
|
-
c
|
77
|
+
it "sends the SNI details" do
|
78
|
+
# https://github.com/ruby-amqp/bunny/issues/440
|
79
|
+
subject.start
|
80
|
+
expect(subject.transport.socket.hostname).to_not be_empty
|
98
81
|
end
|
99
82
|
|
100
83
|
after :each do
|
101
84
|
subject.close
|
102
85
|
end
|
103
|
-
|
104
|
-
include_examples "successful TLS connection"
|
105
86
|
end
|
106
87
|
|
88
|
+
context "peer verification is on" do
|
89
|
+
let(:verify_peer) { true }
|
107
90
|
|
108
|
-
|
109
|
-
|
110
|
-
c = Bunny.new(
|
111
|
-
hostname: local_hostname(),
|
112
|
-
username: "bunny_gem",
|
113
|
-
password: "bunny_password",
|
114
|
-
vhost: "bunny_testbed",
|
115
|
-
tls: true,
|
116
|
-
tls_ca_certificates: ["#{CERTIFICATE_DIR}/ca_certificate.pem"],
|
117
|
-
verify_peer: false)
|
118
|
-
c.start
|
119
|
-
c
|
91
|
+
it "uses TLS port" do
|
92
|
+
expect(subject.port).to eq AMQ::Protocol::TLS_PORT
|
120
93
|
end
|
94
|
+
end
|
95
|
+
end
|
121
96
|
|
122
|
-
|
123
|
-
|
124
|
-
|
97
|
+
describe "TLS connection to RabbitMQ with client certificates", skip: ENV["CI"] do
|
98
|
+
let(:subject) do
|
99
|
+
c = Bunny.new(
|
100
|
+
hostname: local_hostname(),
|
101
|
+
username: "bunny_gem",
|
102
|
+
password: "bunny_password",
|
103
|
+
vhost: "bunny_testbed",
|
104
|
+
tls: true,
|
105
|
+
tls_cert: "#{CERTIFICATE_DIR}/client_certificate.pem",
|
106
|
+
tls_key: "#{CERTIFICATE_DIR}/client_key.pem",
|
107
|
+
tls_ca_certificates: ["#{CERTIFICATE_DIR}/ca_certificate.pem"],
|
108
|
+
verify_peer: false)
|
109
|
+
c.start
|
110
|
+
c
|
111
|
+
end
|
125
112
|
|
126
|
-
|
113
|
+
after :each do
|
114
|
+
subject.close
|
127
115
|
end
|
128
116
|
|
117
|
+
include_examples "successful TLS connection"
|
118
|
+
end
|
129
119
|
|
130
|
-
describe "TLS connection to RabbitMQ with a connection string" do
|
131
|
-
let(:subject) do
|
132
|
-
c = Bunny.new("amqps://bunny_gem:bunny_password@#{local_hostname()}/bunny_testbed",
|
133
|
-
tls_cert: "#{CERTIFICATE_DIR}/client_certificate.pem",
|
134
|
-
tls_key: "#{CERTIFICATE_DIR}/client_key.pem",
|
135
|
-
tls_ca_certificates: ["#{CERTIFICATE_DIR}/ca_certificate.pem"],
|
136
|
-
verify_peer: false)
|
137
|
-
c.start
|
138
|
-
c
|
139
|
-
end
|
140
120
|
|
141
|
-
|
142
|
-
|
143
|
-
|
121
|
+
describe "TLS connection to RabbitMQ without client certificates", skip: ENV["CI"] do
|
122
|
+
let(:subject) do
|
123
|
+
c = Bunny.new(
|
124
|
+
hostname: local_hostname(),
|
125
|
+
username: "bunny_gem",
|
126
|
+
password: "bunny_password",
|
127
|
+
vhost: "bunny_testbed",
|
128
|
+
tls: true,
|
129
|
+
tls_ca_certificates: ["#{CERTIFICATE_DIR}/ca_certificate.pem"],
|
130
|
+
verify_peer: false)
|
131
|
+
c.start
|
132
|
+
c
|
133
|
+
end
|
144
134
|
|
145
|
-
|
135
|
+
after :each do
|
136
|
+
subject.close
|
137
|
+
end
|
146
138
|
|
147
|
-
|
148
|
-
|
149
|
-
Bunny.new("amqps://bunny_gem:bunny_password@#{local_hostname()}/bunny_testbed?heartbeat=10&connection_timeout=100&channel_max=1000&verify=false&cacertfile=#{CERTIFICATE_DIR}/ca_certificate.pem&certfile=#{CERTIFICATE_DIR}/client_certificate.pem&keyfile=#{CERTIFICATE_DIR}/client_key.pem")
|
150
|
-
end
|
139
|
+
include_examples "successful TLS connection"
|
140
|
+
end
|
151
141
|
|
152
|
-
it "parses extra connection parameters" do
|
153
|
-
session.start
|
154
142
|
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
143
|
+
describe "TLS connection to RabbitMQ with a connection string", skip: ENV["CI"] do
|
144
|
+
let(:subject) do
|
145
|
+
c = Bunny.new("amqps://bunny_gem:bunny_password@#{local_hostname()}/bunny_testbed",
|
146
|
+
tls_cert: "#{CERTIFICATE_DIR}/client_certificate.pem",
|
147
|
+
tls_key: "#{CERTIFICATE_DIR}/client_key.pem",
|
148
|
+
tls_ca_certificates: ["#{CERTIFICATE_DIR}/ca_certificate.pem"],
|
149
|
+
verify_peer: false)
|
150
|
+
c.start
|
151
|
+
c
|
162
152
|
end
|
163
153
|
|
154
|
+
after :each do
|
155
|
+
subject.close
|
156
|
+
end
|
164
157
|
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
c.start
|
171
|
-
c
|
158
|
+
include_examples "successful TLS connection"
|
159
|
+
|
160
|
+
context "when URI contains query parameters" do
|
161
|
+
subject(:session) do
|
162
|
+
Bunny.new("amqps://bunny_gem:bunny_password@#{local_hostname()}/bunny_testbed?heartbeat=10&connection_timeout=100&channel_max=1000&verify=false&cacertfile=#{CERTIFICATE_DIR}/ca_certificate.pem&certfile=#{CERTIFICATE_DIR}/client_certificate.pem&keyfile=#{CERTIFICATE_DIR}/client_key.pem")
|
172
163
|
end
|
173
164
|
|
174
|
-
|
175
|
-
|
165
|
+
it "parses extra connection parameters" do
|
166
|
+
session.start
|
167
|
+
|
168
|
+
expect(session.uses_tls?).to eq(true)
|
169
|
+
expect(session.transport.verify_peer).to eq(false)
|
170
|
+
expect(session.transport.tls_ca_certificates).to eq(["#{CERTIFICATE_DIR}/ca_certificate.pem"])
|
171
|
+
expect(session.transport.tls_certificate_path).to eq("#{CERTIFICATE_DIR}/client_certificate.pem")
|
172
|
+
expect(session.transport.tls_key_path).to eq("#{CERTIFICATE_DIR}/client_key.pem")
|
176
173
|
end
|
174
|
+
end
|
175
|
+
end
|
177
176
|
|
178
|
-
context "peer verification is off" do
|
179
|
-
let(:verify_peer) { false }
|
180
177
|
|
181
|
-
|
178
|
+
describe "TLS connection to RabbitMQ with a connection string and w/o client certificate and key", skip: ENV["CI"] do
|
179
|
+
let(:subject) do
|
180
|
+
c = Bunny.new("amqps://bunny_gem:bunny_password@#{local_hostname()}/bunny_testbed",
|
181
|
+
tls_ca_certificates: ["#{CERTIFICATE_DIR}/ca_certificate.pem"],
|
182
|
+
verify_peer: verify_peer)
|
183
|
+
c.start
|
184
|
+
c
|
185
|
+
end
|
182
186
|
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
end
|
187
|
-
end
|
187
|
+
after :each do
|
188
|
+
subject.close
|
189
|
+
end
|
188
190
|
|
189
|
-
|
190
|
-
|
191
|
+
context "peer verification is off" do
|
192
|
+
let(:verify_peer) { false }
|
191
193
|
|
192
|
-
|
194
|
+
include_examples "successful TLS connection"
|
193
195
|
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
end
|
196
|
+
it "sends the SNI details" do
|
197
|
+
# https://github.com/ruby-amqp/bunny/issues/440
|
198
|
+
expect(subject.transport.socket.hostname).to_not be_empty
|
198
199
|
end
|
199
200
|
end
|
200
201
|
|
202
|
+
context "peer verification is on" do
|
203
|
+
let(:verify_peer) { true }
|
201
204
|
|
202
|
-
|
203
|
-
let(:subject) do
|
204
|
-
c = Bunny.new(
|
205
|
-
hostname: local_hostname(),
|
206
|
-
username: "bunny_gem",
|
207
|
-
password: "bunny_password",
|
208
|
-
vhost: "bunny_testbed",
|
209
|
-
tls: true,
|
210
|
-
tls_cert: File.read("#{CERTIFICATE_DIR}/client_certificate.pem"),
|
211
|
-
tls_key: File.read("#{CERTIFICATE_DIR}/client_key.pem"),
|
212
|
-
tls_ca_certificates: ["#{CERTIFICATE_DIR}/ca_certificate.pem"],
|
213
|
-
verify_peer: false)
|
214
|
-
c.start
|
215
|
-
c
|
216
|
-
end
|
205
|
+
include_examples "successful TLS connection"
|
217
206
|
|
218
|
-
|
219
|
-
|
207
|
+
it "sends the SNI details" do
|
208
|
+
# https://github.com/ruby-amqp/bunny/issues/440
|
209
|
+
expect(subject.transport.socket.hostname).to_not be_empty
|
220
210
|
end
|
211
|
+
end
|
212
|
+
end
|
221
213
|
|
222
|
-
|
214
|
+
|
215
|
+
describe "TLS connection to RabbitMQ with client certificates provided inline", skip: ENV["CI"] do
|
216
|
+
let(:subject) do
|
217
|
+
c = Bunny.new(
|
218
|
+
hostname: local_hostname(),
|
219
|
+
username: "bunny_gem",
|
220
|
+
password: "bunny_password",
|
221
|
+
vhost: "bunny_testbed",
|
222
|
+
tls: true,
|
223
|
+
tls_cert: File.read("#{CERTIFICATE_DIR}/client_certificate.pem"),
|
224
|
+
tls_key: File.read("#{CERTIFICATE_DIR}/client_key.pem"),
|
225
|
+
tls_ca_certificates: ["#{CERTIFICATE_DIR}/ca_certificate.pem"],
|
226
|
+
verify_peer: false)
|
227
|
+
c.start
|
228
|
+
c
|
223
229
|
end
|
224
230
|
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
hostname: local_hostname(),
|
229
|
-
username: "bunny_gem",
|
230
|
-
password: "bunny_password",
|
231
|
-
vhost: "bunny_testbed",
|
232
|
-
tls: true,
|
233
|
-
tls_protocol: :TLSv1_1,
|
234
|
-
tls_ca_certificates: ["#{CERTIFICATE_DIR}/ca_certificate.pem"],
|
235
|
-
verify_peer: false)
|
236
|
-
c.start
|
237
|
-
c
|
238
|
-
end
|
231
|
+
after :each do
|
232
|
+
subject.close
|
233
|
+
end
|
239
234
|
|
240
|
-
|
241
|
-
|
242
|
-
end
|
235
|
+
include_examples "successful TLS connection"
|
236
|
+
end
|
243
237
|
|
244
|
-
|
238
|
+
describe "TLS connection to RabbitMQ with tls_version TLSv1.2 specified", skip: ENV["CI"] do
|
239
|
+
let(:subject) do
|
240
|
+
c = Bunny.new(
|
241
|
+
hostname: local_hostname(),
|
242
|
+
username: "bunny_gem",
|
243
|
+
password: "bunny_password",
|
244
|
+
vhost: "bunny_testbed",
|
245
|
+
tls: true,
|
246
|
+
tls_protocol: :TLSv1_2,
|
247
|
+
tls_ca_certificates: ["#{CERTIFICATE_DIR}/ca_certificate.pem"],
|
248
|
+
verify_peer: false)
|
249
|
+
c.start
|
250
|
+
c
|
251
|
+
end
|
245
252
|
|
246
|
-
|
247
|
-
|
248
|
-
|
253
|
+
after :each do
|
254
|
+
subject.close
|
255
|
+
end
|
256
|
+
|
257
|
+
include_examples "successful TLS connection"
|
258
|
+
|
259
|
+
it "connects using TLSv1.2", skip: no_tls12_supported? do
|
260
|
+
expect(subject.transport.socket.ssl_version).to eq "TLSv1.2"
|
249
261
|
end
|
250
262
|
end
|
@@ -4,7 +4,7 @@ describe Bunny::Session do
|
|
4
4
|
context "with unreachable host" do
|
5
5
|
it "raises Bunny::TCPConnectionFailed" do
|
6
6
|
begin
|
7
|
-
conn = Bunny.new(:hostname => "
|
7
|
+
conn = Bunny.new(:hostname => "127.0.0.254", :port => 1433)
|
8
8
|
conn.start
|
9
9
|
|
10
10
|
fail "expected 192.192.192.192 to be unreachable"
|
data/spec/issues/issue78_spec.rb
CHANGED
@@ -24,7 +24,7 @@ unless ENV["CI"]
|
|
24
24
|
ch2 = @connection1.create_channel
|
25
25
|
|
26
26
|
q = ch1.queue("", exclusive: true)
|
27
|
-
q.subscribe(manual_ack: false
|
27
|
+
q.subscribe(manual_ack: false) do |delivery_info, properties, payload|
|
28
28
|
delivered_data << payload
|
29
29
|
end
|
30
30
|
sleep 0.5
|
@@ -57,7 +57,7 @@ unless ENV["CI"]
|
|
57
57
|
sleep 0.7
|
58
58
|
expect(q.message_count).to eq 3
|
59
59
|
|
60
|
-
q.subscribe(manual_ack: false
|
60
|
+
q.subscribe(manual_ack: false) do |delivery_info, properties, payload|
|
61
61
|
delivered_data << payload
|
62
62
|
end
|
63
63
|
sleep 0.7
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bunny
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Duncan
|
@@ -12,31 +12,32 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2020-
|
15
|
+
date: 2020-04-08 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: amq-protocol
|
19
19
|
requirement: !ruby/object:Gem::Requirement
|
20
20
|
requirements:
|
21
|
-
- - ">="
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 2.3.0
|
24
21
|
- - "~>"
|
25
22
|
- !ruby/object:Gem::Version
|
26
23
|
version: '2.3'
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.3.1
|
27
27
|
type: :runtime
|
28
28
|
prerelease: false
|
29
29
|
version_requirements: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 2.3.0
|
34
31
|
- - "~>"
|
35
32
|
- !ruby/object:Gem::Version
|
36
33
|
version: '2.3'
|
37
|
-
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 2.3.1
|
37
|
+
description: Easy to use, feature complete Ruby client for RabbitMQ 3.3 and later
|
38
|
+
versions.
|
38
39
|
email:
|
39
|
-
-
|
40
|
+
- michael.s.klishin@gmail.com
|
40
41
|
executables: []
|
41
42
|
extensions: []
|
42
43
|
extra_rdoc_files:
|
@@ -240,10 +241,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
240
241
|
- !ruby/object:Gem::Version
|
241
242
|
version: '0'
|
242
243
|
requirements: []
|
243
|
-
rubygems_version: 3.
|
244
|
+
rubygems_version: 3.1.2
|
244
245
|
signing_key:
|
245
246
|
specification_version: 4
|
246
|
-
summary:
|
247
|
+
summary: Popular easy to use Ruby client for RabbitMQ
|
247
248
|
test_files:
|
248
249
|
- spec/config/enabled_plugins
|
249
250
|
- spec/config/rabbitmq.conf
|