buildkite-test_collector 2.5.0 → 2.6.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 +8 -0
- data/Gemfile.lock +1 -1
- data/buildkite.yaml +5 -10
- data/lib/buildkite/test_collector/ci.rb +1 -0
- data/lib/buildkite/test_collector/library_hooks/rspec.rb +17 -8
- data/lib/buildkite/test_collector/minitest_plugin.rb +5 -1
- data/lib/buildkite/test_collector/tracer.rb +17 -3
- data/lib/buildkite/test_collector/version.rb +1 -1
- data/lib/buildkite/test_collector.rb +7 -0
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2bb798155684d3e4703de75ea06ccaf67b4f6d1b26c98459e621b34dea157e54
|
4
|
+
data.tar.gz: 6eb653f87c490762cadef81b202cb5f77d900b9a628ca245fd9718307e506dd5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2e371578afd8e21a3736b86c5158ebc72e57f61dd771a3365ae932e16d2b0b5add98e139ffc2cfd1ac0b54b6ea08a664f1ebc4a3082e1e07ef10b5ea318fad9
|
7
|
+
data.tar.gz: 817afafdd348cb3f2e4b8dd0b720a1afc6e988094bb872b1306a958eea1c9432abba0edcbbba94b920df6d415115bb60e5e55d9ccd70772d9ac71e88b0e13646
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## v2.6.1
|
4
|
+
|
5
|
+
- Fix missing failed examples if rspec hooks fail #221 - @zhming0
|
6
|
+
|
7
|
+
## v2.6.0
|
8
|
+
|
9
|
+
- Trace spans can be filtered by minimum duration #215 - @pda
|
10
|
+
|
3
11
|
## v2.5.0
|
4
12
|
|
5
13
|
- Remove ActiveSupport as a primary dependancy #212 - @pat
|
data/Gemfile.lock
CHANGED
data/buildkite.yaml
CHANGED
@@ -1,22 +1,17 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
command:
|
4
|
-
- "bundle"
|
5
|
-
- "bundle exec rake"
|
6
|
-
plugins:
|
7
|
-
- docker#v3.7.0:
|
8
|
-
image: "445615400570.dkr.ecr.us-east-1.amazonaws.com/ecr-public/docker/library/ruby:3.3-rc"
|
9
|
-
soft_fail: true
|
1
|
+
agents:
|
2
|
+
queue: hosted
|
10
3
|
|
4
|
+
steps:
|
11
5
|
- label: ":rspec: Tests :ruby: {{matrix}}"
|
12
6
|
command:
|
13
7
|
- "bundle"
|
14
8
|
- "bundle exec rake"
|
15
9
|
plugins:
|
16
10
|
- docker#v3.7.0:
|
17
|
-
image: "
|
11
|
+
image: "public.ecr.aws/docker/library/ruby:{{matrix}}"
|
18
12
|
matrix:
|
19
13
|
- "latest"
|
14
|
+
- "3.3"
|
20
15
|
- "3.2"
|
21
16
|
- "3.1"
|
22
17
|
- "3.0"
|
@@ -40,6 +40,7 @@ class Buildkite::TestCollector::CI
|
|
40
40
|
"language_version" => RUBY_VERSION,
|
41
41
|
"version" => Buildkite::TestCollector::VERSION,
|
42
42
|
"collector" => "ruby-#{Buildkite::TestCollector::NAME}",
|
43
|
+
"trace_min_duration" => Buildkite::TestCollector.trace_min_duration&.to_s,
|
43
44
|
}.select { |_, value| !value.nil? }
|
44
45
|
end
|
45
46
|
|
@@ -16,18 +16,27 @@ RSpec.configure do |config|
|
|
16
16
|
end
|
17
17
|
|
18
18
|
config.around(:each) do |example|
|
19
|
-
tracer = Buildkite::TestCollector::Tracer.new
|
19
|
+
tracer = Buildkite::TestCollector::Tracer.new(
|
20
|
+
min_duration: Buildkite::TestCollector.trace_min_duration,
|
21
|
+
)
|
20
22
|
|
21
23
|
# The _buildkite prefix here is added as a safeguard against name collisions
|
22
24
|
# as we are in the main thread
|
23
25
|
Thread.current[:_buildkite_tracer] = tracer
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
26
|
+
# It's important to use begin/ensure here, because otherwise if other hooks fail,
|
27
|
+
# the cleanup code won't run, meaning we will miss some data.
|
28
|
+
#
|
29
|
+
# Having said that, this behavior isn't documented by RSpec.
|
30
|
+
begin
|
31
|
+
example.run
|
32
|
+
ensure
|
33
|
+
Thread.current[:_buildkite_tracer] = nil
|
34
|
+
|
35
|
+
tracer.finalize
|
36
|
+
|
37
|
+
trace = Buildkite::TestCollector::RSpecPlugin::Trace.new(example, history: tracer.history)
|
38
|
+
Buildkite::TestCollector.uploader.traces[example.id] = trace
|
39
|
+
end
|
31
40
|
end
|
32
41
|
|
33
42
|
config.after(:suite) do
|
@@ -9,7 +9,11 @@ require_relative "minitest_plugin/trace"
|
|
9
9
|
module Buildkite::TestCollector::MinitestPlugin
|
10
10
|
def before_setup
|
11
11
|
super
|
12
|
-
|
12
|
+
|
13
|
+
tracer = Buildkite::TestCollector::Tracer.new(
|
14
|
+
min_duration: Buildkite::TestCollector.trace_min_duration,
|
15
|
+
)
|
16
|
+
|
13
17
|
# The _buildkite prefix here is added as a safeguard against name collisions
|
14
18
|
# as we are in the main thread
|
15
19
|
Thread.current[:_buildkite_tracer] = tracer
|
@@ -35,21 +35,30 @@ module Buildkite::TestCollector
|
|
35
35
|
@children = []
|
36
36
|
end
|
37
37
|
|
38
|
+
def duration
|
39
|
+
raise IncompleteSpan if end_at.nil?
|
40
|
+
|
41
|
+
end_at - start_at
|
42
|
+
end
|
43
|
+
|
38
44
|
def as_hash
|
39
45
|
{
|
40
46
|
section: section,
|
41
47
|
start_at: start_at,
|
42
48
|
end_at: end_at,
|
43
|
-
duration:
|
49
|
+
duration: duration,
|
44
50
|
detail: detail,
|
45
51
|
children: children.map(&:as_hash),
|
46
52
|
}
|
47
53
|
end
|
54
|
+
|
55
|
+
class IncompleteSpan < StandardError; end
|
48
56
|
end
|
49
57
|
|
50
|
-
def initialize
|
58
|
+
def initialize(min_duration: nil)
|
51
59
|
@top = Span.new(:top, MonotonicTime.call, nil, {})
|
52
60
|
@stack = [@top]
|
61
|
+
@min_duration = min_duration
|
53
62
|
end
|
54
63
|
|
55
64
|
def enter(section, **detail)
|
@@ -60,11 +69,16 @@ module Buildkite::TestCollector
|
|
60
69
|
|
61
70
|
def leave
|
62
71
|
current_span.end_at = MonotonicTime.call
|
72
|
+
duration = current_span.duration
|
63
73
|
@stack.pop
|
74
|
+
current_span.children.pop if @min_duration && duration < @min_duration
|
75
|
+
nil # avoid ambiguous return type/value
|
64
76
|
end
|
65
77
|
|
66
78
|
def backfill(section, duration, **detail)
|
67
|
-
|
79
|
+
return if @min_duration && duration < @min_duration
|
80
|
+
now = MonotonicTime.call
|
81
|
+
new_entry = Span.new(section, now - duration, now, detail)
|
68
82
|
current_span.children << new_entry
|
69
83
|
end
|
70
84
|
|
@@ -38,6 +38,7 @@ module Buildkite
|
|
38
38
|
attr_accessor :artifact_path
|
39
39
|
attr_accessor :env
|
40
40
|
attr_accessor :batch_size
|
41
|
+
attr_accessor :trace_min_duration
|
41
42
|
end
|
42
43
|
|
43
44
|
def self.configure(hook:, token: nil, url: nil, tracing_enabled: true, artifact_path: nil, env: {})
|
@@ -47,6 +48,12 @@ module Buildkite
|
|
47
48
|
self.artifact_path = artifact_path
|
48
49
|
self.env = env
|
49
50
|
self.batch_size = ENV.fetch("BUILDKITE_ANALYTICS_UPLOAD_BATCH_SIZE") { DEFAULT_UPLOAD_BATCH_SIZE }.to_i
|
51
|
+
|
52
|
+
trace_min_ms_string = ENV["BUILDKITE_ANALYTICS_TRACE_MIN_MS"]
|
53
|
+
self.trace_min_duration = if trace_min_ms_string && !trace_min_ms_string.empty?
|
54
|
+
Float(trace_min_ms_string) / 1000
|
55
|
+
end
|
56
|
+
|
50
57
|
self.hook_into(hook)
|
51
58
|
end
|
52
59
|
|
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: 2.
|
4
|
+
version: 2.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Buildkite
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -52,7 +52,7 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.10'
|
55
|
-
description:
|
55
|
+
description:
|
56
56
|
email:
|
57
57
|
- support+analytics@buildkite.com
|
58
58
|
executables: []
|
@@ -100,7 +100,7 @@ licenses:
|
|
100
100
|
metadata:
|
101
101
|
homepage_uri: https://github.com/buildkite/test-collector-ruby
|
102
102
|
source_code_uri: https://github.com/buildkite/test-collector-ruby
|
103
|
-
post_install_message:
|
103
|
+
post_install_message:
|
104
104
|
rdoc_options: []
|
105
105
|
require_paths:
|
106
106
|
- lib
|
@@ -115,8 +115,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: '0'
|
117
117
|
requirements: []
|
118
|
-
rubygems_version: 3.
|
119
|
-
signing_key:
|
118
|
+
rubygems_version: 3.5.11
|
119
|
+
signing_key:
|
120
120
|
specification_version: 4
|
121
121
|
summary: Track test executions and report to Buildkite Test Analytics
|
122
122
|
test_files: []
|