Skip to content

Commit

Permalink
Install and set up Buildkite Test Analytics
Browse files Browse the repository at this point in the history
We're configuring Buildkite Test Analytics [1] to gather information
about our test suite so we can detect and fix flaky and slow tests.

We use the tagging feature [2] to annotate the combination of Ruby/Rails
versions, database engine, and the presence of paperclip.

1 - https://buildkite.com/test-analytics
2 - https://buildkite.com/docs/test-analytics/ruby-collectors#tagging-duplicate-test-executions-with-a-prefix-slash-suffix
  • Loading branch information
waiting-for-dev committed Oct 25, 2022
1 parent 55245ea commit e70d4e4
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ jobs:
DISABLE_ACTIVE_STORAGE: << parameters.paperclip >>
RAILS_VERSION: "~> << parameters.rails >>"
USE_LEGACY_EVENTS: << parameters.legacy >>
BUILDKITE_ANALYTICS_EXECUTION_NAME_PREFIX: "(<< parameters.ruby >>:<< parameters.rails >>:<< parameters.database >>:<< parameters.paperclip >>)"
steps:
- setup
- when:
Expand Down
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ group :utils do
gem 'gem-release', require: false
end

gem 'buildkite-test_collector', require: false, group: :test

gem 'rspec_junit_formatter', require: false, group: :ci

# Documentation
Expand Down
3 changes: 3 additions & 0 deletions api/spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
SimpleCov.start('rails')
end

require 'spree/testing_support/buildkite_test_collector'
Spree::TestingSupport::BuildkiteTestCollector.enable

# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'

Expand Down
3 changes: 3 additions & 0 deletions backend/spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
SimpleCov.start('rails')
end

require 'spree/testing_support/buildkite_test_collector'
Spree::TestingSupport::BuildkiteTestCollector.enable

# This file is copied to ~/spec when you run 'ruby script/generate rspec'
# from the project root directory.
ENV["RAILS_ENV"] ||= 'test'
Expand Down
13 changes: 13 additions & 0 deletions core/lib/spree/testing_support/buildkite_test_collector.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

require "buildkite/test_collector"

module Spree
module TestingSupport
module BuildkiteTestCollector
def self.enable
Buildkite::TestCollector.configure(hook: :rspec)
end
end
end
end
3 changes: 3 additions & 0 deletions core/spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
SimpleCov.start('rails')
end

require 'spree/testing_support/buildkite_test_collector'
Spree::TestingSupport::BuildkiteTestCollector.enable

require 'rspec/core'

require 'spree/testing_support/partial_double_verification'
Expand Down

0 comments on commit e70d4e4

Please sign in to comment.