adoroszlai commented on code in PR #5903:
URL: https://github.com/apache/ozone/pull/5903#discussion_r1439392409
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/recon/TestReconWithOzoneManagerHA.java:
##########
@@ -113,10 +110,9 @@ public void testReconGetsSnapshotFromLeader() throws
Exception {
ozoneManager.set(om);
return om != null;
}, 100, 120000);
- Assert.assertNotNull("Timed out waiting OM leader election to finish: "
- + "no leader or more than one leader.", ozoneManager);
- Assert.assertTrue("Should have gotten the leader!",
- ozoneManager.get().isLeaderReady());
+ assertNotNull(ozoneManager,"Timed out waiting OM leader election to
finish: "
Review Comment:
```suggestion
assertNotNull(ozoneManager, "Timed out waiting OM leader election to
finish: "
```
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/recon/TestReconWithOzoneManagerHA.java:
##########
@@ -128,7 +124,7 @@ public void testReconGetsSnapshotFromLeader() throws
Exception {
ozoneManager.get().getHttpServer().getHttpAddress().getPort() +
OZONE_DB_CHECKPOINT_HTTP_ENDPOINT;
String snapshotUrl = impl.getOzoneManagerSnapshotUrl();
- Assert.assertEquals("OM Snapshot should be requested from the leader.",
+ assertEquals("OM Snapshot should be requested from the leader.",
expectedUrl, snapshotUrl);
Review Comment:
JUnit5 assertions accept failure message as last parameter instead of first
one. So here `"OM Snapshot ..."` is used as `expected` value, which causes
test failure:
```
AssertionFailedError: http://localhost:15005/dbCheckpoint ==> expected: <OM
Snapshot should be requested from the leader.> but was:
<http://localhost:15005/dbCheckpoint>
at
org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
at
org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
at
org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
at
org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1156)
at
org.apache.hadoop.ozone.recon.TestReconWithOzoneManagerHA.testReconGetsSnapshotFromLeader(TestReconWithOzoneManagerHA.java:127)
```
Message should be last argument (or can be dropped completely).
```suggestion
assertEquals(expectedUrl, snapshotUrl);
```
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/recon/TestReconWithOzoneManagerHA.java:
##########
@@ -152,7 +148,7 @@ public void testReconGetsSnapshotFromLeader() throws
Exception {
(Table.KeyValue<ContainerKeyPrefix, Integer>) iterator.next();
reconKeyPrefix = keyValue.getKey().getKeyPrefix();
}
- Assert.assertEquals("Container data should be synced to recon.",
+ assertEquals("Container data should be synced to recon.",
String.format("/%s/%s/%s", VOL_NAME, VOL_NAME, keyPrefix),
reconKeyPrefix);
Review Comment:
```suggestion
assertEquals(
String.format("/%s/%s/%s", VOL_NAME, VOL_NAME, keyPrefix),
reconKeyPrefix);
```
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/recon/TestReconWithOzoneManagerHA.java:
##########
@@ -113,10 +110,9 @@ public void testReconGetsSnapshotFromLeader() throws
Exception {
ozoneManager.set(om);
return om != null;
}, 100, 120000);
- Assert.assertNotNull("Timed out waiting OM leader election to finish: "
- + "no leader or more than one leader.", ozoneManager);
- Assert.assertTrue("Should have gotten the leader!",
- ozoneManager.get().isLeaderReady());
+ assertNotNull(ozoneManager,"Timed out waiting OM leader election to
finish: "
+ + "no leader or more than one leader.");
+ assertTrue(ozoneManager.get().isLeaderReady(),"Should have gotten the
leader!");
Review Comment:
```suggestion
assertTrue(ozoneManager.get().isLeaderReady(), "Should have gotten the
leader!");
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]