From 16e47a2fc5cc4641926bc51dd40f3c2c75fb3f6c Mon Sep 17 00:00:00 2001 From: Naufan Rizal Date: Thu, 1 Jun 2023 15:08:06 +1200 Subject: [PATCH 1/3] log standard error --- lib/buildkite/test_collector/uploader.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/buildkite/test_collector/uploader.rb b/lib/buildkite/test_collector/uploader.rb index 5947975..8a93911 100644 --- a/lib/buildkite/test_collector/uploader.rb +++ b/lib/buildkite/test_collector/uploader.rb @@ -47,6 +47,7 @@ def self.upload(data) end rescue StandardError => e $stderr.puts "#{Buildkite::TestCollector::NAME} #{Buildkite::TestCollector::VERSION} experienced an error when sending your data, you may be missing some executions for this run." + $stderr.puts e end end end From 2e08b73e0a920dcc0ad38bdda612867a9d985049 Mon Sep 17 00:00:00 2001 From: Naufan Rizal Date: Thu, 1 Jun 2023 15:08:50 +1200 Subject: [PATCH 2/3] Add docs to allow HTTP request to TA when using VCR --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 9ca1d37..403eb5b 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,15 @@ git commit -am "Add Buildkite Test Analytics" git push origin add-buildkite-test-analytics ``` +### VCR +If your test suites use [VCR](https://github.com/vcr/vcr) to interact with HTTP, you need to allow them to make an actual request to Test Analytics. + +``` +VCR.configure do |c| + c.ignore_hosts "analytics-api.buildkite.com" +end +``` + ## 🗨️ Annotations 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: From 2c34694119dafe70c82eda88098ca2deab99e4ef Mon Sep 17 00:00:00 2001 From: "Naufan P. Rizal" Date: Thu, 1 Jun 2023 15:52:32 +1200 Subject: [PATCH 3/3] Apply suggestions from code review Co-authored-by: niceking --- README.md | 2 +- lib/buildkite/test_collector/uploader.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 403eb5b..6eb2a4a 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ git push origin add-buildkite-test-analytics ``` ### VCR -If your test suites use [VCR](https://github.com/vcr/vcr) to interact with HTTP, you need to allow them to make an actual request to Test Analytics. +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. ``` VCR.configure do |c| diff --git a/lib/buildkite/test_collector/uploader.rb b/lib/buildkite/test_collector/uploader.rb index 8a93911..a4312ed 100644 --- a/lib/buildkite/test_collector/uploader.rb +++ b/lib/buildkite/test_collector/uploader.rb @@ -46,8 +46,8 @@ def self.upload(data) retry end rescue StandardError => e - $stderr.puts "#{Buildkite::TestCollector::NAME} #{Buildkite::TestCollector::VERSION} experienced an error when sending your data, you may be missing some executions for this run." $stderr.puts e + $stderr.puts "#{Buildkite::TestCollector::NAME} #{Buildkite::TestCollector::VERSION} experienced an error when sending your data, you may be missing some executions for this run." end end end