buildkite-test_collector 2.2.0 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c3f61975dacef343c33cf6d550fc4dd5d765f02050bd2a8bc86b5e221afa751d
4
- data.tar.gz: 340dc7bce50ef727dfea08a331260824aaa640c9e83b344bc620afbf153fbe1d
3
+ metadata.gz: cecd9e001e4e3ead60507d46635e48fbe2468c183e215896ae4c92e69d207aee
4
+ data.tar.gz: da88dde37e16f1ef279f05f84434fdefe1edc8488e864b669cba0741cc0799ca
5
5
  SHA512:
6
- metadata.gz: e692ebc6764114d7a70e854c8daf7acd09110ad78736163a2845538451cf5f6b424a709bbccc89007bdccc3e68fac391bb3d9ec041965167c2a709dd6d68ffd5
7
- data.tar.gz: 7cb0d8141ebfa1b43c8bc5ae4de82bccbc3da9cb221566a9a54ca7f54b2eba3908be5fa923dc0d08c688fd41d1941f24e711d747ab7d0ecea44be8658f1a2ca8
6
+ metadata.gz: 7d8a965f5a1897a0ddce0ac3a03a527fbfb8d2683ce9555961ef1ba597742e7070cdd187d48f97b8e3111769e837eca69e1b65b52708515b7c87357811bc2c8f
7
+ data.tar.gz: 00caaf80206b97b39d4f4f0e67c15e1b8b77ee5f7df85f74b4a569bff3cb0ec1e4f2a248eda5c0d302277e0fe44421c52a32d65e114d162334971af9fad03e75
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v2.3.0
4
+ - Stop sending execution id and safeguard SecureRandom.uuid #192 - @niceking
5
+ - Rescue from StandardError when sending upload request #191 - @niceking
6
+ - Fix nil pointer #188 - @ChrisBr
7
+
3
8
  ## v2.2.0
4
9
  - Gzip payload of request to Upload API #183 - @niceking
5
10
 
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.0)
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)
@@ -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,8 @@ 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 "#{Buildkite::TestCollector::NAME} #{Buildkite::TestCollector::VERSION} experienced an error when sending your data, you may be missing some executions for this run."
47
50
  end
48
51
  end
49
52
  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.0"
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.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Buildkite
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-20 00:00:00.000000000 Z
11
+ date: 2023-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -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