Skip to content

Fix handling signals for non-RSpec test runners#286

Merged
ArturT merged 2 commits intomasterfrom
fix-bug-rspec-in-base-class
Dec 4, 2024
Merged

Fix handling signals for non-RSpec test runners#286
ArturT merged 2 commits intomasterfrom
fix-bug-rspec-in-base-class

Conversation

@ArturT
Copy link
Copy Markdown
Member

@ArturT ArturT commented Dec 3, 2024

Story

N/A

Description

Fix handling signals for non-RSpec test runners.

Changes

  • fix(bug): we should set RSpec wants to quite value in the RSpec only. Remove it from the queue base runner which breaks handling signals for non RSpec test runners.

Problem

Problem can be reproduced by running the following in the rails-app-with-knapsack_pro repo.

KNAPSACK_PRO_RSPEC_DISABLED=true bin/knapsack_pro_queue_cucumber_junit

Press Ctrl+C in the middle of a test execution. You get the NameError: uninitialized constant KnapsackPro::Runners::Queue::BaseRunner::RSpec (NameError) error:

...
INT signal has been received. Terminating Knapsack Pro...
rake aborted!
NameError: uninitialized constant KnapsackPro::Runners::Queue::BaseRunner::RSpec (NameError)
/Users/artur/Documents/github/knapsack-pro/knapsack_pro-ruby/lib/knapsack_pro/runners/queue/base_runner.rb:62:in `block (2 levels) in trap_signals'
...

This PR fixes it.

Checklist reminder

  • You added the changes to the UNRELEASED section of the CHANGELOG.md, including the needed bump (ie, patch, minor, major)
  • You follow the architecture outlined below for RSpec in Queue Mode, which is a work in progress (feel free to propose changes):
    • Pure: lib/knapsack_pro/pure/queue/rspec_pure.rb contains pure functions that are unit tested.
    • Extension: lib/knapsack_pro/extensions/rspec_extension.rb encapsulates calls to RSpec internals and is integration and e2e tested.
    • Runner: lib/knapsack_pro/runners/queue/rspec_runner.rb invokes the pure code and the extension to produce side effects, which are integration and e2e tested.

@ArturT ArturT added the bug label Dec 3, 2024
Comment thread lib/knapsack_pro/runners/queue/rspec_runner.rb
Copy link
Copy Markdown
Contributor

@3v0k4 3v0k4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if we should add an integration test that exercises the trap. I trust your judgement on this.

Do we have a similar problem in Regular mode?

Feel free to merge & release when convenient.

@ArturT
Copy link
Copy Markdown
Member Author

ArturT commented Dec 4, 2024

Do we have a similar problem in Regular mode?

No. Test runners handle signals on their own.

@ArturT ArturT merged commit bc57ddd into master Dec 4, 2024
@ArturT ArturT deleted the fix-bug-rspec-in-base-class branch December 4, 2024 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants