-
Notifications
You must be signed in to change notification settings - Fork 619
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -94,9 +94,9 @@ private void checkLeaderBalance(int dnNum, int leaderNumOfEachDn) | |||||
| leaderCount.put(leader, leaderCount.get(leader) + 1); | ||||||
| } | ||||||
|
|
||||||
| assertTrue(leaderCount.size() == dnNum); | ||||||
| assertEquals(leaderCount.size(), dnNum); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's also flip the arguments to match
Suggested change
|
||||||
| 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| } | ||||||
| } | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -634,7 +634,7 @@ public void testCreateBucketWithVersioning() | |||||
| volume.createBucket(bucketName, builder.build()); | ||||||
| OzoneBucket bucket = volume.getBucket(bucketName); | ||||||
| assertEquals(bucketName, bucket.getName()); | ||||||
| assertEquals(true, bucket.getVersioning()); | ||||||
| assertTrue(bucket.getVersioning()); | ||||||
| } | ||||||
|
|
||||||
| @Test | ||||||
|
|
@@ -708,7 +708,7 @@ public void testCreateBucketWithAllArgument() | |||||
| volume.createBucket(bucketName, builder.build()); | ||||||
| OzoneBucket bucket = volume.getBucket(bucketName); | ||||||
| assertEquals(bucketName, bucket.getName()); | ||||||
| assertEquals(true, bucket.getVersioning()); | ||||||
| assertTrue(bucket.getVersioning()); | ||||||
| assertEquals(StorageType.SSD, bucket.getStorageType()); | ||||||
| assertTrue(bucket.getAcls().contains(userAcl)); | ||||||
| assertEquals(repConfig, bucket.getReplicationConfig()); | ||||||
|
|
@@ -812,7 +812,7 @@ public void testSetBucketVersioning() | |||||
| bucket.setVersioning(true); | ||||||
| OzoneBucket newBucket = volume.getBucket(bucketName); | ||||||
| assertEquals(bucketName, newBucket.getName()); | ||||||
| assertEquals(true, newBucket.getVersioning()); | ||||||
| assertTrue(newBucket.getVersioning()); | ||||||
| } | ||||||
|
|
||||||
| @Test | ||||||
|
|
@@ -830,7 +830,7 @@ public void testAclsAfterCallingSetBucketProperty() throws Exception { | |||||
|
|
||||||
| OzoneBucket newBucket = volume.getBucket(bucketName); | ||||||
| assertEquals(bucketName, newBucket.getName()); | ||||||
| assertEquals(true, newBucket.getVersioning()); | ||||||
| assertTrue(newBucket.getVersioning()); | ||||||
|
|
||||||
| List<OzoneAcl> aclsAfterSet = newBucket.getAcls(); | ||||||
| assertEquals(currentAcls, aclsAfterSet); | ||||||
|
|
@@ -3796,7 +3796,7 @@ private void doMultipartUpload(OzoneBucket bucket, String keyName, byte val, | |||||
| assertTrue(latestVersionLocations.isMultipartKey()); | ||||||
| latestVersionLocations.getBlocksLatestVersionOnly() | ||||||
| .forEach(omKeyLocationInfo -> | ||||||
| assertTrue(omKeyLocationInfo.getPartNumber() != -1)); | ||||||
| assertNotEquals(omKeyLocationInfo.getPartNumber(), -1)); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| } | ||||||
|
|
||||||
| private String initiateMultipartUpload(OzoneBucket bucket, String keyName, | ||||||
|
|
@@ -3996,7 +3996,7 @@ public void testDeletedKeyForGDPR() throws Exception { | |||||
| assertEquals("true", key.getMetadata().get(OzoneConsts.GDPR_FLAG)); | ||||||
| assertEquals("AES", | ||||||
| key.getMetadata().get(OzoneConsts.GDPR_ALGORITHM)); | ||||||
| assertTrue(key.getMetadata().get(OzoneConsts.GDPR_SECRET) != null); | ||||||
| assertNotNull(key.getMetadata().get(OzoneConsts.GDPR_SECRET)); | ||||||
|
|
||||||
| try (OzoneInputStream is = bucket.readKey(keyName)) { | ||||||
| assertInputStreamContent(text, is); | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -39,7 +39,6 @@ | |||||
|
|
||||||
| import static org.apache.hadoop.hdds.protocol.proto.HddsProtos.ReplicationFactor.ONE; | ||||||
| import static org.junit.jupiter.api.Assertions.assertEquals; | ||||||
| import static org.junit.jupiter.api.Assertions.assertTrue; | ||||||
|
|
||||||
| import org.junit.jupiter.api.AfterAll; | ||||||
| import org.junit.jupiter.api.BeforeAll; | ||||||
|
|
@@ -144,7 +143,7 @@ public void testAllocateCommit() throws Exception { | |||||
| List<OmKeyLocationInfo> locationInfoList = | ||||||
| openKey.getKeyInfo().getLatestVersionLocations() | ||||||
| .getBlocksLatestVersionOnly(); | ||||||
| assertTrue(locationInfoList.size() == 1); | ||||||
| assertEquals(locationInfoList.size(), 1); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| locationInfoList.add(locationInfo); | ||||||
| keyArgs.setLocationInfoList(locationInfoList); | ||||||
| writeClient.commitKey(keyArgs, openKey.getId()); | ||||||
|
|
||||||
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
TestOzoneFileInterfacesis being migrated to JUnit5 in #5838. The same changes are done in that PR, too. Please removeTestOzoneFileInterfacesfrom the patch to avoid conflicts.