-
Notifications
You must be signed in to change notification settings - Fork 28
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
Minitest: avoid installing at_exit
#236
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
@@ -211,6 +216,20 @@ jobs: | |||
export KNAPSACK_PRO_TEST_DIR=turnip | |||
export KNAPSACK_PRO_TEST_FILE_PATTERN="turnip/**/*.feature" | |||
bundle exec rake "knapsack_pro:queue:rspec[-r turnip/rspec]" | |||
- run: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are adding Minitest steps to the jobs that are supposed to be testing the matrix of Ruby & RSpec versions.
I think we could make it cleaner. You could add new jobs to the workflow for testing the matrix of Ruby & Minitest versions. Thanks to that:
- we have the option to test different Minitest versions in the future.
- we would avoid testing the matrix of different Minitest & RSpec versions because it does not make sense. The testing frameworks are independent.
You could create a new story for that to not hold off on the release of this fix.
workflows:
tests:
jobs:
- unit
- integration-regular-rspec:
name: integration-regular__ruby-<< matrix.ruby >>__rspec-<< matrix.rspec >>
matrix:
parameters:
ruby: ["3.0", "3.1", "3.2"]
rspec: ["3.10.2", "3.11.0", "3.12.2"]
- integration-queue-rspec:
name: integration-queue__ruby-<< matrix.ruby >>__rspec-<< matrix.rspec >>
matrix:
parameters:
ruby: ["3.0", "3.1", "3.2"]
rspec: ["3.10.2", "3.11.0", "3.12.2"]
- integration-regular-minitest:
name: integration-regular__ruby-<< matrix.ruby >>__minitest-<< matrix.minitest >>
matrix:
parameters:
ruby: ["3.0", "3.1", "3.2"]
minitest: ["x.x.x", ...]
- integration-queue-minitest:
name: integration-queue__ruby-<< matrix.ruby >>__minitest-<< matrix.minitest >>
matrix:
parameters:
ruby: ["3.0", "3.1", "3.2"]
minitest: ["x.x.x", ...]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ (I had to reduce the parallelism to avoid jobs being queued)
Rails in
test/test_helper.rb
includes:that contains:
which calls
Minitest.autorun
, which, in turn, installs anat_exit
that will run Minitest tests.This is useful when you don't want to call
Minitest.run
explicitly. But we actually do so in the Knapsack Pro runner.We forgot to add the
class_variable_set
as part of 6849d1f (make sure to read the link to the Minitest issue in the commit body).This change is not needed in Regular Mode because we don't call
Minitest.run
(and we rely on the autorun) in that case.Reproduction steps
::Minitest.class_variable_set('@@installed_at_exit', true)
cd rails-app-with-knapsack_pro
bin/knapsack_pro_queue_minitest
You can also see it on CI (notice the last few lines):