buildkite-test_collector 2.8.0 → 2.10.0
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/.rspec +1 -1
- data/CHANGELOG.md +10 -0
- data/Gemfile.lock +35 -3
- data/README.md +14 -31
- data/buildkite-test_collector.gemspec +5 -0
- data/buildkite.yaml +24 -0
- data/cucumber.yml +1 -0
- data/lib/buildkite/test_collector/cucumber_plugin/trace.rb +65 -0
- data/lib/buildkite/test_collector/error.rb +1 -0
- data/lib/buildkite/test_collector/library_hooks/cucumber.rb +74 -0
- 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 +16 -0
- metadata +20 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 497ced90aac96227b8e4d2fc9ad1685eb4f554742b597568efa7e0f8bb1a0879
|
4
|
+
data.tar.gz: 709f96eaa2af7732b73c2838862bb98f350e9f8cda5aa7e209b00e96e00ab127
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d559f0b297b7402a3f57203ea6226ee861b81b72682896c8a49d13ecaa036ca6ba6b3cf6b22e5693d0de8133500b4dd0b84a10db171d17c93237a0d2873e2704
|
7
|
+
data.tar.gz: e6d23fe2be97f26f4c1f753585340220d46ea926ed490878a4b02627b3488da57a859a1e3948796e84055dce99d01380e60ca77e96c33970c03ba38683259b7c
|
data/.rspec
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## v2.10.0
|
4
|
+
|
5
|
+
* Add support for Cucumber
|
6
|
+
|
7
|
+
## v2.9.0
|
8
|
+
|
9
|
+
* `Buildkite::TestCollector.tag_execution(key, value)` by @pda in https://github.com/buildkite/test-collector-ruby/pull/240
|
10
|
+
|
11
|
+
**Full Changelog**: https://github.com/buildkite/test-collector-ruby/compare/v2.8.0...v2.9.0
|
12
|
+
|
3
13
|
## v2.8.0
|
4
14
|
|
5
15
|
* Buildkite::TestCollector.tags: specify tags for all executions by @pda in https://github.com/buildkite/test-collector-ruby/pull/235
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
buildkite-test_collector (2.
|
4
|
+
buildkite-test_collector (2.10.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -22,14 +22,43 @@ GEM
|
|
22
22
|
base64 (0.2.0)
|
23
23
|
benchmark (0.4.0)
|
24
24
|
bigdecimal (3.1.9)
|
25
|
+
builder (3.3.0)
|
25
26
|
concurrent-ruby (1.3.5)
|
26
27
|
connection_pool (2.5.0)
|
27
|
-
|
28
|
+
cucumber (9.2.1)
|
29
|
+
builder (~> 3.2)
|
30
|
+
cucumber-ci-environment (> 9, < 11)
|
31
|
+
cucumber-core (> 13, < 14)
|
32
|
+
cucumber-cucumber-expressions (~> 17.0)
|
33
|
+
cucumber-gherkin (> 24, < 28)
|
34
|
+
cucumber-html-formatter (> 20.3, < 22)
|
35
|
+
cucumber-messages (> 19, < 25)
|
36
|
+
diff-lcs (~> 1.5)
|
37
|
+
mini_mime (~> 1.1)
|
38
|
+
multi_test (~> 1.1)
|
39
|
+
sys-uname (~> 1.2)
|
40
|
+
cucumber-ci-environment (10.0.1)
|
41
|
+
cucumber-core (13.0.3)
|
42
|
+
cucumber-gherkin (>= 27, < 28)
|
43
|
+
cucumber-messages (>= 20, < 23)
|
44
|
+
cucumber-tag-expressions (> 5, < 7)
|
45
|
+
cucumber-cucumber-expressions (17.1.0)
|
46
|
+
bigdecimal
|
47
|
+
cucumber-gherkin (27.0.0)
|
48
|
+
cucumber-messages (>= 19.1.4, < 23)
|
49
|
+
cucumber-html-formatter (21.9.0)
|
50
|
+
cucumber-messages (> 19, < 28)
|
51
|
+
cucumber-messages (22.0.0)
|
52
|
+
cucumber-tag-expressions (6.1.2)
|
53
|
+
diff-lcs (1.6.2)
|
28
54
|
drb (2.2.1)
|
55
|
+
ffi (1.17.2)
|
29
56
|
i18n (1.14.7)
|
30
57
|
concurrent-ruby (~> 1.0)
|
31
|
-
logger (1.
|
58
|
+
logger (1.7.0)
|
59
|
+
mini_mime (1.1.5)
|
32
60
|
minitest (5.25.4)
|
61
|
+
multi_test (1.1.0)
|
33
62
|
rake (13.2.1)
|
34
63
|
rspec (3.13.0)
|
35
64
|
rspec-core (~> 3.13.0)
|
@@ -45,6 +74,8 @@ GEM
|
|
45
74
|
rspec-support (~> 3.13.0)
|
46
75
|
rspec-support (3.13.2)
|
47
76
|
securerandom (0.4.1)
|
77
|
+
sys-uname (1.3.1)
|
78
|
+
ffi (~> 1.1)
|
48
79
|
tzinfo (2.0.6)
|
49
80
|
concurrent-ruby (~> 1.0)
|
50
81
|
uri (1.0.2)
|
@@ -55,6 +86,7 @@ PLATFORMS
|
|
55
86
|
DEPENDENCIES
|
56
87
|
activesupport (>= 4.2)
|
57
88
|
buildkite-test_collector!
|
89
|
+
cucumber (~> 9.0)
|
58
90
|
rake (~> 13.0)
|
59
91
|
rspec (~> 3.0)
|
60
92
|
rspec-core (~> 3.10)
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@ Versions prior to 2.1.x are unsupported and will not work after mid-2023. Please
|
|
5
5
|
|
6
6
|
Official [Buildkite Test Engine](https://buildkite.com/platform/test-engine) collectors for Ruby test frameworks ✨
|
7
7
|
|
8
|
-
⚒ **Supported test frameworks:** RSpec, Minitest, and [more coming soon](https://github.com/buildkite/test-collector-ruby/issues?q=is%3Aissue+is%3Aopen+label%3A%22test+frameworks%22).
|
8
|
+
⚒ **Supported test frameworks:** RSpec, Minitest, Cucumber, and [more coming soon](https://github.com/buildkite/test-collector-ruby/issues?q=is%3Aissue+is%3Aopen+label%3A%22test+frameworks%22).
|
9
9
|
|
10
10
|
📦 **Supported CI systems:** Buildkite, GitHub Actions, CircleCI, Codeship, and others via the `BUILDKITE_ANALYTICS_*` environment variables.
|
11
11
|
|
@@ -63,47 +63,30 @@ Run your tests locally:
|
|
63
63
|
BUILDKITE_ANALYTICS_TOKEN=xyz rake
|
64
64
|
```
|
65
65
|
|
66
|
-
|
67
|
-
|
68
|
-
Add the `BUILDKITE_ANALYTICS_TOKEN` secret to your CI, push your changes to a branch, and open a pull request 🎉
|
69
|
-
|
70
|
-
```bash
|
71
|
-
git checkout -b add-buildkite-test-engine
|
72
|
-
git commit -am "Add Buildkite Test Engine"
|
73
|
-
git push origin add-buildkite-test-engine
|
74
|
-
```
|
66
|
+
#### Cucumber
|
75
67
|
|
76
|
-
|
77
|
-
If your test suites use [VCR](https://github.com/vcr/vcr) to stub network requests, you'll need to modify the config to allow actual network requests to Test Engine.
|
68
|
+
Add the following code to your Cucumber setup file:
|
78
69
|
|
79
|
-
```
|
80
|
-
|
81
|
-
|
82
|
-
|
70
|
+
```ruby
|
71
|
+
# features/support/env.rb
|
72
|
+
require 'buildkite/test_collector'
|
73
|
+
Buildkite::TestCollector.configure(hook: :cucumber)
|
83
74
|
```
|
84
75
|
|
85
|
-
|
86
|
-
|
87
|
-
This gem allows adding custom annotations to the span data sent to Buildkite using the [.annotate](https://github.com/buildkite/test-collector-ruby/blob/d9fe11341e4aa470e766febee38124b644572360/lib/buildkite/test_collector.rb#L64) method. For example:
|
76
|
+
Run your tests locally:
|
88
77
|
|
89
|
-
```
|
90
|
-
|
78
|
+
```shell
|
79
|
+
BUILDKITE_ANALYTICS_TOKEN=xyz cucumber
|
91
80
|
```
|
92
81
|
|
93
|
-
|
94
|
-
|
95
|
-
## 🏷️ Tagging duplicate test executions with a prefix/suffix
|
82
|
+
### Step 3
|
96
83
|
|
97
|
-
|
84
|
+
Add the `BUILDKITE_ANALYTICS_TOKEN` secret to your CI, push your changes to a branch, and open a pull request 🎉
|
98
85
|
|
99
|
-
```
|
100
|
-
BUILDKITE_ANALYTICS_EXECUTION_NAME_PREFIX
|
101
|
-
BUILDKITE_ANALYTICS_EXECUTION_NAME_SUFFIX
|
102
|
-
```
|
103
86
|
|
104
|
-
##
|
87
|
+
## More information
|
105
88
|
|
106
|
-
|
89
|
+
For more use cases such as custom tags, annotations, and span tracking, please visit our [official Ruby collector documentation](https://buildkite.com/docs/test-engine/ruby-collectors) for details.
|
107
90
|
|
108
91
|
## ⚒ Developing
|
109
92
|
|
@@ -27,4 +27,9 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_development_dependency "activesupport", ">= 4.2"
|
28
28
|
spec.add_development_dependency "rspec-core", '~> 3.10'
|
29
29
|
spec.add_development_dependency "rspec-expectations", '~> 3.10'
|
30
|
+
|
31
|
+
# When running the legacy CI builds against versions of Ruby pre 2.7 we cannot include cucumber 9 as it's not supported.
|
32
|
+
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.7')
|
33
|
+
spec.add_development_dependency "cucumber", '~> 9.0'
|
34
|
+
end
|
30
35
|
end
|
data/buildkite.yaml
CHANGED
@@ -7,7 +7,20 @@ steps:
|
|
7
7
|
- "gem install bundler:2.3.25"
|
8
8
|
- "bundle"
|
9
9
|
- "bundle exec rake"
|
10
|
+
- "bundle exec cucumber"
|
10
11
|
plugins:
|
12
|
+
- aws-assume-role-with-web-identity#v1.2.0:
|
13
|
+
role-arn: "${OIDC_ASSUME_ROLE_ARN:-arn:aws:iam::445615400570:role/pipeline-buildkite-test-collector-ruby-build}"
|
14
|
+
session-tags:
|
15
|
+
- organization_slug
|
16
|
+
- organization_id
|
17
|
+
- pipeline_slug
|
18
|
+
- build_branch
|
19
|
+
|
20
|
+
- ecr#v2.9.0:
|
21
|
+
login: true
|
22
|
+
account_ids: "public.ecr.aws"
|
23
|
+
region: "us-east-1"
|
11
24
|
- docker#v3.7.0:
|
12
25
|
image: "public.ecr.aws/docker/library/ruby:{{matrix}}"
|
13
26
|
matrix:
|
@@ -27,6 +40,17 @@ steps:
|
|
27
40
|
- "bundle"
|
28
41
|
- "bundle exec rake"
|
29
42
|
plugins:
|
43
|
+
- aws-assume-role-with-web-identity#v1.2.0:
|
44
|
+
role-arn: "${OIDC_ASSUME_ROLE_ARN:-arn:aws:iam::445615400570:role/pipeline-buildkite-test-collector-ruby-build}"
|
45
|
+
session-tags:
|
46
|
+
- organization_slug
|
47
|
+
- organization_id
|
48
|
+
- pipeline_slug
|
49
|
+
- build_branch
|
50
|
+
- ecr#v2.9.0:
|
51
|
+
login: true
|
52
|
+
account_ids: "public.ecr.aws"
|
53
|
+
region: "us-east-1"
|
30
54
|
- docker#v3.7.0:
|
31
55
|
# Images for older Ruby versions aren't available on AWS ECR
|
32
56
|
# so fall back to Docker Hub
|
data/cucumber.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
default: --publish-quiet
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Buildkite::TestCollector::CucumberPlugin
|
4
|
+
class Trace
|
5
|
+
attr_accessor :scenario, :failure_reason, :failure_expanded
|
6
|
+
attr_reader :history, :tags
|
7
|
+
|
8
|
+
FILE_PATH_REGEX = /^(.*?\.(rb|feature))/
|
9
|
+
|
10
|
+
def initialize(scenario, history:, failure_reason: nil, failure_expanded: [], tags: nil)
|
11
|
+
@scenario = scenario
|
12
|
+
@history = history
|
13
|
+
@failure_reason = failure_reason
|
14
|
+
@failure_expanded = failure_expanded
|
15
|
+
@tags = tags
|
16
|
+
end
|
17
|
+
|
18
|
+
def result
|
19
|
+
if scenario.passed?
|
20
|
+
'passed'
|
21
|
+
elsif scenario.failed?
|
22
|
+
'failed'
|
23
|
+
else
|
24
|
+
'skipped'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def as_hash
|
29
|
+
parser = Gherkin::Parser.new
|
30
|
+
document = parser.parse(File.read(file_name))
|
31
|
+
feature_name = document.feature.name
|
32
|
+
|
33
|
+
strip_invalid_utf8_chars(
|
34
|
+
scope: feature_name,
|
35
|
+
name: scenario.name,
|
36
|
+
location: scenario.location&.to_s,
|
37
|
+
file_name: file_name,
|
38
|
+
result: result,
|
39
|
+
failure_reason: failure_reason,
|
40
|
+
failure_expanded: failure_expanded,
|
41
|
+
history: history,
|
42
|
+
tags: tags,
|
43
|
+
).select { |_, v| !v.nil? }
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def file_name
|
49
|
+
@file_name ||= scenario.location&.to_s[FILE_PATH_REGEX]
|
50
|
+
end
|
51
|
+
|
52
|
+
def strip_invalid_utf8_chars(object)
|
53
|
+
case object
|
54
|
+
when Hash
|
55
|
+
object.transform_values { |v| strip_invalid_utf8_chars(v) }
|
56
|
+
when Array
|
57
|
+
object.map { |v| strip_invalid_utf8_chars(v) }
|
58
|
+
when String
|
59
|
+
object.encode('UTF-8', invalid: :replace, undef: :replace)
|
60
|
+
else
|
61
|
+
object
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'cucumber'
|
4
|
+
|
5
|
+
require_relative '../cucumber_plugin/trace'
|
6
|
+
|
7
|
+
# Use Buildkite's uploader for Cucumber as well
|
8
|
+
Buildkite::TestCollector.uploader = Buildkite::TestCollector::Uploader
|
9
|
+
|
10
|
+
# -------------------------------------------------
|
11
|
+
# Hooks
|
12
|
+
# -------------------------------------------------
|
13
|
+
|
14
|
+
Before do |scenario|
|
15
|
+
tracer = Buildkite::TestCollector::Tracer.new(
|
16
|
+
min_duration: Buildkite::TestCollector.trace_min_duration,
|
17
|
+
)
|
18
|
+
|
19
|
+
tags = {}
|
20
|
+
|
21
|
+
# _buildkite prefix reduces chance of collisions in this almost-global (per-fiber) namespace.
|
22
|
+
Thread.current[:_buildkite_tracer] = tracer
|
23
|
+
Thread.current[:_buildkite_tags] = tags
|
24
|
+
end
|
25
|
+
|
26
|
+
After do |scenario|
|
27
|
+
tracer = Thread.current[:_buildkite_tracer]
|
28
|
+
tags = Thread.current[:_buildkite_tags]
|
29
|
+
|
30
|
+
Thread.current[:_buildkite_tracer] = nil
|
31
|
+
Thread.current[:_buildkite_tags] = nil
|
32
|
+
|
33
|
+
if tracer
|
34
|
+
tracer.finalize
|
35
|
+
|
36
|
+
failure_reason = nil
|
37
|
+
failure_expanded = []
|
38
|
+
|
39
|
+
if scenario.failed?
|
40
|
+
exception = scenario.exception
|
41
|
+
if exception
|
42
|
+
failure_reason = exception.message
|
43
|
+
failure_expanded << {
|
44
|
+
backtrace: exception.backtrace,
|
45
|
+
}
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
trace = Buildkite::TestCollector::CucumberPlugin::Trace.new(
|
50
|
+
scenario,
|
51
|
+
history: tracer.history,
|
52
|
+
failure_reason: failure_reason,
|
53
|
+
failure_expanded: failure_expanded,
|
54
|
+
tags: tags,
|
55
|
+
)
|
56
|
+
|
57
|
+
Buildkite::TestCollector.uploader.traces[scenario.location.to_s] = trace
|
58
|
+
|
59
|
+
if Buildkite::TestCollector.session
|
60
|
+
Buildkite::TestCollector.session.add_example_to_send_queue(scenario.location.to_s)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
at_exit do
|
66
|
+
if Buildkite::TestCollector.session
|
67
|
+
Buildkite::TestCollector.session.send_remaining_data
|
68
|
+
Buildkite::TestCollector.session.close
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# Initialise shared tracing & session behaviour once hooks file is loaded.
|
73
|
+
Buildkite::TestCollector.enable_tracing!
|
74
|
+
Buildkite::TestCollector.session = Buildkite::TestCollector::Session.new
|
@@ -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
|
|
@@ -43,6 +43,10 @@ module Buildkite
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def self.configure(hook:, token: nil, url: nil, tracing_enabled: true, artifact_path: nil, env: {}, tags: {})
|
46
|
+
if hook.to_sym == :cucumber && Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.7')
|
47
|
+
raise UnsupportedFrameworkError.new("Cucumber is only supported in versions of Ruby >= 2.7")
|
48
|
+
end
|
49
|
+
|
46
50
|
self.api_token = (token || ENV["BUILDKITE_ANALYTICS_TOKEN"])&.strip
|
47
51
|
self.url = url || DEFAULT_URL
|
48
52
|
self.tracing_enabled = tracing_enabled
|
@@ -77,6 +81,18 @@ module Buildkite
|
|
77
81
|
tracer&.leave
|
78
82
|
end
|
79
83
|
|
84
|
+
# Set a key=value tag on the current test execution.
|
85
|
+
def self.tag_execution(key, value)
|
86
|
+
tags = Thread.current[:_buildkite_tags]
|
87
|
+
raise "_buildkite_tags not available" unless tags
|
88
|
+
|
89
|
+
unless key.is_a?(String) && value.is_a?(String)
|
90
|
+
raise ArgumentError, "tag key and value expected string"
|
91
|
+
end
|
92
|
+
|
93
|
+
tags[key] = value
|
94
|
+
end
|
95
|
+
|
80
96
|
def self.enable_tracing!
|
81
97
|
return unless self.tracing_enabled
|
82
98
|
|
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.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Buildkite
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: activesupport
|
@@ -51,6 +51,20 @@ dependencies:
|
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: '3.10'
|
54
|
+
- !ruby/object:Gem::Dependency
|
55
|
+
name: cucumber
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '9.0'
|
61
|
+
type: :development
|
62
|
+
prerelease: false
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '9.0'
|
54
68
|
email:
|
55
69
|
- support+analytics@buildkite.com
|
56
70
|
executables: []
|
@@ -74,10 +88,13 @@ files:
|
|
74
88
|
- bin/setup
|
75
89
|
- buildkite-test_collector.gemspec
|
76
90
|
- buildkite.yaml
|
91
|
+
- cucumber.yml
|
77
92
|
- lib/buildkite/test_collector.rb
|
78
93
|
- lib/buildkite/test_collector/ci.rb
|
94
|
+
- lib/buildkite/test_collector/cucumber_plugin/trace.rb
|
79
95
|
- lib/buildkite/test_collector/error.rb
|
80
96
|
- lib/buildkite/test_collector/http_client.rb
|
97
|
+
- lib/buildkite/test_collector/library_hooks/cucumber.rb
|
81
98
|
- lib/buildkite/test_collector/library_hooks/minitest.rb
|
82
99
|
- lib/buildkite/test_collector/library_hooks/rspec.rb
|
83
100
|
- lib/buildkite/test_collector/minitest_plugin.rb
|
@@ -113,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
130
|
- !ruby/object:Gem::Version
|
114
131
|
version: '0'
|
115
132
|
requirements: []
|
116
|
-
rubygems_version: 3.6.
|
133
|
+
rubygems_version: 3.6.7
|
117
134
|
specification_version: 4
|
118
135
|
summary: Track test executions and report to Buildkite Test Engine
|
119
136
|
test_files: []
|