buildkite-test_collector 1.0.1 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +2 -2
- data/lib/buildkite/test_collector/ci.rb +3 -1
- data/lib/buildkite/test_collector/library_hooks/minitest.rb +1 -1
- data/lib/buildkite/test_collector/minitest_plugin/trace.rb +2 -1
- data/lib/buildkite/test_collector/minitest_plugin.rb +3 -3
- data/lib/buildkite/test_collector/session.rb +3 -3
- data/lib/buildkite/test_collector/tracer.rb +15 -5
- data/lib/buildkite/test_collector/uploader.rb +1 -1
- data/lib/buildkite/test_collector/version.rb +1 -1
- data/lib/buildkite/test_collector.rb +2 -4
- data/lib/minitest/buildkite_collector_plugin.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96fb0d0c08ff10d420388b2438ae199c7fbf72878d1fa5631c68b27e70f11cac
|
4
|
+
data.tar.gz: 78846d669900e535d1e03bd7494611dd124f2c1bae59471ad41b5b0d9f1efb1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7151f06cf10d7aeb296b9d8c9294f9cdab0b07fc01112176cdc28ad55f7b65d4aa51fcc21dfd179eb58bc6c69592583f58335dece7f3b46ac1e2ba7718da369
|
7
|
+
data.tar.gz: cb1157c4a4cfaa719d852f2ac271bd09bbd25a461b4f6a9c002063d7461e3bb06e8107342cceb77dada1cda8090c3643aa3e2827aac7355fea90b51bbae4f7f0
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,20 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## v1.1.1
|
4
|
+
|
5
|
+
- Strip CR/LF from token input #127 - @gchan
|
6
|
+
- Allow specify run name prefix and suffix #130 - @juanitofatas
|
7
|
+
- Improve Minitest support by using after_teardown #131 - @davidstosik
|
8
|
+
- Avoid breaking test suite stubs `Process.clock_gettime` #132 - @juanitofatas (thanks @ChrisBR)
|
9
|
+
|
10
|
+
## v1.1.0
|
11
|
+
|
12
|
+
- Remove an internal debugging change #115 — @juanitofatas
|
13
|
+
- Remove warnings #116 - @juanitofatas
|
14
|
+
- Fix old gem name still in debugging and warning messages #117 - @juanitofatas
|
15
|
+
- Include module from `Minitest` #118 - @juanitofatas
|
16
|
+
- Fix Minitest loading without using minitest hook #125 — @paulca
|
17
|
+
|
3
18
|
## v1.0.1
|
4
19
|
|
5
20
|
- Fix project_dir issue expecting a string, not a Pathname #112 — @paulca
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
buildkite-test_collector (1.
|
4
|
+
buildkite-test_collector (1.1.1)
|
5
5
|
activesupport (>= 5.2, < 8)
|
6
6
|
websocket (~> 1.2)
|
7
7
|
|
@@ -17,7 +17,7 @@ GEM
|
|
17
17
|
diff-lcs (1.4.4)
|
18
18
|
i18n (1.10.0)
|
19
19
|
concurrent-ruby (~> 1.0)
|
20
|
-
minitest (5.
|
20
|
+
minitest (5.16.1)
|
21
21
|
rake (13.0.6)
|
22
22
|
rspec (3.10.0)
|
23
23
|
rspec-core (~> 3.10.0)
|
@@ -39,7 +39,9 @@ class Buildkite::TestCollector::CI
|
|
39
39
|
"debug" => ENV["BUILDKITE_ANALYTICS_DEBUG_ENABLED"],
|
40
40
|
"version" => Buildkite::TestCollector::VERSION,
|
41
41
|
"collector" => Buildkite::TestCollector::NAME,
|
42
|
-
|
42
|
+
"run_name_prefix" => ENV["BUILDKITE_ANALYTICS_RUN_NAME_PREFIX"],
|
43
|
+
"run_name_suffix" => ENV["BUILDKITE_ANALYTICS_RUN_NAME_SUFFIX"],
|
44
|
+
}.compact
|
43
45
|
end
|
44
46
|
|
45
47
|
def generic
|
@@ -4,7 +4,8 @@ require "active_support/core_ext/hash/indifferent_access"
|
|
4
4
|
|
5
5
|
module Buildkite::TestCollector::MinitestPlugin
|
6
6
|
class Trace
|
7
|
-
attr_accessor :example
|
7
|
+
attr_accessor :example
|
8
|
+
attr_writer :failure_reason, :failure_expanded
|
8
9
|
attr_reader :id, :history
|
9
10
|
|
10
11
|
RESULT_CODES = {
|
@@ -12,9 +12,7 @@ module Buildkite::TestCollector::MinitestPlugin
|
|
12
12
|
Thread.current[:_buildkite_tracer] = tracer
|
13
13
|
end
|
14
14
|
|
15
|
-
def
|
16
|
-
super
|
17
|
-
|
15
|
+
def after_teardown
|
18
16
|
tracer = Thread.current[:_buildkite_tracer]
|
19
17
|
if !tracer.nil?
|
20
18
|
Thread.current[:_buildkite_tracer] = nil
|
@@ -23,5 +21,7 @@ module Buildkite::TestCollector::MinitestPlugin
|
|
23
21
|
trace = Buildkite::TestCollector::MinitestPlugin::Trace.new(self, history: tracer.history)
|
24
22
|
Buildkite::TestCollector.uploader.traces[trace.source_location] = trace
|
25
23
|
end
|
24
|
+
|
25
|
+
super
|
26
26
|
end
|
27
27
|
end
|
@@ -42,9 +42,9 @@ module Buildkite::TestCollector
|
|
42
42
|
reconnection_count += 1
|
43
43
|
connect
|
44
44
|
rescue TimeoutError, InitialConnectionFailure => e
|
45
|
-
Buildkite::TestCollector.logger.warn("
|
45
|
+
Buildkite::TestCollector.logger.warn("buildkite-test_collector could not establish an initial connection with Buildkite due to #{e}. Attempting retry #{reconnection_count} of #{MAX_RECONNECTION_ATTEMPTS}...")
|
46
46
|
if reconnection_count > MAX_RECONNECTION_ATTEMPTS
|
47
|
-
Buildkite::TestCollector.logger.error "
|
47
|
+
Buildkite::TestCollector.logger.error "buildkite-test_collector 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."
|
48
48
|
else
|
49
49
|
sleep(WAIT_BETWEEN_RECONNECTIONS)
|
50
50
|
Buildkite::TestCollector.logger.warn("retrying reconnection")
|
@@ -77,7 +77,7 @@ module Buildkite::TestCollector
|
|
77
77
|
rescue *DISCONNECTED_EXCEPTIONS => e
|
78
78
|
Buildkite::TestCollector.logger.warn("failed reconnection attempt #{reconnection_count} due to #{e}")
|
79
79
|
if reconnection_count > MAX_RECONNECTION_ATTEMPTS
|
80
|
-
Buildkite::TestCollector.logger.error "
|
80
|
+
Buildkite::TestCollector.logger.error "buildkite-test_collector experienced a disconnection and could not reconnect to Buildkite due to #{e.message}. Please contact support."
|
81
81
|
raise e
|
82
82
|
else
|
83
83
|
sleep(WAIT_BETWEEN_RECONNECTIONS)
|
@@ -4,6 +4,16 @@ require "active_support/core_ext/hash/indifferent_access"
|
|
4
4
|
|
5
5
|
module Buildkite::TestCollector
|
6
6
|
class Tracer
|
7
|
+
# https://github.com/buildkite/test-collector-ruby/issues/131
|
8
|
+
class MonotonicTime
|
9
|
+
GET_TIME = Process.method(:clock_gettime)
|
10
|
+
private_constant :GET_TIME
|
11
|
+
|
12
|
+
def self.call
|
13
|
+
GET_TIME.call Process::CLOCK_MONOTONIC
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
7
17
|
class Span
|
8
18
|
attr_accessor :section, :start_at, :end_at, :detail, :children
|
9
19
|
|
@@ -28,23 +38,23 @@ module Buildkite::TestCollector
|
|
28
38
|
end
|
29
39
|
|
30
40
|
def initialize
|
31
|
-
@top = Span.new(:top,
|
41
|
+
@top = Span.new(:top, MonotonicTime.call, nil, {})
|
32
42
|
@stack = [@top]
|
33
43
|
end
|
34
44
|
|
35
45
|
def enter(section, **detail)
|
36
|
-
new_entry = Span.new(section,
|
46
|
+
new_entry = Span.new(section, MonotonicTime.call, nil, detail)
|
37
47
|
current_span.children << new_entry
|
38
48
|
@stack << new_entry
|
39
49
|
end
|
40
50
|
|
41
51
|
def leave
|
42
|
-
current_span.end_at =
|
52
|
+
current_span.end_at = MonotonicTime.call
|
43
53
|
@stack.pop
|
44
54
|
end
|
45
55
|
|
46
56
|
def backfill(section, duration, **detail)
|
47
|
-
new_entry = Span.new(section,
|
57
|
+
new_entry = Span.new(section, MonotonicTime.call - duration, MonotonicTime.call, detail)
|
48
58
|
current_span.children << new_entry
|
49
59
|
end
|
50
60
|
|
@@ -54,7 +64,7 @@ module Buildkite::TestCollector
|
|
54
64
|
|
55
65
|
def finalize
|
56
66
|
raise "Stack not empty" unless @stack.size == 1
|
57
|
-
@top.end_at =
|
67
|
+
@top.end_at = MonotonicTime.call
|
58
68
|
self
|
59
69
|
end
|
60
70
|
|
@@ -57,7 +57,7 @@ module Buildkite::TestCollector
|
|
57
57
|
end
|
58
58
|
else
|
59
59
|
request_id = response.to_hash["x-request-id"]
|
60
|
-
Buildkite::TestCollector.logger.info "
|
60
|
+
Buildkite::TestCollector.logger.info "buildkite-test_collector could not establish an initial connection with Buildkite. You may be missing some data for this test suite, please contact support with request ID #{request_id}."
|
61
61
|
end
|
62
62
|
else
|
63
63
|
if !!ENV["BUILDKITE_BUILD_ID"]
|
@@ -19,15 +19,13 @@ module Buildkite
|
|
19
19
|
attr_accessor :uploader
|
20
20
|
attr_accessor :session
|
21
21
|
attr_accessor :debug_enabled
|
22
|
-
attr_accessor :debug_filepath
|
23
22
|
attr_accessor :tracing_enabled
|
24
23
|
end
|
25
24
|
|
26
|
-
def self.configure(hook:, token: nil, url: nil, debug_enabled: false,
|
27
|
-
self.api_token = token || ENV["BUILDKITE_ANALYTICS_TOKEN"]
|
25
|
+
def self.configure(hook:, token: nil, url: nil, debug_enabled: false, tracing_enabled: true)
|
26
|
+
self.api_token = (token || ENV["BUILDKITE_ANALYTICS_TOKEN"])&.strip
|
28
27
|
self.url = url || DEFAULT_URL
|
29
28
|
self.debug_enabled = debug_enabled || !!(ENV["BUILDKITE_ANALYTICS_DEBUG_ENABLED"])
|
30
|
-
self.debug_filepath = debug_filepath || ENV["BUILDKITE_ANALYTICS_DEBUG_FILEPATH"] || Dir.tmpdir
|
31
29
|
self.tracing_enabled = tracing_enabled
|
32
30
|
|
33
31
|
self.hook_into(hook)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Minitest
|
2
2
|
def self.plugin_buildkite_collector_init(options)
|
3
|
-
if Buildkite::TestCollector.respond_to?(:uploader)
|
3
|
+
if defined?(Buildkite::TestCollector::MinitestPlugin) && Buildkite::TestCollector.respond_to?(:uploader)
|
4
4
|
self.reporter << Buildkite::TestCollector::MinitestPlugin::Reporter.new(options[:io], options)
|
5
5
|
end
|
6
6
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: buildkite-test_collector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Buildkite
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-06-
|
11
|
+
date: 2022-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|