buildkite-test_collector 2.8.0 → 2.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +1 -1
- data/lib/buildkite/test_collector/library_hooks/rspec.rb +13 -7
- data/lib/buildkite/test_collector/minitest_plugin/trace.rb +4 -1
- data/lib/buildkite/test_collector/minitest_plugin.rb +15 -4
- data/lib/buildkite/test_collector/rspec_plugin/trace.rb +4 -1
- data/lib/buildkite/test_collector/version.rb +1 -1
- data/lib/buildkite/test_collector.rb +12 -0
- 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: 468ad8ce641432cc7a1112d1f80396a4f54e9d63a566aa7f240d485969855686
|
4
|
+
data.tar.gz: 8348dc3fac0a7e57b0543da3870fbc89cdef8b0e1662c439eaea8c7d2a685210
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70baa9565cb411b56888f1e72048d554e87dc6d8ee76c7dd1cc3d67e943801f9133e27d883a5d7da74677b61d73c2c8258385a02aa4c997f98471d3d1157af06
|
7
|
+
data.tar.gz: c8a34a8fd8c6554c59a66812d41cc747cc5ffae27b4f651c4ca58c6cb44c81ec9f747eeb82ac061897e11c555053404be500414055c0881adafb33272ba1c511
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## v2.9.0
|
4
|
+
|
5
|
+
* `Buildkite::TestCollector.tag_execution(key, value)` by @pda in https://github.com/buildkite/test-collector-ruby/pull/240
|
6
|
+
|
7
|
+
**Full Changelog**: https://github.com/buildkite/test-collector-ruby/compare/v2.8.0...v2.9.0
|
8
|
+
|
3
9
|
## v2.8.0
|
4
10
|
|
5
11
|
* Buildkite::TestCollector.tags: specify tags for all executions by @pda in https://github.com/buildkite/test-collector-ruby/pull/235
|
data/Gemfile.lock
CHANGED
@@ -18,21 +18,27 @@ RSpec.configure do |config|
|
|
18
18
|
min_duration: Buildkite::TestCollector.trace_min_duration,
|
19
19
|
)
|
20
20
|
|
21
|
-
|
22
|
-
|
21
|
+
tags = {}
|
22
|
+
|
23
|
+
# _buildkite prefix reduces chance of collisions in this almost-global (per-fiber) namespace.
|
23
24
|
Thread.current[:_buildkite_tracer] = tracer
|
24
|
-
|
25
|
-
|
26
|
-
#
|
27
|
-
# Having said that, this behavior isn't documented by RSpec.
|
25
|
+
Thread.current[:_buildkite_tags] = tags
|
26
|
+
|
27
|
+
# example.run can raise errors (including from other middleware/hooks) so clean up in `ensure`.
|
28
28
|
begin
|
29
29
|
example.run
|
30
30
|
ensure
|
31
31
|
Thread.current[:_buildkite_tracer] = nil
|
32
|
+
Thread.current[:_buildkite_tags] = nil
|
32
33
|
|
33
34
|
tracer.finalize
|
34
35
|
|
35
|
-
trace = Buildkite::TestCollector::RSpecPlugin::Trace.new(
|
36
|
+
trace = Buildkite::TestCollector::RSpecPlugin::Trace.new(
|
37
|
+
example,
|
38
|
+
history: tracer.history,
|
39
|
+
tags: tags,
|
40
|
+
)
|
41
|
+
|
36
42
|
Buildkite::TestCollector.uploader.traces[example.id] = trace
|
37
43
|
end
|
38
44
|
end
|
@@ -5,6 +5,7 @@ module Buildkite::TestCollector::MinitestPlugin
|
|
5
5
|
attr_accessor :example
|
6
6
|
attr_writer :failure_reason, :failure_expanded
|
7
7
|
attr_reader :history
|
8
|
+
attr_reader :tags
|
8
9
|
|
9
10
|
RESULT_CODES = {
|
10
11
|
'.' => 'passed',
|
@@ -15,9 +16,10 @@ module Buildkite::TestCollector::MinitestPlugin
|
|
15
16
|
|
16
17
|
FILE_PATH_REGEX = /^(.*?\.(rb|feature))/
|
17
18
|
|
18
|
-
def initialize(example, history:)
|
19
|
+
def initialize(example, history:, tags: nil)
|
19
20
|
@example = example
|
20
21
|
@history = history
|
22
|
+
@tags = tags
|
21
23
|
end
|
22
24
|
|
23
25
|
def result
|
@@ -38,6 +40,7 @@ module Buildkite::TestCollector::MinitestPlugin
|
|
38
40
|
failure_reason: failure_reason,
|
39
41
|
failure_expanded: failure_expanded,
|
40
42
|
history: history,
|
43
|
+
tags: tags,
|
41
44
|
).select { |_, value| !value.nil? }
|
42
45
|
end
|
43
46
|
|
@@ -14,18 +14,29 @@ module Buildkite::TestCollector::MinitestPlugin
|
|
14
14
|
min_duration: Buildkite::TestCollector.trace_min_duration,
|
15
15
|
)
|
16
16
|
|
17
|
-
|
18
|
-
|
17
|
+
tags = {}
|
18
|
+
|
19
|
+
# _buildkite prefix reduces chance of collisions in this almost-global (per-fiber) namespace.
|
19
20
|
Thread.current[:_buildkite_tracer] = tracer
|
21
|
+
Thread.current[:_buildkite_tags] = tags
|
20
22
|
end
|
21
23
|
|
22
24
|
def after_teardown
|
23
25
|
tracer = Thread.current[:_buildkite_tracer]
|
26
|
+
tags = Thread.current[:_buildkite_tags]
|
27
|
+
|
28
|
+
Thread.current[:_buildkite_tracer] = nil
|
29
|
+
Thread.current[:_buildkite_tags] = nil
|
30
|
+
|
24
31
|
if !tracer.nil?
|
25
|
-
Thread.current[:_buildkite_tracer] = nil
|
26
32
|
tracer.finalize
|
27
33
|
|
28
|
-
trace = Buildkite::TestCollector::MinitestPlugin::Trace.new(
|
34
|
+
trace = Buildkite::TestCollector::MinitestPlugin::Trace.new(
|
35
|
+
self,
|
36
|
+
history: tracer.history,
|
37
|
+
tags: tags,
|
38
|
+
)
|
39
|
+
|
29
40
|
Buildkite::TestCollector.uploader.traces[trace.source_location] = trace
|
30
41
|
end
|
31
42
|
|
@@ -4,14 +4,16 @@ module Buildkite::TestCollector::RSpecPlugin
|
|
4
4
|
class Trace
|
5
5
|
attr_accessor :example, :failure_reason, :failure_expanded
|
6
6
|
attr_reader :history
|
7
|
+
attr_reader :tags
|
7
8
|
|
8
9
|
FILE_PATH_REGEX = /^(.*?\.(rb|feature))/
|
9
10
|
|
10
|
-
def initialize(example, history:, failure_reason: nil, failure_expanded: [])
|
11
|
+
def initialize(example, history:, failure_reason: nil, failure_expanded: [], tags: nil)
|
11
12
|
@example = example
|
12
13
|
@history = history
|
13
14
|
@failure_reason = failure_reason
|
14
15
|
@failure_expanded = failure_expanded
|
16
|
+
@tags = tags
|
15
17
|
end
|
16
18
|
|
17
19
|
def result
|
@@ -32,6 +34,7 @@ module Buildkite::TestCollector::RSpecPlugin
|
|
32
34
|
failure_reason: failure_reason,
|
33
35
|
failure_expanded: failure_expanded,
|
34
36
|
history: history,
|
37
|
+
tags: tags,
|
35
38
|
).select { |_, value| !value.nil? }
|
36
39
|
end
|
37
40
|
|
@@ -77,6 +77,18 @@ module Buildkite
|
|
77
77
|
tracer&.leave
|
78
78
|
end
|
79
79
|
|
80
|
+
# Set a key=value tag on the current test execution.
|
81
|
+
def self.tag_execution(key, value)
|
82
|
+
tags = Thread.current[:_buildkite_tags]
|
83
|
+
raise "_buildkite_tags not available" unless tags
|
84
|
+
|
85
|
+
unless key.is_a?(String) && value.is_a?(String)
|
86
|
+
raise ArgumentError, "tag key and value expected string"
|
87
|
+
end
|
88
|
+
|
89
|
+
tags[key] = value
|
90
|
+
end
|
91
|
+
|
80
92
|
def self.enable_tracing!
|
81
93
|
return unless self.tracing_enabled
|
82
94
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: buildkite-test_collector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Buildkite
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-02-
|
10
|
+
date: 2025-02-21 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: activesupport
|