Fix brittle spec for hooks
What does this MR do and why?
Related to !93665 (merged)
Problem
If run the test suite for bundle exec rspec --format documentation gitlab/spec/services/git/branch_push_service_spec.rb
separately it fails:
1) Git::BranchPushService Webhooks when pushing a branch for the first time executes webhooks
Failure/Error: expect(project).to receive(:execute_hooks)
(#<Project id:45 namespace1/project1>>).execute_hooks(*(any args))
expected: 1 time with any arguments
received: 0 times with any arguments
# ./spec/services/git/branch_push_service_spec.rb:205:in `block (4 levels) in <top (required)>'
# ./spec/spec_helper.rb:432:in `block (3 levels) in <top (required)>'
# ./spec/support/sidekiq_middleware.rb:9:in `with_sidekiq_server_middleware'
# ./spec/spec_helper.rb:423:in `block (2 levels) in <top (required)>'
# ./spec/spec_helper.rb:419:in `block (3 levels) in <top (required)>'
# ./lib/gitlab/application_context.rb:56:in `with_raw_context'
# ./spec/spec_helper.rb:419:in `block (2 levels) in <top (required)>'
# ./spec/spec_helper.rb:262:in `block (2 levels) in <top (required)>'
# ./spec/support/system_exit_detected.rb:7:in `block (2 levels) in <main>'
# ./spec/support/database/prevent_cross_joins.rb:106:in `block (3 levels) in <main>'
# ./spec/support/database/prevent_cross_joins.rb:60:in `with_cross_joins_prevented'
# ./spec/support/database/prevent_cross_joins.rb:106:in `block (2
levels) in <main>'
Solution
The project stores memoized values from the previous tests and we need to refind the project to fix it.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Vasilii Iakliushin