rspec-buildkite-analytics 0.3.4 → 0.3.5

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: 23cd65346e813fe92bc69f52607c1dd580666879ca6ccc28b89fa277cff496e2
4
- data.tar.gz: 3f1bc2b37f5e926d144b38b28a4406f0604e6458d8d288c32a6500869eea1258
3
+ metadata.gz: d55751f8e88a6ac7ad250c0c1e2b382dcaeb2d23504aa6d110a22a4a61af8d06
4
+ data.tar.gz: b21d3d7fe03e1d504870b2d1fba0f188ab94e1f5e1c5c3fa3f11b1536a9f99b1
5
5
  SHA512:
6
- metadata.gz: c08b2ae468dda9fe8aabb7e52088eb2447243d4022f33402086e80968c1ef49382e2aa0aad4a3c596b4fb4337ce6b89ecc059862786393e08de8aa039de6230d
7
- data.tar.gz: f7ed799c14eeaa6720b62e9ac25b9ea1c550019f776cf6a9c4437abdc9100e0ccc030ee97c3339b02f2e19fc3fa6518e7bf1977afdaf59bc97bfd495a9a1d94a
6
+ metadata.gz: 8bb6efbdc7f9b4f06ab3b0793c9ef5a1c2b41429a755040d0c6b558fbb24b308e59cd862a646b86717bb5bebf4464eec45e3551db043b8332ed37a94b642f789
7
+ data.tar.gz: 97089293de5331c1329979fd853ff15297e4460aaec7631867e2031398a31603296e53174da6a398134fe7a54bfa9b1e7082817acb989e6f74978a574afae9fc
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rspec-buildkite-analytics (0.3.4)
4
+ rspec-buildkite-analytics (0.3.5)
5
5
  activesupport (>= 5.2, <= 7.0)
6
6
  rspec-core (~> 3.10)
7
7
  rspec-expectations (~> 3.10)
@@ -38,7 +38,7 @@ GEM
38
38
  tzinfo (2.0.4)
39
39
  concurrent-ruby (~> 1.0)
40
40
  websocket (1.2.9)
41
- zeitwerk (2.4.2)
41
+ zeitwerk (2.5.1)
42
42
 
43
43
  PLATFORMS
44
44
  ruby
@@ -10,6 +10,7 @@ module RSpec::Buildkite::Analytics
10
10
  WAIT_BETWEEN_RECONNECTIONS = 5
11
11
 
12
12
  class RejectedSubscription < StandardError; end
13
+ class InitialConnectionFailure < StandardError; end
13
14
 
14
15
  def initialize(url, authorization_header, channel)
15
16
  @queue = Queue.new
@@ -25,8 +26,8 @@ module RSpec::Buildkite::Analytics
25
26
  @authorization_header = authorization_header
26
27
 
27
28
  connect
28
- rescue TimeoutError => e
29
- $stderr.puts "rspec-buildkite-analytics could not establish an initial connection with Buildkite. Please contact support."
29
+ rescue TimeoutError, InitialConnectionFailure => e
30
+ $stderr.puts "rspec-buildkite-analytics could not establish an initial connection with Buildkite due to #{e.message}. You may be missing some data for this test suite, please contact support."
30
31
  end
31
32
 
32
33
  def disconnected(connection)
@@ -138,25 +139,25 @@ module RSpec::Buildkite::Analytics
138
139
  wait_for_confirm
139
140
  end
140
141
 
141
- def pop_with_timeout
142
- Timeout.timeout(30, RSpec::Buildkite::Analytics::TimeoutError, "Waited 30 seconds") do
142
+ def pop_with_timeout(message_type)
143
+ Timeout.timeout(30, RSpec::Buildkite::Analytics::TimeoutError, "Timeout: Waited 30 seconds for #{message_type}") do
143
144
  @queue.pop
144
145
  end
145
146
  end
146
147
 
147
148
  def wait_for_welcome
148
- welcome = pop_with_timeout
149
+ welcome = pop_with_timeout("welcome")
149
150
 
150
151
  if welcome && welcome != { "type" => "welcome" }
151
- raise "Not a welcome: #{welcome.inspect}"
152
+ raise InitialConnectionFailure.new("Wrong message received, expected a welcome, but received: #{welcome.inspect}")
152
153
  end
153
154
  end
154
155
 
155
156
  def wait_for_confirm
156
- confirm = pop_with_timeout
157
+ confirm = pop_with_timeout("confirm")
157
158
 
158
159
  if confirm && confirm != { "type" => "confirm_subscription", "identifier" => @channel }
159
- raise "Not a confirm: #{confirm.inspect}"
160
+ raise InitialConnectionFailure.new("Wrong message received, expected a confirm, but received: #{confirm.inspect}")
160
161
  end
161
162
  end
162
163
 
@@ -82,6 +82,16 @@ module RSpec::Buildkite::Analytics
82
82
  end
83
83
  rescue IOError
84
84
  # This is fine to ignore
85
+ rescue IndexError
86
+ # I don't like that we're doing this but I think it's the best of the options
87
+ #
88
+ # This relates to this issue https://github.com/ruby/openssl/issues/452
89
+ # A fix for it has been released but the repercussions of overriding
90
+ # the OpenSSL version in the stdlib seem worse than catching this error here.
91
+ if @socket
92
+ @session.disconnected(self)
93
+ disconnect
94
+ end
85
95
  end
86
96
  end
87
97
 
@@ -96,6 +106,16 @@ module RSpec::Buildkite::Analytics
96
106
  return unless @socket
97
107
  @session.disconnected(self)
98
108
  disconnect
109
+ rescue IndexError
110
+ # I don't like that we're doing this but I think it's the best of the options
111
+ #
112
+ # This relates to this issue https://github.com/ruby/openssl/issues/452
113
+ # A fix for it has been released but the repercussions of overriding
114
+ # the OpenSSL version in the stdlib seem worse than catching this error here.
115
+ if @socket
116
+ @session.disconnected(self)
117
+ disconnect
118
+ end
99
119
  end
100
120
 
101
121
  def close
@@ -3,7 +3,7 @@
3
3
  module RSpec
4
4
  module Buildkite
5
5
  module Analytics
6
- VERSION = "0.3.4"
6
+ VERSION = "0.3.5"
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-buildkite-analytics
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Buildkite
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-07 00:00:00.000000000 Z
11
+ date: 2021-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  - !ruby/object:Gem::Version
122
122
  version: '0'
123
123
  requirements: []
124
- rubygems_version: 3.2.22
124
+ rubygems_version: 3.1.4
125
125
  signing_key:
126
126
  specification_version: 4
127
127
  summary: Track execution of specs and report to Buildkite Analytics