Skip to content

Commit

Permalink
resolve merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Katie Wright authored and Katie Wright committed Jan 19, 2023
2 parents b81c02d + 58577ea commit 600c827
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# CHANGELOG

## v1.3.2
## v1.4.2

- Update collector argument in the Analytics::API payload #170 - @KatieWright26

## v1.4.1
- Add in support to create file with trace data #167

## v1.3.1

- Cope with the gem being loaded but not configured when using minitest #165 - @billhorsman
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
buildkite-test_collector (1.3.2)
buildkite-test_collector (1.4.2)
activesupport (>= 4.2)
websocket (~> 1.2)

Expand Down
4 changes: 3 additions & 1 deletion lib/buildkite/test_collector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,16 @@ class << self
attr_accessor :session
attr_accessor :debug_enabled
attr_accessor :tracing_enabled
attr_accessor :artifact_path
attr_accessor :env
end

def self.configure(hook:, token: nil, url: nil, debug_enabled: false, tracing_enabled: true, env: {})
def self.configure(hook:, token: nil, url: nil, debug_enabled: false, tracing_enabled: true, artifact_path: nil, env: {})
self.api_token = (token || ENV["BUILDKITE_ANALYTICS_TOKEN"])&.strip
self.url = url || DEFAULT_URL
self.debug_enabled = debug_enabled || !!(ENV["BUILDKITE_ANALYTICS_DEBUG_ENABLED"])
self.tracing_enabled = tracing_enabled
self.artifact_path = artifact_path
self.env = env

self.hook_into(hook)
Expand Down
12 changes: 12 additions & 0 deletions lib/buildkite/test_collector/library_hooks/rspec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@
trace = Buildkite::TestCollector::RSpecPlugin::Trace.new(example, history: tracer.history)
Buildkite::TestCollector.uploader.traces[example.id] = trace
end

config.after(:suite) do
if Buildkite::TestCollector.artifact_path
filename = File.join(Buildkite::TestCollector.artifact_path, "buildkite-test-collector-rspec-#{SecureRandom.uuid}.json.gz")
data_set = { results: Buildkite::TestCollector.uploader.traces.values.map(&:as_hash) }
File.open(filename, "wb") do |f|
gz = Zlib::GzipWriter.new(f)
gz.write(data_set.to_json)
gz.close
end
end
end
end

Buildkite::TestCollector.enable_tracing!
2 changes: 1 addition & 1 deletion lib/buildkite/test_collector/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module Buildkite
module TestCollector
VERSION = "1.3.2"
VERSION = "1.4.2"
NAME = "buildkite-test_collector"
end
end

0 comments on commit 600c827

Please sign in to comment.