buildkite-test_collector 1.0.0 → 1.1.1

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: 8e6c042c033ec5dce4350b7bc365b7367d2b02d188b661ceffeab42ac3b44a93
4
- data.tar.gz: b4a9669cbc466980b6a9f7cf4c971f049c799ea2846013165eb53bf7c153b75b
3
+ metadata.gz: 96fb0d0c08ff10d420388b2438ae199c7fbf72878d1fa5631c68b27e70f11cac
4
+ data.tar.gz: 78846d669900e535d1e03bd7494611dd124f2c1bae59471ad41b5b0d9f1efb1b
5
5
  SHA512:
6
- metadata.gz: e81965dc948812b4ea7a9045bba5db5cdc6a3a634e5b92b201eaf3636c09ce473159d4a664d13575730620d1fa4994814b0515e503cb2a4d4f9c4b41a0559428
7
- data.tar.gz: 4518c2d5dfa75d3e22177341b43a1ff85e15e329257844b9c6866dc787d1226558bedaa675e3659a31f44c7a4cb9213bd9b77ec622a71586b95d07f3052580a9
6
+ metadata.gz: c7151f06cf10d7aeb296b9d8c9294f9cdab0b07fc01112176cdc28ad55f7b65d4aa51fcc21dfd179eb58bc6c69592583f58335dece7f3b46ac1e2ba7718da369
7
+ data.tar.gz: cb1157c4a4cfaa719d852f2ac271bd09bbd25a461b4f6a9c002063d7461e3bb06e8107342cceb77dada1cda8090c3643aa3e2827aac7355fea90b51bbae4f7f0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v1.1.1
4
+
5
+ - Strip CR/LF from token input #127 - @gchan
6
+ - Allow specify run name prefix and suffix #130 - @juanitofatas
7
+ - Improve Minitest support by using after_teardown #131 - @davidstosik
8
+ - Avoid breaking test suite stubs `Process.clock_gettime` #132 - @juanitofatas (thanks @ChrisBR)
9
+
10
+ ## v1.1.0
11
+
12
+ - Remove an internal debugging change #115 — @juanitofatas
13
+ - Remove warnings #116 - @juanitofatas
14
+ - Fix old gem name still in debugging and warning messages #117 - @juanitofatas
15
+ - Include module from `Minitest` #118 - @juanitofatas
16
+ - Fix Minitest loading without using minitest hook #125 — @paulca
17
+
18
+ ## v1.0.1
19
+
20
+ - Fix project_dir issue expecting a string, not a Pathname #112 — @paulca
21
+
3
22
  ## v1.0.0
4
23
 
5
24
  - Option to disable detailed tracing #108 - @blanknite
data/CODEOWNERS ADDED
@@ -0,0 +1 @@
1
+ * @buildkite/test-analytics
data/Gemfile CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- # Specify your gem's dependencies in rspec-buildkite-analytics.gemspec
5
+ # Specify your gem's dependencies in the gemspec
6
6
  gemspec
7
7
 
8
8
  gem "rake", "~> 13.0"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- buildkite-test_collector (1.0.0)
4
+ buildkite-test_collector (1.1.1)
5
5
  activesupport (>= 5.2, < 8)
6
6
  websocket (~> 1.2)
7
7
 
@@ -17,7 +17,7 @@ GEM
17
17
  diff-lcs (1.4.4)
18
18
  i18n (1.10.0)
19
19
  concurrent-ruby (~> 1.0)
20
- minitest (5.15.0)
20
+ minitest (5.16.1)
21
21
  rake (13.0.6)
22
22
  rspec (3.10.0)
23
23
  rspec-core (~> 3.10.0)
@@ -39,7 +39,9 @@ class Buildkite::TestCollector::CI
39
39
  "debug" => ENV["BUILDKITE_ANALYTICS_DEBUG_ENABLED"],
40
40
  "version" => Buildkite::TestCollector::VERSION,
41
41
  "collector" => Buildkite::TestCollector::NAME,
42
- }.compact
42
+ "run_name_prefix" => ENV["BUILDKITE_ANALYTICS_RUN_NAME_PREFIX"],
43
+ "run_name_suffix" => ENV["BUILDKITE_ANALYTICS_RUN_NAME_SUFFIX"],
44
+ }.compact
43
45
  end
44
46
 
45
47
  def generic
@@ -7,7 +7,7 @@ require_relative "../minitest_plugin"
7
7
 
8
8
  Buildkite::TestCollector.uploader = Buildkite::TestCollector::Uploader
9
9
 
10
- class MiniTest::Test
10
+ class Minitest::Test
11
11
  include Buildkite::TestCollector::MinitestPlugin
12
12
  end
13
13
 
@@ -4,7 +4,8 @@ require "active_support/core_ext/hash/indifferent_access"
4
4
 
5
5
  module Buildkite::TestCollector::MinitestPlugin
6
6
  class Trace
