Flaky spec: ./ee/spec/models/ee/group_spec.rb:1934 # Group#execute_hooks group_webhooks when group_webhooks feature is enabled when a hook has recent failures is still executed
Failure
While working on !117897 (merged) I saw the following spec failure.
bin/rspec ./ee/spec/models/ee/group_spec.rb -e "feature is enabled when a hook has recent failures is
still executed"
warning: parser/current is loading parser/ruby31, which recognizes 3.1.3-compliant syntax, but you are running 3.1.4.
Please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
Run options: include {:full_description=>/feature\ is\ enabled\ when\ a\ hook\ has\ recent\ failures\ is\ still\ executed/}
Randomized with seed 17101
Test environment set up in 5.652751355 seconds
Group
#execute_hooks
group_webhooks
when group_webhooks feature is enabled
when a hook has recent failures
is still executed (FAILED - 1)
Failures:
1) Group#execute_hooks group_webhooks when group_webhooks feature is enabled when a hook has recent failures is still executed
Failure/Error:
expect(WebHookService).to receive(:new)
.with(group_hook, data, 'member_hooks').and_call_original
(WebHookService (class)).new(#<GroupHook id: 3, project_id: nil, created_at: "2023-05-30 08:18:48.062383763 +0000", updated_at: "2..., integration_id: nil, branch_filter_strategy: "wildcard", token: nil, url: nil, url_variables: nil>, {:some=>"info"}, "member_hooks")
expected: 1 time with arguments: (#<GroupHook id: 3, project_id: nil, created_at: "2023-05-30 08:18:48.062383763 +0000", updated_at: "2..., integration_id: nil, branch_filter_strategy: "wildcard", token: nil, url: nil, url_variables: nil>, {:some=>"info"}, "member_hooks")
received: 0 times
# ./ee/spec/models/ee/group_spec.rb:1971:in `block (6 levels) in <top (required)>'
# ./spec/spec_helper.rb:425:in `block (3 levels) in <top (required)>'
# ./spec/support/sidekiq_middleware.rb:18:in `with_sidekiq_server_middleware'
# ./spec/spec_helper.rb:416:in `block (2 levels) in <top (required)>'
# ./spec/spec_helper.rb:412:in `block (3 levels) in <top (required)>'
# ./lib/gitlab/application_context.rb:61:in `with_raw_context'
# ./spec/spec_helper.rb:412:in `block (2 levels) in <top (required)>'
# ./spec/spec_helper.rb:379:in `block (3 levels) in <top (required)>'
# ./lib/gitlab/with_request_store.rb:17:in `enabling_request_store'
# ./lib/gitlab/with_request_store.rb:10:in `with_request_store'
# ./spec/spec_helper.rb:379:in `block (2 levels) in <top (required)>'
# ./spec/spec_helper.rb:243: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:108:in `block (3 levels) in <main>'
# ./spec/support/database/prevent_cross_joins.rb:62:in `with_cross_joins_prevented'
# ./spec/support/database/prevent_cross_joins.rb:108:in `block (2 levels) in <main>'
Finished in 7.14 seconds (files took 11.55 seconds to load)
1 example, 1 failure
Failed examples:
rspec ./ee/spec/models/ee/group_spec.rb:1970 # Group#execute_hooks group_webhooks when group_webhooks feature is enabled when a hook has recent failures is still executed
Randomized with seed 17101
[TEST PROF INFO] Time spent in factories: 00:00.568 (5.18% of total time)
Discussion
The following discussion from !108895 (merged) should be addressed:
-
@splattael started a discussion: When running
bin/rspec ./ee/spec/models/ee/group_spec.rb:1934
I see the following failure:1) Group#execute_hooks group_webhooks when group_webhooks feature is enabled when a hook has recent failures is still executed Failure/Error: expect(WebHookService).to receive(:new) .with(group_hook, data, 'member_hooks').and_call_original (WebHookService (class)).new(#<GroupHook id: 7, project_id: nil, created_at: "2023-04-19 09:09:16.015535691 +0000", updated_at: "2..., integration_id: nil, branch_filter_strategy: "wildcard", token: nil, url: nil, url_variables: nil>, {:some=>"info"}, "member_hooks") expected: 1 time with arguments: (#<GroupHook id: 7, project_id: nil, created_at: "2023-04-19 09:09:16.015535691 +0000", updated_at: "2..., integration_id: nil, branch_filter_strategy: "wildcard", token: nil, url: nil, url_variables: nil>, {:some=>"info"}, "member_hooks") received: 0 times
Reverting this very change fixes the spec for me
🤷
Edited by Peter Leitzen