Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test on Sidekiq 6 #650

Merged
merged 2 commits into from
Jan 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ steps:
env:
RUBY_TEST_VERSION: "2.5"

- label: ':sidekiq: Sidekiq 5 tests'
- label: ':sidekiq: Sidekiq 6 tests'
timeout_in_minutes: 30
plugins:
docker-compose#v3.1.0:
Expand All @@ -95,7 +95,7 @@ steps:
command: ["features/sidekiq.feature", "--tags", "not @wip"]
env:
RUBY_TEST_VERSION: "2.5"
SIDEKIQ_VERSION: "~> 5"
SIDEKIQ_VERSION: "6"

- wait

Expand Down Expand Up @@ -326,7 +326,7 @@ steps:
command: ["features/sidekiq.feature", "--tags", "not @wip"]
env:
RUBY_TEST_VERSION: "2.5"
SIDEKIQ_VERSION: "~> 2"
SIDEKIQ_VERSION: "2"
concurrency: 4
concurrency_group: 'ruby/integrations-maze-runner-tests'

Expand All @@ -339,7 +339,7 @@ steps:
command: ["features/sidekiq.feature", "--tags", "not @wip"]
env:
RUBY_TEST_VERSION: "2.5"
SIDEKIQ_VERSION: "~> 3"
SIDEKIQ_VERSION: "3"
concurrency: 4
concurrency_group: 'ruby/integrations-maze-runner-tests'

Expand All @@ -352,10 +352,21 @@ steps:
command: ["features/sidekiq.feature", "--tags", "not @wip"]
env:
RUBY_TEST_VERSION: "2.5"
SIDEKIQ_VERSION: "~> 4"
SIDEKIQ_VERSION: "4"
concurrency: 4
concurrency_group: 'ruby/integrations-maze-runner-tests'

- label: ':sidekiq: Sidekiq 5 tests'
timeout_in_minutes: 30
plugins:
docker-compose#v3.1.0:
run: ruby-maze-runner
use-aliases: true
command: ["features/sidekiq.feature", "--tags", "not @wip"]
env:
RUBY_TEST_VERSION: "2.5"
SIDEKIQ_VERSION: "5"

- label: ':rails: Rails 3 Ruby 2.0 tests'
timeout_in_minutes: 30
plugins:
Expand Down
2 changes: 1 addition & 1 deletion TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Configure the tests to be run in the following way:

- Determine the Ruby version to be tested using the environment variable `RUBY_TEST_VERSION` e.g. `RUBY_TEST_VERSION=2.6`
- If testing rails, set the rails version to be tested using the environment variable `RAILS_VERSION` e.g. `RAILS_VERSION=3`
- If testing sidekiq, set the version to be tested using the environment variable `SIDEKIQ_VERSION` as the bundler version, e.g. `SIDEKIQ_VERSION="~> 2"`
- If testing sidekiq, set the version to be tested using the environment variable `SIDEKIQ_VERSION`, e.g. `SIDEKIQ_VERSION=2`

When running the end-to-end tests, you'll want to restrict the feature files run to the specific test features for the platform. This is done using the Cucumber CLI syntax at the end of the `docker-compose run ruby-maze-runner` command, i.e:

Expand Down
13 changes: 9 additions & 4 deletions features/fixtures/sidekiq/app/Gemfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
source 'https://rubygems.org'

sidekiq_version = ENV.fetch('SIDEKIQ_VERSION')

gem 'bugsnag', path: '/bugsnag'
gem 'hitimes', '~> 1.2.6'
gem 'rake', '~> 12.3.0'
gem 'redis', '~> 3.3.5'
gem 'sidekiq', ENV['SIDEKIQ_VERSION']
gem 'timers', '~> 4.1.2'
gem 'sidekiq', "~> #{sidekiq_version}"

if sidekiq_version == '2'
gem 'hitimes', '~> 1.2.6'
gem 'redis', '~> 3.3.5'
gem 'timers', '~> 4.1.2'
end
16 changes: 6 additions & 10 deletions features/steps/ruby_notifier_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,22 +92,18 @@
end

Then("the payload field {string} matches the appropriate Sidekiq handled payload") do |field|
if ENV["SIDEKIQ_VERSION"] == "~> 2"
created_at_present = "false"
else
created_at_present = "true"
end
# Sidekiq 2 doesn't include the "created_at" field
created_at_present = ENV["SIDEKIQ_VERSION"] > "2"

steps %Q{
And the payload field "#{field}" matches the JSON fixture in "features/fixtures/sidekiq/payloads/handled_metadata_ca_#{created_at_present}.json"
}
end

Then("the payload field {string} matches the appropriate Sidekiq unhandled payload") do |field|
if ENV["SIDEKIQ_VERSION"] == "~> 2"
created_at_present = "false"
else
created_at_present = "true"
end
# Sidekiq 2 doesn't include the "created_at" field
created_at_present = ENV["SIDEKIQ_VERSION"] > "2"

steps %Q{
And the payload field "#{field}" matches the JSON fixture in "features/fixtures/sidekiq/payloads/unhandled_metadata_ca_#{created_at_present}.json"
}
Expand Down