beetle 3.5.3 → 3.5.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bce54bf1dc2290bb4c1598f6210b1c292d09691e91df2f67e913747535c90f2d
4
- data.tar.gz: e6f510fb5b78a7ed0483f713920222ff1959e7a3e3073aac61abed25af56b0bd
3
+ metadata.gz: 38849c0467ba80b057fa8bc659ad98b025dd1c6d9ce416a4f2c48dff91f50fac
4
+ data.tar.gz: 791b45e82bcddf8bca2923db816475aa16bb81efa96d7c38381de12ea18fe65b
5
5
  SHA512:
6
- metadata.gz: 8682a1720108f7e95ad9802bcfe5b30283c735cfaa67323e5aca6bca1e1c06d0b6bb58d8fd2b8f4fc1fb7032579832667b78bab0c0f7013a937556650ad14ad7
7
- data.tar.gz: 255b3fd3827a1f33c1c244967649ab8eaa1adc8f6daa3a111b21e299f1bcc0341f324a1bee3f2c578f5c93b39eeb913caf2c3a6d8ea88d1e89c028c48576e1b0
6
+ metadata.gz: cbd464c6759316b86ab5732029fefa39518360dc40f055e729d585b9304ad84c9597c7e37908826bfc0347c109c89e7729db8096b2bf51ec64c536c272c9b6b3
7
+ data.tar.gz: c7ef92729c7d9cf38c7ec5e0a90fff5147fb4350d568c82c93e58c76b5c358d74929517b888bb8f96386230f0b2f50272488981668d183294fbda5ac86893ade
data/Rakefile CHANGED
@@ -98,7 +98,7 @@ namespace :consul do
98
98
  end
99
99
 
100
100
  Cucumber::Rake::Task.new(:cucumber) do |t|
101
- t.cucumber_opts = "features --format progress"
101
+ t.cucumber_opts = ["features", "--format progress"]
102
102
  end
103
103
 
104
104
  task :cucumber => :clean
data/beetle.gemspec CHANGED
@@ -24,20 +24,20 @@ Gem::Specification.new do |s|
24
24
 
25
25
  s.specification_version = 3
26
26
  s.add_runtime_dependency "bunny", "~> 0.7.12"
27
- s.add_runtime_dependency "redis", ">= 4.2.1"
27
+ s.add_runtime_dependency "redis", [">= 4.2.1", "< 5.0"]
28
28
  s.add_runtime_dependency "hiredis", ">= 0.4.5"
29
29
  s.add_runtime_dependency "amq-protocol", "= 2.3.2"
30
30
  s.add_runtime_dependency "amqp", "= 1.8.0"
31
31
  s.add_runtime_dependency "activesupport", ">= 2.3.4"
32
32
 
33
33
  s.add_development_dependency "activerecord", "~> 5.0"
34
- s.add_development_dependency "cucumber", "~> 2.4.0"
34
+ s.add_development_dependency "cucumber", "~> 8.0.0"
35
35
  s.add_development_dependency "daemon_controller", "~> 1.2.0"
36
36
  s.add_development_dependency "daemons", ">= 1.2.0"
37
37
  s.add_development_dependency "i18n"
38
38
  s.add_development_dependency "minitest", "~> 5.1"
39
- s.add_development_dependency "mocha", "~> 1.3.0"
40
- s.add_development_dependency "mysql2", "~> 0.4.4"
39
+ s.add_development_dependency "mocha", "~> 1.14"
40
+ s.add_development_dependency "mysql2", "~> 0.5"
41
41
  s.add_development_dependency "rake", "~> 13.0"
42
42
  s.add_development_dependency "simplecov", "~> 0.15"
43
43
  s.add_development_dependency "webmock", "~> 3.0"
@@ -45,4 +45,5 @@ Gem::Specification.new do |s|
45
45
  s.add_development_dependency 'yard'
46
46
  s.add_development_dependency 'redcarpet'
47
47
  s.add_development_dependency 'github-markup'
48
+ s.add_development_dependency 'byebug'
48
49
  end
@@ -186,8 +186,12 @@ end
186
186
 
187
187
  Then /^a system notification for no slave available to become new master should be sent$/ do
188
188
  text = "Redis master could not be switched, no slave available to become new master"
189
- lines = File.readlines(system_notification_log_path)
190
- tail = (["","",""]+lines)[-3..-1].join("\n")
189
+ tail = ""
190
+ 3.times do
191
+ lines = File.readlines(system_notification_log_path)
192
+ tail = (["","",""]+lines)[-3..-1].join("\n")
193
+ sleep 0.1 unless tail =~ /#{text}/
194
+ end
191
195
  assert_match /#{text}/, tail
