Skip to content

Commit

Permalink
MINOR: Fix flaky MetadataLoaderTest.testNoPublishEmptyImage (apache…
Browse files Browse the repository at this point in the history
…#14875)

There is a race in the assertion on `capturedImages`. Since the future is signaled first, it is still possible to see an empty list. By adding to the collection first, we can ensure the assertion will succeed.

Reviewers: Reviewers: David Jacot <[email protected]>
  • Loading branch information
Jason Gustafson authored Nov 30, 2023
1 parent 96b43bf commit a35e021
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -793,10 +793,10 @@ public String name() {

@Override
public void onMetadataUpdate(MetadataDelta delta, MetadataImage newImage, LoaderManifest manifest) {
capturedImages.add(newImage);
if (!firstPublish.isDone()) {
firstPublish.complete(null);
}
capturedImages.add(newImage);
}
};

Expand Down

0 comments on commit a35e021

Please sign in to comment.