beetle 0.4.11 → 0.4.12

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 209c24bac488aa32e51ae851fdc3503a037da362
4
- data.tar.gz: 8dd86747e863f217d944add81678ac913a47fa93
3
+ metadata.gz: a50fa533c34e2207f31db5221a603d77c44d9c15
4
+ data.tar.gz: aee7aaaa983332ad75b6ff4f685c946a65943157
5
5
  SHA512:
6
- metadata.gz: baaf7cdca65197eaa33329120b8ccf8ddea1f38987d066336dc2e535b3620b64d8b606dbcfdc0c15edae5593bbdb445550f07fa3433c37a0b7b7f4258189c001
7
- data.tar.gz: bec95f2f81b9760e00130b3796e2c6569a9f997408e1249b27ddda650151cc85bf6e1a4bd95c87a4eda0ce2fa14cf4100be564e8a9973cdf90aadbce1f89100e
6
+ metadata.gz: af16207ccd97dc0318e915a7efeff737af67b5a39a868a8f33dd1a1a2038f84f79f36ef6aba1c18a4c75badd9851e787a0b5c766f9f0a86d98f770dd184bb7b6
7
+ data.tar.gz: 326faf02f95fe79bdbbb0e264326f05ca1620717b9297814d7626d951bf36c9326655afb161f47344f112302653e321d28266f0729c29345fd1ecc60f7de92d6
data/RELEASE_NOTES.rdoc CHANGED
@@ -1,5 +1,10 @@
1
1
  = Release Notes
2
2
 
3
+ == Version 0.4.12
4
+
5
+ * Don't log warnings when publishing redundantly and only
6
+ one server is has been configured
7
+
3
8
  == Version 0.4.11
4
9
 
5
10
  * Automatically close open publisher sockets at program exit
@@ -2,6 +2,8 @@ module Beetle
2
2
  # Provides the publishing logic implementation.
3
3
  class Publisher < Base
4
4
 
5
+ attr_reader :dead_servers
6
+
5
7
  def initialize(client, options = {}) #:nodoc:
6
8
  super
7
9
  @exchanges_with_bound_queues = {}
@@ -63,7 +65,7 @@ module Beetle
63
65
 
64
66
  def publish_with_redundancy(exchange_name, message_name, data, opts) #:nodoc:
65
67
  if @servers.size < 2
66
- logger.warn "Beetle: at least two active servers are required for redundant publishing"
68
+ logger.warn "Beetle: at least two active servers are required for redundant publishing" if @dead_servers.size > 0
67
69
  return publish_with_failover(exchange_name, message_name, data, opts)
68
70
  end
69
71
  published = []
@@ -1,3 +1,3 @@
1
1
  module Beetle
2
- VERSION = "0.4.11"
2
+ VERSION = "0.4.12"
3
3
  end
@@ -170,6 +170,37 @@ module Beetle
170
170
  assert_equal 2, @pub.publish_with_redundancy("mama-exchange", "mama", @data, @opts)
171
171
  end
172
172
 
173
+ test "redundant publishing should log a warning if only one server is active" do
174
+ @pub.servers = %w(server1 server2)
175
+ @pub.server = "server1"
176
+ @pub.send :mark_server_dead
177
+
178
+ redundant = sequence("redundant")
179
+ e = mock("exchange")
180
+
181
+ @pub.logger.expects(:warn).with("Beetle: at least two active servers are required for redundant publishing")
182
+
183
+ @pub.expects(:exchange).returns(e).in_sequence(redundant)
184
+ e.expects(:publish).in_sequence(redundant)
185
+
186
+ assert_equal 1, @pub.publish_with_redundancy("mama-exchange", "mama", @data, @opts)
187
+ end
188
+
189
+ test "redundant publishing should not log a warning if only one server exists" do
190
+ @pub.servers = %w(server1)
191
+ @pub.server = "server1"
192
+
193
+ redundant = sequence("redundant")
194
+ e = mock("exchange")
195
+
196
+ @pub.logger.expects(:warn).with("Beetle: at least two active servers are required for redundant publishing").never
197
+
198
+ @pub.expects(:exchange).returns(e).in_sequence(redundant)
199
+ e.expects(:publish).in_sequence(redundant)
200
+
201
+ assert_equal 1, @pub.publish_with_redundancy("mama-exchange", "mama", @data, @opts)
202
+ end
203
+
173
204
  test "publishing should use the message ttl passed in the options hash to encode the message body" do
174
205
  opts = {:ttl => 1.day}
175
206
  Message.expects(:publishing_options).with(:ttl => 1.day).returns({})
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beetle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.11
4
+ version: 0.4.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Kaes
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2016-08-17 00:00:00.000000000 Z
15
+ date: 2016-08-22 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: uuid4r
@@ -248,7 +248,7 @@ files:
248
248
  - lib/beetle/subscriber.rb
249
249
  - lib/beetle/version.rb
250
250
  - script/console
251
- - script/docker-run-beetle-tests
251
+ - script/docker-run-beetle-tests-
252
252
  - script/start_rabbit
253
253
  - test/beetle/amqp_gem_behavior_test.rb
254
254
  - test/beetle/base_test.rb