beetle 3.5.0 → 3.5.1

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
  SHA256:
3
- metadata.gz: cb4bee36ae48b68aa27483c59aea588aa1a263c7c33858738ce6471246e1bb96
4
- data.tar.gz: 93f380bb4596fcabfc48bec927ba7767b04b826750c307934ed937023c7a8152
3
+ metadata.gz: 2dcaf90eaf1b11b7f6350bb34e17d73591616790ede7b43b6e98cef363dd3770
4
+ data.tar.gz: 55348c9ce61cc2f43869f9c12cd26bbc5dc033b0e0a0506c0a821d6a6e24862c
5
5
  SHA512:
6
- metadata.gz: 34d0e2001a1f93f8b88a86992a77bda65acddc1913c550798144c62fc11b77b7da0dcc0b0c270edd38aa7d27b7ea5f1d0f03fe2a955154db0f91759f5aaa2aee
7
- data.tar.gz: 7ee1364e4fc0e6c6d8cefb1f10c5d4baa0fa6c7a1bd1434a710169538d104b4b83016faa3fb3bb6616bbae1c1db668953f24acd9c342d481b20b6e5d41c967de
6
+ metadata.gz: 6daabfea72ab76b0fa6944d35cee52139678f9a02a272e86a32af6045750496ee81b96ff685eee1bbe9617030b981df3718b7569efabc98df59f894127da29d1
7
+ data.tar.gz: 04d599595b4c39e62a78b496b284a67bed1a545e759d9a094facc757e0334ed16e4bdd7bab4f7bfabb7b6f63da0e590351e86d0da55328ab6db898e9ceaaef7f
data/RELEASE_NOTES.rdoc CHANGED
@@ -1,5 +1,9 @@
1
1
  = Release Notes
2
2
 
3
+ == Version 3.5.1
4
+ * remove blank entries from server list strings
5
+ * make sure not to subscribe to any server twice
6
+
3
7
  == Version 3.5.0
4
8
  * expose publisher method to setup queues/policies ahead of use
5
9
 
data/lib/beetle/client.rb CHANGED
@@ -385,8 +385,12 @@ module Beetle
385
385
  end
386
386
 
387
387
  def load_brokers_from_config
388
- @servers = config.servers.split(/ *, */)
389
- @additional_subscription_servers = config.additional_subscription_servers.split(/ *, */)
388
+ @servers = parse_server_list(config.servers)
389
+ @additional_subscription_servers = parse_server_list(config.additional_subscription_servers) - @servers
390
+ end
391
+
392
+ def parse_server_list(s)
393
+ s.split(/ *, */).uniq.reject(&:blank?)
390
394
  end
391
395
  end
392
396
  end
@@ -1,3 +1,3 @@
1
1
  module Beetle
2
- VERSION = "3.5.0"
2
+ VERSION = "3.5.1"
3
3
  end
@@ -343,17 +343,17 @@ module Beetle
343
343
 
344
344
  test "trying to listen to an unknown queue should raise an exception" do
345
345
  client = Client.new
346
- assert_raises(UnknownQueue) { Client.new.listen_queues([:foobar])}
346
+ assert_raises(UnknownQueue) { client.listen_queues([:foobar])}
347
347
  end
348
348
 
349
349
  test "trying to pause listening on an unknown queue should raise an exception" do
350
350
  client = Client.new
351
- assert_raises(UnknownQueue) { Client.new.pause_listening(:foobar)}
351
+ assert_raises(UnknownQueue) { client.pause_listening(:foobar)}
352
352
  end
353
353
 
354
354
  test "trying to resume listening on an unknown queue should raise an exception" do
355
355
  client = Client.new
356
- assert_raises(UnknownQueue) { Client.new.pause_listening(:foobar)}
356
+ assert_raises(UnknownQueue) { client.pause_listening(:foobar)}
357
357
  end
358
358
 
359
359
  test "should delegate stop_listening to the subscriber instance" do
@@ -457,4 +457,39 @@ module Beetle
457
457
  msg_stub
458
458
  end
459
459
  end
460
+
461
+ class ServerDeduplicationTest < Minitest::Test
462
+ def setup
463
+ @config = Configuration.new
464
+ @config.servers = "localhost:5672,localhost:5672"
465
+ @config.additional_subscription_servers = @config.servers + ",localhost:1234,localhost:1234"
466
+ @client = Client.new(@config)
467
+ end
468
+
469
+ test "duplicates are removed from the server list" do
470
+ assert_equal ["localhost:5672"], @client.servers
471
+ end
472
+
473
+ test "duplicates and servers in the server list are removed from the additional subscription server list" do
474
+ assert_equal ["localhost:1234"], @client.additional_subscription_servers
475
+ end
476
+ end
477
+
478
+ class EmptyServerStringTest < Minitest::Test
479
+ def setup
480
+ @config = Configuration.new
481
+ @config.servers = "localhost:5672,\t,localhost:5672, "
482
+ @config.additional_subscription_servers = @config.servers + ",localhost:1234, , ,,"
483
+ @client = Client.new(@config)
484
+ end
485
+
486
+ test "empty strings are removed from the server list" do
487
+ assert_equal ["localhost:5672"], @client.servers
488
+ end
489
+
490
+ test "empty strings are removed from the additional subscription server list" do
491
+ assert_equal ["localhost:1234"], @client.additional_subscription_servers
492
+ end
493
+ end
494
+
460
495
  end
@@ -127,7 +127,7 @@ module Beetle
127
127
  @sub = @client.send(:subscriber)
128
128
  end
129
129
 
130
- test "subscribers server list should contain addtional subcription hosts" do
130
+ test "subscribers server list should contain additional subcription hosts" do
131
131
  assert_equal ["localhost:5672", "localhost:1234"], @sub.servers
132
132
  end
133
133
  end
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: 3.5.0
4
+ version: 3.5.1
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: 2021-01-22 00:00:00.000000000 Z
15
+ date: 2021-06-01 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: bunny
@@ -378,7 +378,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
378
378
  - !ruby/object:Gem::Version
379
379
  version: 1.3.7
380
380
  requirements: []
381
- rubygems_version: 3.0.8
381
+ rubygems_version: 3.2.16
382
382
  signing_key:
383
383
  specification_version: 3
384
384
  summary: High Availability AMQP Messaging with Redundant Queues