192
196
  end
193
197
 
@@ -199,7 +203,7 @@ end
199
203
 
200
204
  Given /^an immediate master switch is initiated and responds with (\d+)$/ do |response_code|
201
205
  response = TestDaemons::RedisConfigurationServer.initiate_master_switch
202
- assert_equal response_code, response.code, "unexpected response code #{response.code}, message: #{response.body}"
206
+ assert_equal response_code.to_s, response.code, "unexpected response code #{response.code}, message: #{response.body}"
203
207
  sleep 1
204
208
  end
205
209
 
@@ -1,3 +1,3 @@
1
1
  module Beetle
2
- VERSION = "3.5.3"
2
+ VERSION = "3.5.4"
3
3
  end
data/lib/beetle.rb CHANGED
@@ -39,12 +39,8 @@ module Beetle
39
39
  # determine the fully qualified domainname of the host we're running on
40
40
  def self.hostname
41
41
  name = Socket.gethostname
42
- parts = name.split('.')
43
- if parts.size > 1
44
- name
45
- else
46
- Socket.gethostbyname(parts.first).first rescue name
47
- end
42
+ host = name.split('.').first
43
+ Addrinfo.getaddrinfo(host, nil, nil, :STREAM, nil, Socket::AI_CANONNAME).first.canonname rescue name
48
44
  end
49
45
 
50
46
  # use ruby's autoload mechanism for loading beetle classes
@@ -2,15 +2,18 @@ require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
2
2
 
3
3
  module Beetle
4
4
  class HostnameTest < Minitest::Test
5
- test "should use Socket.gethostname if returned name name is fully qualified" do
5
+ test "should use canonical name if possible " do
6
+ addr = mock("addr")
7
+ addr.expects(:canonname).returns("a.b.com")
6
8
  Socket.expects(:gethostname).returns("a.b.com")
9
+ Addrinfo.expects(:getaddrinfo).with("a", nil, nil, :STREAM, nil, Socket::AI_CANONNAME).returns([addr])
7
10
  assert_equal "a.b.com", Beetle.hostname
8
11
  end
9
12
 
10
- test "should use Socket.gethosbyname if returned name name is not fully qualified" do
13
+ test "should use Socket.gethostbyname if Addrinfo raises" do
11
14
  Socket.expects(:gethostname).returns("a")
12
- Socket.expects(:gethostbyname).with("a").returns(["a.b.com"])
13
- assert_equal "a.b.com", Beetle.hostname
15
+ Addrinfo.expects(:getaddrinfo).with("a", nil, nil, :STREAM, nil, Socket::AI_CANONNAME).raises("murks")
16
+ assert_equal "a", Beetle.hostname
14
17
  end
15
18
  end
16
19
  end
@@ -327,7 +327,9 @@ module Beetle
327
327
  client.register_queue("b_queue")
328
328
  client.register_queue("a_queue")
329
329
  client.send(:subscriber).expects(:listen_queues).with {|value| value.include?("a_queue") && value.include?("b_queue")}.yields
330
- client.listen
330
+ called = false
331
+ client.listen { called = true }
332
+ assert called
331
333
  end
332
334
 
333
335
  test "trying to listen to a message is no longer supported and should raise an exception" do
@@ -338,7 +340,9 @@ module Beetle
338
340
  client = Client.new
339
341
  client.register_queue(:test)
340
342
  client.send(:subscriber).expects(:listen_queues).with(['test']).yields
341
- client.listen_queues([:test])
343
+ called = false
344
+ client.listen_queues([:test]) { called = true }
345
+ assert called
342
346
  end
343
347
 
344
348
  test "trying to listen to an unknown queue should raise an exception" do
@@ -41,9 +41,9 @@ module Beetle
41
41
 
42
42
  test "stop! should close all connections if the reactor is not running" do
43
43
  connection1 = mock('conection1')
44
- connection1.expects(:close).yields
44
+ connection1.expects(:close)
45
45
  connection2 = mock('connection2')
46
- connection2.expects(:close).yields
46
+ connection2.expects(:close)
47
47
  @sub.instance_variable_set "@connections", [["server1", connection1], ["server2", connection2]]
48
48
  EM.expects(:reactor_running?).returns(false)
49
49
  @sub.send(:stop!)
