rspec-buildkite-analytics 0.6.1 → 0.6.3

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: 541f8d1bf4465e411f3fa17757b1c13bc073ea361db1e66973060cb673779d39
4
- data.tar.gz: 87bb5b43638e2db1951ab0fc0a60a67f5edc7f41c0b4d4735bf75d4202745d21
3
+ metadata.gz: 499229f993ea2f8556a6d908f011325bf989de60c9a69a266338356b9f89426f
4
+ data.tar.gz: 901fec67b35b6ca85f61900a4cd9fa00293959892eb45e95339b6d4a6c27f527
5
5
  SHA512:
6
- metadata.gz: e98d13112dddf07fbad1cef13042de7fadd856b3c92202859ebf7e9c935b72eb8d960525181c726fd2ac1d15f72e9252273c9c1e8553f466a0aa415e0307b7df
7
- data.tar.gz: 9380dce5392e09ef0758780e8a58586f11aabc57ca11ea345d2ae3d7a0f9fa2bac1c982e514b0b556faddf10b0b5ba02f9495320a628bf7add4700898fb29d0e
6
+ metadata.gz: 0b7942d5c6b1abd45ff662cd52878d348bb1f9b3e2fa9fd1a6285eb7f521ac1d1f9dcc52007650dde979da9ddcbdd0506afe869708c785d033f9cf2e969eb009
7
+ data.tar.gz: c5484d6a416ac0faf663390c64d86e6c24184ddadbaa286b66407afd169444b7af9a6b9e665ead3438e87e719b5563ea0bc184c963643e17b13cdb8d3517ad1c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rspec-buildkite-analytics (0.6.1)
4
+ rspec-buildkite-analytics (0.6.3)
5
5
  activesupport (>= 5.2, <= 7.0)
6
6
  rspec-core (~> 3.10)
7
7
  rspec-expectations (~> 3.10)
@@ -10,17 +10,16 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- activesupport (6.1.4.1)
13
+ activesupport (7.0.0)
14
14
  concurrent-ruby (~> 1.0, >= 1.0.2)
15
15
  i18n (>= 1.6, < 2)
16
16
  minitest (>= 5.1)
17
17
  tzinfo (~> 2.0)
18
- zeitwerk (~> 2.3)
19
18
  concurrent-ruby (1.1.9)
20
19
  diff-lcs (1.4.4)
21
20
  i18n (1.8.11)
22
21
  concurrent-ruby (~> 1.0)
23
- minitest (5.14.4)
22
+ minitest (5.15.0)
24
23
  rake (13.0.6)
25
24
  rspec (3.10.0)
26
25
  rspec-core (~> 3.10.0)
@@ -38,7 +37,6 @@ GEM
38
37
  tzinfo (2.0.4)
39
38
  concurrent-ruby (~> 1.0)
40
39
  websocket (1.2.9)
41
- zeitwerk (2.5.1)
42
40
 
43
41
  PLATFORMS
44
42
  ruby
@@ -14,13 +14,17 @@ module RSpec::Buildkite::Analytics::CI
14
14
  "number" => ENV["BUILDKITE_BUILD_NUMBER"],
15
15
  "job_id" => ENV["BUILDKITE_JOB_ID"],
16
16
  "message" => ENV["BUILDKITE_MESSAGE"],
17
- "debug" => ENV["BUILDKITE_ANALYTICS_DEBUG_ENABLED"]
17
+ "debug" => ENV["BUILDKITE_ANALYTICS_DEBUG_ENABLED"],
18
+ "version" => RSpec::Buildkite::Analytics::VERSION,
19
+ "collector" => RSpec::Buildkite::Analytics::NAME
18
20
  }
19
21
  else
20
22
  {
21
23
  "CI" => nil,
22
24
  "key" => SecureRandom.uuid,
23
- "debug" => ENV["BUILDKITE_ANALYTICS_DEBUG_ENABLED"]
25
+ "debug" => ENV["BUILDKITE_ANALYTICS_DEBUG_ENABLED"],
26
+ "version" => RSpec::Buildkite::Analytics::VERSION,
27
+ "collector" => RSpec::Buildkite::Analytics::NAME
24
28
  }
25
29
  end
26
30
  end
@@ -52,9 +52,22 @@ module RSpec::Buildkite::Analytics
52
52
 
53
53
  @logger = Logger.new
54
54
 
55
- connect
56
- rescue TimeoutError, InitialConnectionFailure => e
57
- $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."
55
+ reconnection_count = 0
56
+
57
+ begin
58
+ reconnection_count += 1
59
+ connect
60
+ rescue TimeoutError, InitialConnectionFailure => e
61
+ @logger.write("rspec-buildkite-analytics could not establish an initial connection with Buildkite due to #{e}. Attempting retry #{reconnection_count} of #{MAX_RECONNECTION_ATTEMPTS}...")
62
+ if reconnection_count > MAX_RECONNECTION_ATTEMPTS
63
+ $stderr.puts "rspec-buildkite-analytics could not establish an initial connection with Buildkite due to #{e.message} after #{MAX_RECONNECTION_ATTEMPTS} attempts. You may be missing some data for this test suite, please contact support if this issue persists."
64
+ else
65
+ sleep(WAIT_BETWEEN_RECONNECTIONS)
66
+ @logger.write("retrying reconnection")
67
+ retry
68
+ end
69
+ end
70
+ init_write_thread
58
71
  end
59
72
 
60
73
  def disconnected(connection)
@@ -76,7 +89,8 @@ module RSpec::Buildkite::Analytics
76
89
  begin
77
90
  reconnection_count += 1
78
91
  connect
79
- rescue SocketConnection::HandshakeError, RejectedSubscription, TimeoutError, SocketConnection::SocketError => e
92
+ init_write_thread
93
+ rescue SocketConnection::HandshakeError, RejectedSubscription, TimeoutError, InitialConnectionFailure, SocketConnection::SocketError => e
80
94
  @logger.write("failed reconnection attempt #{reconnection_count} due to #{e}")
81
95
  if reconnection_count > MAX_RECONNECTION_ATTEMPTS
82
96
  $stderr.puts "rspec-buildkite-analytics experienced a disconnection and could not reconnect to Buildkite due to #{e.message}. Please contact support."
@@ -170,8 +184,10 @@ module RSpec::Buildkite::Analytics
170
184
  wait_for_confirm
171
185
 
172
186
  @logger.write("connected")
187
+ end
173
188
 
174
- # As this connect method can be called multiple times in the
189
+ def init_write_thread
190
+ # As this method can be called multiple times in the
175
191
  # reconnection process, kill prev write threads (if any) before
176
192
  # setting up the new one
177
193
  @write_thread&.kill
@@ -125,6 +125,8 @@ module RSpec::Buildkite::Analytics
125
125
  puts "Buildkite Test Analytics: Error communicating with the server: #{e.message}"
126
126
  end
127
127
 
128
+ return unless response
129
+
128
130
  case response.code
129
131
  when "401"
130
132
  puts "Buildkite Test Analytics: Invalid Suite API key. Please double check your Suite API key."
@@ -3,7 +3,8 @@
3
3
  module RSpec
4
4
  module Buildkite
5
5
  module Analytics
6
- VERSION = "0.6.1"
6
+ VERSION = "0.6.3"
7
+ NAME = "rspec-buildkite"
7
8
  end
8
9
  end
9
10
  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.6.1
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Buildkite
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-09 00:00:00.000000000 Z
11
+ date: 2022-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport