buildkite-test_collector 2.2.0 → 2.3.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c3f61975dacef343c33cf6d550fc4dd5d765f02050bd2a8bc86b5e221afa751d
4
- data.tar.gz: 340dc7bce50ef727dfea08a331260824aaa640c9e83b344bc620afbf153fbe1d
3
+ metadata.gz: '09f0da65683acfa44ac43a124494f3c9d5d8e3067abf0b28a3aa979a6413489d'
4
+ data.tar.gz: e7791580735083001493204451c79eae2e58ad5d51250f9c6535ca26bd8b169f
5
5
  SHA512:
6
- metadata.gz: e692ebc6764114d7a70e854c8daf7acd09110ad78736163a2845538451cf5f6b424a709bbccc89007bdccc3e68fac391bb3d9ec041965167c2a709dd6d68ffd5
7
- data.tar.gz: 7cb0d8141ebfa1b43c8bc5ae4de82bccbc3da9cb221566a9a54ca7f54b2eba3908be5fa923dc0d08c688fd41d1941f24e711d747ab7d0ecea44be8658f1a2ca8
6
+ metadata.gz: 3937ba2cfed151fb5c62af03b0a4925d6a4f36be0a95432c39a6f6e5974198e6e9c44fa5f7138086415ffac7b4907f082f067ee33b9bac7cb32a2ccfad50647d
7
+ data.tar.gz: bd956bc8de0375dcc657a7ed5f9a4256f0ba7b81de62dbc61ecb80ec2392eb6e9c57b298122f649659d16010189809a19dc4eb1f62e3c04626eb24917d53090c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v2.3.1
4
+ - Log standard error raised during upload #195 - @nprizal
5
+
6
+ ## v2.3.0
7
+ - Stop sending execution id and safeguard SecureRandom.uuid #192 - @niceking
8
+ - Rescue from StandardError when sending upload request #191 - @niceking
9
+ - Fix nil pointer #188 - @ChrisBr
10
+
3
11
  ## v2.2.0
4
12
  - Gzip payload of request to Upload API #183 - @niceking
5
13
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- buildkite-test_collector (2.2.0)
4
+ buildkite-test_collector (2.3.1)
5
5
  activesupport (>= 4.2)
6
6
 
7
7
  GEM
@@ -14,7 +14,7 @@ GEM
14
14
  tzinfo (~> 2.0)
15
15
  concurrent-ruby (1.2.2)
16
16
  diff-lcs (1.4.4)
17
- i18n (1.12.0)
17
+ i18n (1.13.0)
18
18
  concurrent-ruby (~> 1.0)
19
19
  minitest (5.18.0)
20
20
  rake (13.0.6)
data/README.md CHANGED
@@ -73,6 +73,15 @@ git commit -am "Add Buildkite Test Analytics"
73
73
  git push origin add-buildkite-test-analytics