data/test/test_helper.rb CHANGED
@@ -8,7 +8,7 @@ end
8
8
  require 'minitest/autorun'
9
9
  require 'minitest/unit'
10
10
  require 'minitest/pride' if ENV['RAINBOW_COLORED_TESTS'] == "1" && $stdout.tty?
11
- require 'mocha/setup'
11
+ require 'mocha/minitest'
12
12
 
13
13
  require File.expand_path(File.dirname(__FILE__) + '/../lib/beetle')
14
14
  require 'eventmachine'
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.3
4
+ version: 3.5.4
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: 2022-02-09 00:00:00.000000000 Z
15
+ date: 2022-08-30 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: bunny
@@ -35,6 +35,9 @@ dependencies:
35
35
  - - ">="
36
36
  - !ruby/object:Gem::Version
37
37
  version: 4.2.1
38
+ - - "<"
39
+ - !ruby/object:Gem::Version
40
+ version: '5.0'
38
41
  type: :runtime
39
42
  prerelease: false
40
43
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,6 +45,9 @@ dependencies:
42
45
  - - ">="
43
46
  - !ruby/object:Gem::Version
44
47
  version: 4.2.1
48
+ - - "<"
49
+ - !ruby/object:Gem::Version
50
+ version: '5.0'
45
51
  - !ruby/object:Gem::Dependency
46
52
  name: hiredis
47
53
  requirement: !ruby/object:Gem::Requirement
@@ -118,14 +124,14 @@ dependencies:
118
124
  requirements:
119
125
  - - "~>"
120
126
  - !ruby/object:Gem::Version
121
- version: 2.4.0
127
+ version: 8.0.0
122
128
  type: :development
123
129
  prerelease: false
124
130
  version_requirements: !ruby/object:Gem::Requirement
125
131
  requirements:
126
132
  - - "~>"
127
133
  - !ruby/object:Gem::Version
128
- version: 2.4.0
134
+ version: 8.0.0
129
135
  - !ruby/object:Gem::Dependency
130
136
  name: daemon_controller
131
137
  requirement: !ruby/object:Gem::Requirement
@@ -188,28 +194,28 @@ dependencies:
188
194
  requirements:
189
195
  - - "~>"
190
196
  - !ruby/object:Gem::Version
191
- version: 1.3.0
197
+ version: '1.14'
192
198
  type: :development
193
199
  prerelease: false
194
200
  version_requirements: !ruby/object:Gem::Requirement
195
201
  requirements:
196
202
  - - "~>"
197
203
  - !ruby/object:Gem::Version
198
- version: 1.3.0
204
+ version: '1.14'
199
205
  - !ruby/object:Gem::Dependency
200
206
  name: mysql2
201
207
  requirement: !ruby/object:Gem::Requirement
202
208
  requirements:
203
209
  - - "~>"
204
210
  - !ruby/object:Gem::Version
205
- version: 0.4.4
211
+ version: '0.5'
206
212
  type: :development
207
213
  prerelease: false
208
214
  version_requirements: !ruby/object:Gem::Requirement
209
215
  requirements:
210
216
  - - "~>"
211
217
  - !ruby/object:Gem::Version
212
- version: 0.4.4
218
+ version: '0.5'
213
219
  - !ruby/object:Gem::Dependency
214
220
  name: rake
215
221
  requirement: !ruby/object:Gem::Requirement
@@ -308,6 +314,20 @@ dependencies:
308
314
  - - ">="
309
315
  - !ruby/object:Gem::Version
310
316
  version: '0'
317
+ - !ruby/object:Gem::Dependency
318
+ name: byebug
319
+ requirement: !ruby/object:Gem::Requirement
320
+ requirements:
321
+ - - ">="
322
+ - !ruby/object:Gem::Version
323
+ version: '0'
324
+ type: :development
325
+ prerelease: false
326
+ version_requirements: !ruby/object:Gem::Requirement
327
+ requirements:
328
+ - - ">="
329
+ - !ruby/object:Gem::Version
330
+ version: '0'
311
331
  description: A highly available, reliable messaging infrastructure
312
332
  email: opensource@xing.com
313
333
  executables: []
@@ -398,7 +418,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
398
418
  - !ruby/object:Gem::Version
399
419
  version: 1.3.7
400
420
  requirements: []
401
- rubygems_version: 3.3.4
421
+ rubygems_version: 3.3.19
402
422
  signing_key:
403
423
  specification_version: 3
404
424
  summary: High Availability AMQP Messaging with Redundant Queues