Fix flaky spec due to retries
What does this MR do and why?
Related to #435355 (closed)
As seen in https://gitlab.com/gitlab-org/gitlab/-/jobs/5754532436, the spec first fails with:
1st Try error in ./spec/requests/api/graphql/boards/board_list_issues_query_spec.rb:117:
[{"message"=>"Timeout on validation of query", "locations"=>[], "extensions"=>{"code"=>"validationTimeout"}}]
And then fails with the wrong issues returned.
This MR aims to fix the 2nd failure. The validation timeout is tracked in #396784 (closed).
The failure can be reproduced with:
diff --git a/spec/requests/api/graphql/boards/board_list_issues_query_spec.rb b/spec/requests/api/graphql/boards/board_list_issues_query_spec.rb
index 86e2b2888904..63375a3612a1 100644
--- a/spec/requests/api/graphql/boards/board_list_issues_query_spec.rb
+++ b/spec/requests/api/graphql/boards/board_list_issues_query_spec.rb
@@ -118,6 +118,8 @@ def issue_relative_positions
issue1.assignee_ids = user.id
issue2.assignee_ids = another_user.id
+ raise StandardError, "retry me" unless $retried == true
+
subject
expect(issue_id).to contain_exactly(issue1.to_gid.to_s, issue2.to_gid.to_s)
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 7317b512ae42..05c7aef0c540 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -85,6 +85,9 @@
config.verbose_retry = true
config.display_try_failure_messages = true
+ config.retry_callback = proc do |ex|
+ $retried = true
+ end
config.infer_spec_type_from_file_location!
And then running:
RSPEC_RETRY_RETRY_COUNT=2 bin/rspec './spec/requests/api/graphql/boards/board_list_issues_query_spec.rb[1:2:1:2:4:1]'
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 Heinrich Lee Yu