7
- attr_accessor :example, :failure_reason, :failure_expanded
7
+ attr_accessor :example
8
+ attr_writer :failure_reason, :failure_expanded
8
9
  attr_reader :id, :history
9
10
 
10
11
  RESULT_CODES = {
@@ -66,7 +67,7 @@ module Buildkite::TestCollector::MinitestPlugin
66
67
 
67
68
  def project_dir
68
69
  if defined?(Rails) && Rails.respond_to?(:root)
69
- Rails.root
70
+ Rails.root.to_s
70
71
  else
71
72
  Dir.getwd
72
73
  end
@@ -12,9 +12,7 @@ module Buildkite::TestCollector::MinitestPlugin
12
12
  Thread.current[:_buildkite_tracer] = tracer
13
13
  end
14
14
 
15
- def before_teardown
16
- super
17
-
15
+ def after_teardown
18
16
  tracer = Thread.current[:_buildkite_tracer]
19
17
  if !tracer.nil?
20
18
  Thread.current[:_buildkite_tracer] = nil
@@ -23,5 +21,7 @@ module Buildkite::TestCollector::MinitestPlugin
23
21
  trace = Buildkite::TestCollector::MinitestPlugin::Trace.new(self, history: tracer.history)
24
22
  Buildkite::TestCollector.uploader.traces[trace.source_location] = trace
25
23
  end
24
+
25
+ super
26
26
  end
27
27
  end
@@ -42,9 +42,9 @@ module Buildkite::TestCollector
42
42
  reconnection_count += 1
43
43
  connect
44
44
  rescue TimeoutError, InitialConnectionFailure => e
45
- Buildkite::TestCollector.logger.warn("rspec-buildkite-analytics could not establish an initial connection with Buildkite due to #{e}. Attempting retry #{reconnection_count} of #{MAX_RECONNECTION_ATTEMPTS}...")
45
+ Buildkite::TestCollector.logger.warn("buildkite-test_collector could not establish an initial connection with Buildkite due to #{e}. Attempting retry #{reconnection_count} of #{MAX_RECONNECTION_ATTEMPTS}...")
46
46
  if reconnection_count > MAX_RECONNECTION_ATTEMPTS
47
- Buildkite::TestCollector.logger.error "rspec-buildkite-analytics could not establish an initial connection with Buildkite due to #{e.message} after #{MAX_RECONNECTION_ATTEMPTS} attempts. You may be missing some data for this test suite, please contact support if this issue persists."
47
+ Buildkite::TestCollector.logger.error "buildkite-test_collector could not establish an initial connection with Buildkite due to #{e.message} after #{MAX_RECONNECTION_ATTEMPTS} attempts. You may be missing some data for this test suite, please contact support if this issue persists."
48
48
  else
49
49
  sleep(WAIT_BETWEEN_RECONNECTIONS)
50
50
  Buildkite::TestCollector.logger.warn("retrying reconnection")
@@ -77,7 +77,7 @@ module Buildkite::TestCollector
77
77
  rescue *DISCONNECTED_EXCEPTIONS => e
78
78
  Buildkite::TestCollector.logger.warn("failed reconnection attempt #{reconnection_count} due to #{e}")
79
79
  if reconnection_count > MAX_RECONNECTION_ATTEMPTS
80
- Buildkite::TestCollector.logger.error "rspec-buildkite-analytics experienced a disconnection and could not reconnect to Buildkite due to #{e.message}. Please contact support."
80
+ Buildkite::TestCollector.logger.error "buildkite-test_collector experienced a disconnection and could not reconnect to Buildkite due to #{e.message}. Please contact support."
81
81
  raise e
82
82
  else
83
83
  sleep(WAIT_BETWEEN_RECONNECTIONS)
@@ -4,6 +4,16 @@ require "active_support/core_ext/hash/indifferent_access"
4
4
 
5
5
  module Buildkite::TestCollector
6
6
  class Tracer
7
+ # https://github.com/buildkite/test-collector-ruby/issues/131
8
+ class MonotonicTime
9
+ GET_TIME = Process.method(:clock_gettime)
10
+ private_constant :GET_TIME
11
+
12
+ def self.call
13
+ GET_TIME.call Process::CLOCK_MONOTONIC
14
+ end
15
+ end
16
+
7
17
  class Span
8
18
  attr_accessor :section, :start_at, :end_at, :detail, :children
9
19
 
@@ -28,23 +38,23 @@ module Buildkite::TestCollector
28
38
  end
29
39
 
30
40
  def initialize
31
- @top = Span.new(:top, Concurrent.monotonic_time, nil, {})
41
+ @top = Span.new(:top, MonotonicTime.call, nil, {})
32
42
  @stack = [@top]
33
43
  end
34
44
 
35
45
  def enter(section, **detail)
36
- new_entry = Span.new(section, Concurrent.monotonic_time, nil, detail)
46
+ new_entry = Span.new(section, MonotonicTime.call, nil, detail)
37
47
  current_span.children << new_entry
38
48
  @stack << new_entry
39
49
  end
40
50
 
41
51
  def leave
42
- current_span.end_at = Concurrent.monotonic_time
52
+ current_span.end_at = MonotonicTime.call
43
53
  @stack.pop
44
54
  end
45
55
 
46
56
  def backfill(section, duration, **detail)
47
- new_entry = Span.new(section, Concurrent.monotonic_time - duration, Concurrent.monotonic_time, detail)
57
+ new_entry = Span.new(section, MonotonicTime.call - duration, MonotonicTime.call, detail)
48
58
  current_span.children << new_entry
49
59
  end
50
60
 
@@ -54,7 +64,7 @@ module Buildkite::TestCollector
54
64
 
55
65
  def finalize
56
66
  raise "Stack not empty" unless @stack.size == 1
57
- @top.end_at = Concurrent.monotonic_time
67
+ @top.end_at = MonotonicTime.call
58
68
  self
59
69
  end
60
70
 
@@ -57,7 +57,7 @@ module Buildkite::TestCollector
57
57
  end
58
58
  else
59
59
  request_id = response.to_hash["x-request-id"]
60
- Buildkite::TestCollector.logger.info "rspec-buildkite-analytics could not establish an initial connection with Buildkite. You may be missing some data for this test suite, please contact support."
60
+ Buildkite::TestCollector.logger.info "buildkite-test_collector could not establish an initial connection with Buildkite. You may be missing some data for this test suite, please contact support with request ID #{request_id}."
61
61
  end
62
62
  else
63
63
  if !!ENV["BUILDKITE_BUILD_ID"]
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Buildkite
4
4
  module TestCollector
5
- VERSION = "1.0.0"
5
+ VERSION = "1.1.1"
6
6
  NAME = "buildkite-test_collector"
7
7
  end
8
8
  end
@@ -19,15 +19,13 @@ module Buildkite
19
19
  attr_accessor :uploader
20
20
  attr_accessor :session
21
21
  attr_accessor :debug_enabled
22
- attr_accessor :debug_filepath
23
22
  attr_accessor :tracing_enabled
24
23
  end
25
24
 
26
- def self.configure(hook:, token: nil, url: nil, debug_enabled: false, debug_filepath: nil, tracing_enabled: true)
27
- self.api_token = token || ENV["BUILDKITE_ANALYTICS_TOKEN"]
25
+ def self.configure(hook:, token: nil, url: nil, debug_enabled: false, tracing_enabled: true)
26
+ self.api_token = (token || ENV["BUILDKITE_ANALYTICS_TOKEN"])&.strip
28
27
  self.url = url || DEFAULT_URL
29
28
  self.debug_enabled = debug_enabled || !!(ENV["BUILDKITE_ANALYTICS_DEBUG_ENABLED"])
30
- self.debug_filepath = debug_filepath || ENV["BUILDKITE_ANALYTICS_DEBUG_FILEPATH"] || Dir.tmpdir
31
29
  self.tracing_enabled = tracing_enabled
32
30
 
33
31
  self.hook_into(hook)
@@ -1,6 +1,6 @@
1
1
  module Minitest
2
2
  def self.plugin_buildkite_collector_init(options)
3
- if Buildkite::TestCollector.respond_to?(:uploader)
3
+ if defined?(Buildkite::TestCollector::MinitestPlugin) && Buildkite::TestCollector.respond_to?(:uploader)
4
4
  self.reporter << Buildkite::TestCollector::MinitestPlugin::Reporter.new(options[:io], options)
5
5
  end
6
6
  end
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: 1.0.0
4
+ version: 1.1.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: 2022-06-02 00:00:00.000000000 Z
11
+ date: 2022-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -72,7 +72,7 @@ dependencies:
72
72
  - - "~>"
73
73
  - !ruby/object:Gem::Version
74
74
  version: '3.10'
75
- description:
75
+ description:
76
76
  email:
77
77
  - support+analytics@buildkite.com
78
78
  executables: []
@@ -82,6 +82,7 @@ files:
82
82
  - ".gitignore"
83
83
  - ".rspec"
84
84
  - CHANGELOG.md
85
+ - CODEOWNERS
85
86
  - CODE_OF_CONDUCT.md
86
87
  - Gemfile
87
88
  - Gemfile.lock
@@ -117,7 +118,7 @@ licenses:
117
118
  metadata:
118
119
  homepage_uri: https://github.com/buildkite/test-collector-ruby
119
120
  source_code_uri: https://github.com/buildkite/test-collector-ruby
120
- post_install_message:
121
+ post_install_message:
121
122
  rdoc_options: []
122
123
  require_paths:
123
124
  - lib
@@ -132,8 +133,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
133
  - !ruby/object:Gem::Version
133
134
  version: '0'
134
135
  requirements: []
135
- rubygems_version: 3.1.4
136
- signing_key:
136
+ rubygems_version: 3.3.3
137
+ signing_key:
137
138
  specification_version: 4
138
139
  summary: Track test executions and report to Buildkite Test Analytics
139
140
  test_files: []