rspec-buildkite-analytics 0.3.1 → 0.3.5
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 +4 -4
- data/Gemfile.lock +8 -8
- data/lib/rspec/buildkite/analytics/ci.rb +1 -1
- data/lib/rspec/buildkite/analytics/session.rb +9 -8
- data/lib/rspec/buildkite/analytics/socket_connection.rb +20 -0
- data/lib/rspec/buildkite/analytics/uploader.rb +4 -4
- data/lib/rspec/buildkite/analytics/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d55751f8e88a6ac7ad250c0c1e2b382dcaeb2d23504aa6d110a22a4a61af8d06
|
4
|
+
data.tar.gz: b21d3d7fe03e1d504870b2d1fba0f188ab94e1f5e1c5c3fa3f11b1536a9f99b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bb6efbdc7f9b4f06ab3b0793c9ef5a1c2b41429a755040d0c6b558fbb24b308e59cd862a646b86717bb5bebf4464eec45e3551db043b8332ed37a94b642f789
|
7
|
+
data.tar.gz: 97089293de5331c1329979fd853ff15297e4460aaec7631867e2031398a31603296e53174da6a398134fe7a54bfa9b1e7082817acb989e6f74978a574afae9fc
|
data/Gemfile.lock
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rspec-buildkite-analytics (0.
|
5
|
-
activesupport
|
6
|
-
rspec-core
|
7
|
-
rspec-expectations
|
8
|
-
websocket
|
4
|
+
rspec-buildkite-analytics (0.3.5)
|
5
|
+
activesupport (>= 5.2, <= 7.0)
|
6
|
+
rspec-core (~> 3.10)
|
7
|
+
rspec-expectations (~> 3.10)
|
8
|
+
websocket (~> 1.2)
|
9
9
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
activesupport (6.1.4)
|
13
|
+
activesupport (6.1.4.1)
|
14
14
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
15
15
|
i18n (>= 1.6, < 2)
|
16
16
|
minitest (>= 5.1)
|
@@ -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.
|
41
|
+
zeitwerk (2.5.1)
|
42
42
|
|
43
43
|
PLATFORMS
|
44
44
|
ruby
|
@@ -49,4 +49,4 @@ DEPENDENCIES
|
|
49
49
|
rspec-buildkite-analytics!
|
50
50
|
|
51
51
|
BUNDLED WITH
|
52
|
-
2.2.
|
52
|
+
2.2.22
|
@@ -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.
|
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 "
|
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 "
|
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
|
@@ -127,12 +127,12 @@ module RSpec::Buildkite::Analytics
|
|
127
127
|
response = begin
|
128
128
|
http.request(contact)
|
129
129
|
rescue *REQUEST_EXCEPTIONS => e
|
130
|
-
puts "Error communicating with the server: #{e.message}"
|
130
|
+
puts "Buildkite Test Analytics: Error communicating with the server: #{e.message}"
|
131
131
|
end
|
132
132
|
|
133
133
|
case response.code
|
134
134
|
when "401"
|
135
|
-
puts "Invalid Suite API key. Please double check your Suite API key."
|
135
|
+
puts "Buildkite Test Analytics: Invalid Suite API key. Please double check your Suite API key."
|
136
136
|
when "200"
|
137
137
|
json = JSON.parse(response.body)
|
138
138
|
|
@@ -141,10 +141,10 @@ module RSpec::Buildkite::Analytics
|
|
141
141
|
end
|
142
142
|
else
|
143
143
|
request_id = response.to_hash["x-request-id"]
|
144
|
-
puts "Unknown error. If this error persists, please contact support+analytics@buildkite.com with this request ID `#{request_id}`."
|
144
|
+
puts "Buildkite Test Analytics: Unknown error. If this error persists, please contact support+analytics@buildkite.com with this request ID `#{request_id}`."
|
145
145
|
end
|
146
146
|
else
|
147
|
-
puts "No Suite API key provided. You can get the API key from your Suite settings page."
|
147
|
+
puts "Buildkite Test Analytics: No Suite API key provided. You can get the API key from your Suite settings page."
|
148
148
|
end
|
149
149
|
end
|
150
150
|
|
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
|
+
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-
|
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.
|
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
|