-
Notifications
You must be signed in to change notification settings - Fork 588
HDDS-9955. Simplify assertions in integration tests #5846
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
adoroszlai
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @wzhallright for the patch.
| assertNull(metadataManager.getKeyTable(getBucketLayout()).get(lev1key)); | ||
| assertNull(metadataManager.getKeyTable(getBucketLayout()).get(lev2key)); | ||
| assertNull(metadataManager.getKeyTable(getBucketLayout()).get(fileKey)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that TestOzoneFileInterfaces is being migrated to JUnit5 in #5838. The same changes are done in that PR, too. Please remove TestOzoneFileInterfaces from the patch to avoid conflicts.
| } | ||
|
|
||
| assertTrue(leaderCount.size() == dnNum); | ||
| assertEquals(leaderCount.size(), dnNum); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's also flip the arguments to match expected, actual order:
| assertEquals(leaderCount.size(), dnNum); | |
| assertEquals(dnNum, leaderCount.size()); |
| assertEquals(leaderCount.size(), dnNum); | ||
| for (Map.Entry<UUID, Integer> entry: leaderCount.entrySet()) { | ||
| assertTrue(leaderCount.get(entry.getKey()) == leaderNumOfEachDn); | ||
| assertEquals(leaderCount.get(entry.getKey()), leaderNumOfEachDn); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| assertEquals(leaderCount.get(entry.getKey()), leaderNumOfEachDn); | |
| assertEquals(leaderNumOfEachDn, leaderCount.get(entry.getKey())); |
| latestVersionLocations.getBlocksLatestVersionOnly() | ||
| .forEach(omKeyLocationInfo -> | ||
| assertTrue(omKeyLocationInfo.getPartNumber() != -1)); | ||
| assertNotEquals(omKeyLocationInfo.getPartNumber(), -1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| assertNotEquals(omKeyLocationInfo.getPartNumber(), -1)); | |
| assertNotEquals(-1, omKeyLocationInfo.getPartNumber())); |
| openKey.getKeyInfo().getLatestVersionLocations() | ||
| .getBlocksLatestVersionOnly(); | ||
| assertTrue(locationInfoList.size() == 1); | ||
| assertEquals(locationInfoList.size(), 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| assertEquals(locationInfoList.size(), 1); | |
| assertEquals(1, locationInfoList.size()); |
|
@adoroszlai Thank you for your detailed comments and suggestions, has fixed the comments, PTAL. |
What changes were proposed in this pull request?
Assertions in the form:
can be simplified to:
Not only are these simpler, some of them also provide more information in case of failure.
This PR updates such assertions in hadoop-ozone/integration-test.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-9955
CI
https://github.com/wzhallright/ozone/actions/runs/7284783456