Skip to content

Fixed flaky test in PluginManagerTest#9925

Merged
Jackie-Jiang merged 2 commits intoapache:masterfrom
ycliu28:flaky-test
Dec 8, 2022
Merged

Fixed flaky test in PluginManagerTest#9925
Jackie-Jiang merged 2 commits intoapache:masterfrom
ycliu28:flaky-test

Conversation

@ycliu28
Copy link
Contributor

@ycliu28 ycliu28 commented Dec 7, 2022

bugfix

Context
Fixed the flaky test in 9924. The cause of it is that the test writes keys and values of a hashmap in to a list in a for loop, however, the order of the the map entry in a hashmap is non-deterministic.

Fix
Since the purpose of the test is not checking the order, it's more reasonable to write the keys and values in to hashsets than arraylists.

@ycliu28 ycliu28 changed the title Fixed Flaky Test in #9924 Fixed flaky test in #9924 Dec 7, 2022
@ycliu28 ycliu28 changed the title Fixed flaky test in #9924 Fixed flaky test in PluginManagerTest Dec 7, 2022
Copy link
Contributor

@Jackie-Jiang Jackie-Jiang left a comment

Choose a reason for hiding this comment

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

Good catch


ArrayList<String> actualPluginNames = new ArrayList<>();
ArrayList<String> actualPluginPaths = new ArrayList<>();
HashSet<String> actualPluginNames = new HashSet<>();
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's make it a string to string map and compare the map instead of comparing 2 sets

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the advice, updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants