Skip to content

Fix flaky test in BatchFileOrchestratorTest#1732

Merged
xgouchet merged 1 commit into
developfrom
xgouchet/flaky/batch_file_orchestrator
Nov 17, 2023
Merged

Fix flaky test in BatchFileOrchestratorTest#1732
xgouchet merged 1 commit into
developfrom
xgouchet/flaky/batch_file_orchestrator

Conversation

@xgouchet

Copy link
Copy Markdown
Contributor

What does this PR do?

Fix flaky test in BatchFileOrchestratorTest

The main issue here is that were using Kotlin's mutableListOf() which is inherently not thread safe, and try to insert elements from multiple concurrent threads. What happens 10% of the time (locally) is that two thread end up appending at the same time, and one of the value is overridden, resulting in one less value in the list than expected.

@xgouchet
xgouchet requested review from a team as code owners November 17, 2023 10:01
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

Merging #1732 (0e0e84c) into develop (9457e96) will decrease coverage by 0.09%.
The diff coverage is n/a.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1732      +/-   ##
===========================================
- Coverage    83.41%   83.32%   -0.09%     
===========================================
  Files          465      465              
  Lines        16173    16170       -3     
  Branches      2407     2406       -1     
===========================================
- Hits         13490    13473      -17     
- Misses        2027     2041      +14     
  Partials       656      656              

see 21 files with indirect coverage changes

Thread {
val result = testedOrchestrator.getRootDir()
results.add(result)
synchronized(results) { results.add(result) }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohh nice catch...good to know

@xgouchet
xgouchet merged commit 9872af5 into develop Nov 17, 2023
@xgouchet
xgouchet deleted the xgouchet/flaky/batch_file_orchestrator branch November 17, 2023 11:13
@xgouchet xgouchet added this to the 2.3.0 milestone Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants