Use rspec-sidekiq gem
Problem to solve
We currently use something like this across the entire project
expect(Worker).to receive(:perform_async)
Proposal
We could use this gem for better expectations. We would have to test the impact, but it might not be that huge.
This gem is referenced by the sidekiq author. Or in the same wiki page there are other suggestions about how to test that jobs are actually enqueued instead of simply checking that the perform_async
method is received by the worker.
Expectations could look like this
AwesomeWorker.perform_async('Awesome', true)
# test with...
expect(AwesomeWorker).to have_enqueued_sidekiq_job('Awesome', true)
Steps
-
Add gem, enforce usage with a Cop. - !62601 (merged) (reverted) -
Fix existing offenses.
Availability & Testing
This section needs to be retained and filled in during the workflow planning breakdown phase of this feature proposal, if not earlier.
What risks does this change pose to our availability? How might it affect the quality of the product? What additional test coverage or changes to tests will be needed? Will it require cross-browser testing?
Please list the test areas (unit, integration and end-to-end) that needs to be added or updated to ensure that this feature will work as intended. Please use the list below as guidance.
- Unit test changes
- Integration test changes
- End-to-end test change
See the test engineering planning process and reach out to your counterpart Software Engineer in Test for assistance: https://about.gitlab.com/handbook/engineering/quality/test-engineering/#test-planning
What does success look like, and how can we measure that?
Test suite will have better expectations when it comes to scheduling async jobs. We would need to confirm that the the suite's performance is not degraded by adding something like this.
License of the gem is MIT