HDDS-9955. Simplify assertions in integration tests#5846
Merged
adoroszlai merged 3 commits intoapache:masterfrom Dec 21, 2023
Merged
HDDS-9955. Simplify assertions in integration tests#5846adoroszlai merged 3 commits intoapache:masterfrom
adoroszlai merged 3 commits intoapache:masterfrom
Conversation
adoroszlai
reviewed
Dec 21, 2023
Contributor
adoroszlai
left a comment
There was a problem hiding this comment.
Thanks @wzhallright for the patch.
Comment on lines
+264
to
+266
| assertNull(metadataManager.getKeyTable(getBucketLayout()).get(lev1key)); | ||
| assertNull(metadataManager.getKeyTable(getBucketLayout()).get(lev2key)); | ||
| assertNull(metadataManager.getKeyTable(getBucketLayout()).get(fileKey)); |
Contributor
There was a problem hiding this comment.
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); |
Contributor
There was a problem hiding this comment.
Let's also flip the arguments to match expected, actual order:
Suggested change
| 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); |
Contributor
There was a problem hiding this comment.
Suggested change
| assertEquals(leaderCount.get(entry.getKey()), leaderNumOfEachDn); | |
| assertEquals(leaderNumOfEachDn, leaderCount.get(entry.getKey())); |
| latestVersionLocations.getBlocksLatestVersionOnly() | ||
| .forEach(omKeyLocationInfo -> | ||
| assertTrue(omKeyLocationInfo.getPartNumber() != -1)); | ||
| assertNotEquals(omKeyLocationInfo.getPartNumber(), -1)); |
Contributor
There was a problem hiding this comment.
Suggested change
| assertNotEquals(omKeyLocationInfo.getPartNumber(), -1)); | |
| assertNotEquals(-1, omKeyLocationInfo.getPartNumber())); |
| openKey.getKeyInfo().getLatestVersionLocations() | ||
| .getBlocksLatestVersionOnly(); | ||
| assertTrue(locationInfoList.size() == 1); | ||
| assertEquals(locationInfoList.size(), 1); |
Contributor
There was a problem hiding this comment.
Suggested change
| assertEquals(locationInfoList.size(), 1); | |
| assertEquals(1, locationInfoList.size()); |
Contributor
Author
|
@adoroszlai Thank you for your detailed comments and suggestions, has fixed the comments, PTAL. |
adoroszlai
approved these changes
Dec 21, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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