Skip to content

Fix an array comparison flaky spec

Changzheng Liu requested to merge 474157-fix-flaky-test into master

What does this MR do and why?

The error message implies there's an order issue when doing comparison.

Failures:
  1) Search::RakeTaskExecutorService#index_work_items with limited indexing enabled does not call track! for work_items that should not be indexed
     Failure/Error: unscoped { yield relation, index }
       #<Elastic::ProcessBookkeepingService (class)> received :track! with unexpected arguments
         expected: (#<WorkItem id:119 group5#1>, #<WorkItem id:121 group7#1>)
              got: (#<WorkItem id:121 group7#1>, #<WorkItem id:119 group5#1>)
       Diff:
       @@ -1 +1 @@
       -[#<WorkItem id:119 group5#1>, #<WorkItem id:121 group7#1>]
       +[#<WorkItem id:121 group7#1>, #<WorkItem id:119 group5#1>]
     # ./ee/app/services/search/rake_task_executor_service.rb:384:in `block in index_work_items'
     # ./app/models/concerns/each_batch.rb:99:in `block (2 levels) in each_batch'
     # ./app/models/concerns/each_batch.rb:99:in `block in each_batch'
     # ./app/models/concerns/each_batch.rb:69:in `step'
     # ./app/models/concerns/each_batch.rb:69:in `each_batch'
     # ./ee/app/services/search/rake_task_executor_service.rb:383:in `index_work_items'
     # ./ee/app/services/search/rake_task_executor_service.rb:48:in `execute'
     # ./ee/spec/services/search/rake_task_executor_service_spec.rb:699:in `block (4 levels) in <top (required)>'

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Related to #474157 (closed)

Merge request reports