buildkite-test_collector 1.1.0 → 1.1.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: 0f136ef927e80dbc0b442d01addc8f66041a79824508ea19158071594e78f7b2
4
- data.tar.gz: 92136cc0d244357f96e5372af85b8923678cde70eece3582b6c02437e3a06146
3
+ metadata.gz: 96fb0d0c08ff10d420388b2438ae199c7fbf72878d1fa5631c68b27e70f11cac
4
+ data.tar.gz: 78846d669900e535d1e03bd7494611dd124f2c1bae59471ad41b5b0d9f1efb1b
5
5
  SHA512:
6
- metadata.gz: 3f53e8887efbb7f8ee62df7693c8061950dc77b1168e8abe784352a6e168938a8ee530c739746722b26955f22547c7bddb809e1345633afe06a9605bd2cfad2c
7
- data.tar.gz: 42e3568a83bb4d37dbb815fb27320f121af273c60d968a8fa4f75688708b3994f91dce02203e1a45ebf67630e27288665029e38b591f50e349e792b0e881b112
6
+ metadata.gz: c7151f06cf10d7aeb296b9d8c9294f9cdab0b07fc01112176cdc28ad55f7b65d4aa51fcc21dfd179eb58bc6c69592583f58335dece7f3b46ac1e2ba7718da369
7
+ data.tar.gz: cb1157c4a4cfaa719d852f2ac271bd09bbd25a461b4f6a9c002063d7461e3bb06e8107342cceb77dada1cda8090c3643aa3e2827aac7355fea90b51bbae4f7f0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
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
+
3
10
  ## v1.1.0
4
11
 
5
12
  - Remove an internal debugging change #115 — @juanitofatas
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- buildkite-test_collector (1.1.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
@@ -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
@@ -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
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Buildkite
4
4
  module TestCollector
5
- VERSION = "1.1.0"
5
+ VERSION = "1.1.1"
6
6
  NAME = "buildkite-test_collector"
7
7
  end
8
8
  end
@@ -23,7 +23,7 @@ module Buildkite
23
23
  end
24
24
 
25
25
  def self.configure(hook:, token: nil, url: nil, debug_enabled: false, tracing_enabled: true)
26
- self.api_token = token || ENV["BUILDKITE_ANALYTICS_TOKEN"]
26
+ self.api_token = (token || ENV["BUILDKITE_ANALYTICS_TOKEN"])&.strip
27
27
  self.url = url || DEFAULT_URL
28
28
  self.debug_enabled = debug_enabled || !!(ENV["BUILDKITE_ANALYTICS_DEBUG_ENABLED"])
29
29
  self.tracing_enabled = tracing_enabled
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.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Buildkite
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-21 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