74
74
  ```
75
75
 
76
+ ### VCR
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 Analytics.
78
+
79
+ ```
80
+ VCR.configure do |c|
81
+ c.ignore_hosts "analytics-api.buildkite.com"
82
+ end
83
+ ```
84
+
76
85
  ## 🗨️ Annotations
77
86
 
78
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:
@@ -21,7 +21,7 @@ class Buildkite::TestCollector::CI
21
21
 
22
22
  {
23
23
  "CI" => nil,
24
- "key" => SecureRandom.uuid,
24
+ "key" => Buildkite::TestCollector::UUID.call,
25
25
  }
26
26
  end
27
27
 
@@ -44,7 +44,7 @@ class Buildkite::TestCollector::CI
44
44
  def generic
45
45
  {
46
46
  "CI" => "generic",
47
- "key" => SecureRandom.uuid,
47
+ "key" => Buildkite::TestCollector::UUID.call,
48
48
  }
49
49
  end
50
50
 
@@ -30,7 +30,7 @@ RSpec.configure do |config|
30
30
 
31
31
  config.after(:suite) do
32
32
  if Buildkite::TestCollector.artifact_path
33
- filename = File.join(Buildkite::TestCollector.artifact_path, "buildkite-test-collector-rspec-#{SecureRandom.uuid}.json.gz")
33
+ filename = File.join(Buildkite::TestCollector.artifact_path, "buildkite-test-collector-rspec-#{Buildkite::TestCollector::UUID.call}.json.gz")
34
34
  data_set = { results: Buildkite::TestCollector.uploader.traces.values.map(&:as_hash) }
35
35
  File.open(filename, "wb") do |f|
36
36
  gz = Zlib::GzipWriter.new(f)
@@ -21,8 +21,10 @@ module Buildkite::TestCollector::MinitestPlugin
21
21
  def report
22
22
  super
23
23
 
24
- Buildkite::TestCollector.session.send_remaining_data
25
- Buildkite::TestCollector.session.close
24
+ if Buildkite::TestCollector.session
25
+ Buildkite::TestCollector.session.send_remaining_data
26
+ Buildkite::TestCollector.session.close
27
+ end
26
28
  end
27
29
  end
28
30
  end
@@ -4,7 +4,7 @@ module Buildkite::TestCollector::MinitestPlugin
4
4
  class Trace
5
5
  attr_accessor :example
6
6
  attr_writer :failure_reason, :failure_expanded
7
- attr_reader :id, :history
7
+ attr_reader :history
8
8
 
9
9
  RESULT_CODES = {
10
10
  '.' => 'passed',
@@ -16,7 +16,6 @@ module Buildkite::TestCollector::MinitestPlugin
16
16
  FILE_PATH_REGEX = /^(.*?\.(rb|feature))/
17
17
 
18
18
  def initialize(example, history:)
19
- @id = SecureRandom.uuid
20
19
  @example = example
21
20
  @history = history
22
21
  end
@@ -31,7 +30,6 @@ module Buildkite::TestCollector::MinitestPlugin
31
30
 
32
31
  def as_hash
33
32
  strip_invalid_utf8_chars(
34
- id: id,
35
33
  scope: example.class.name,
36
34
  name: example.name,
37
35
  location: location,
@@ -3,12 +3,11 @@
3
3
  module Buildkite::TestCollector::RSpecPlugin
4
4
  class Trace
5
5
  attr_accessor :example, :failure_reason, :failure_expanded
6
- attr_reader :id, :history
6
+ attr_reader :history
7
7
 
8
8
  FILE_PATH_REGEX = /^(.*?\.(rb|feature))/
9
9
 
10
10
  def initialize(example, history:, failure_reason: nil, failure_expanded: [])
11
- @id = SecureRandom.uuid
12
11
  @example = example
13
12
  @history = history
14
13
  @failure_reason = failure_reason
@@ -25,7 +24,6 @@ module Buildkite::TestCollector::RSpecPlugin
25
24
 
26
25
  def as_hash
27
26
  strip_invalid_utf8_chars(
28
- id: id,
29
27
  scope: example.example_group.metadata[:full_description],
30
28
  name: example.description,
31
29
  location: example.location,
@@ -24,7 +24,8 @@ module Buildkite::TestCollector
24
24
  Net::OpenTimeout,
25
25
  OpenSSL::SSL::SSLError,
26
26
  OpenSSL::SSL::SSLErrorWaitReadable,
27
- EOFError
27
+ EOFError,
28
+ Errno::ETIMEDOUT
28
29
  ]
29
30
 
30
31
  def self.tracer
@@ -44,6 +45,9 @@ module Buildkite::TestCollector
44
45
  if (upload_attempts += 1) < MAX_UPLOAD_ATTEMPTS
45
46
  retry
46
47
  end
48
+ rescue StandardError => e
49
+ $stderr.puts e
50
+ $stderr.puts "#{Buildkite::TestCollector::NAME} #{Buildkite::TestCollector::VERSION} experienced an error when sending your data, you may be missing some executions for this run."
47
51
  end
48
52
  end
49
53
  end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "securerandom"
4
+
5
+ class Buildkite::TestCollector::UUID
6
+ GET_UUID = SecureRandom.method(:uuid)
7
+ private_constant :GET_UUID
8
+
9
+ def self.call
10
+ GET_UUID.call
11
+ end
12
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Buildkite
4
4
  module TestCollector
5
- VERSION = "2.2.0"
5
+ VERSION = "2.3.1"
6
6
  NAME = "buildkite-test_collector"
7
7
  end
8
8
  end
@@ -11,7 +11,6 @@ require "net/http"
11
11
  require "time"
12
12
  require "timeout"
13
13
  require "tmpdir"
14
- require "securerandom"
15
14
 
16
15
  require "active_support/core_ext/object/blank"
17
16
  require "active_support/core_ext/hash/indifferent_access"
@@ -26,6 +25,7 @@ require_relative "test_collector/network"
26
25
  require_relative "test_collector/object"
27
26
  require_relative "test_collector/tracer"
28
27
  require_relative "test_collector/session"
28
+ require_relative "test_collector/uuid"
29
29
 
30
30
  module Buildkite
31
31
  module TestCollector
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.2.0
4
+ version: 2.3.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: 2023-04-20 00:00:00.000000000 Z
11
+ date: 2023-06-02 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: []
@@ -90,6 +90,7 @@ files:
90
90
  - lib/buildkite/test_collector/session.rb
91
91
  - lib/buildkite/test_collector/tracer.rb
92
92
  - lib/buildkite/test_collector/uploader.rb
93
+ - lib/buildkite/test_collector/uuid.rb
93
94
  - lib/buildkite/test_collector/version.rb
94
95
  - lib/minitest/buildkite_collector_plugin.rb
95
96
  homepage: https://github.com/buildkite/test-collector-ruby
@@ -98,7 +99,7 @@ licenses:
98
99
  metadata:
99
100
  homepage_uri: https://github.com/buildkite/test-collector-ruby
100
101
  source_code_uri: https://github.com/buildkite/test-collector-ruby
101
- post_install_message:
102
+ post_install_message:
102
103
  rdoc_options: []
103
104
  require_paths:
104
105
  - lib
@@ -113,8 +114,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
114
  - !ruby/object:Gem::Version
114
115
  version: '0'
115
116
  requirements: []
116
- rubygems_version: 3.1.6
117
- signing_key:
117
+ rubygems_version: 3.3.26
118
+ signing_key:
118
119
  specification_version: 4
119
120
  summary: Track test executions and report to Buildkite Test Analytics
120
121
  test_files: []