ChenSammi commented on code in PR #5525:
URL: https://github.com/apache/ozone/pull/5525#discussion_r1381412356


##########
hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/security/x509/certificate/client/TestRootCaRotationPoller.java:
##########
@@ -77,24 +77,18 @@ public void testPollerDoesNotInvokeRootCaProcessor() throws 
Exception {
     certsFromScm.add(CertificateCodec.getPEMEncodedString(knownCert));
     RootCaRotationPoller poller = new RootCaRotationPoller(secConf,
         knownCerts, scmSecurityClient, "");
-
+    //When the scm returns the same set of root ca certificates, and they poll
+    //for them
     Mockito.when(scmSecurityClient.getAllRootCaCertificates())
         .thenReturn(certsFromScm);
-    AtomicBoolean atomicBoolean = new AtomicBoolean();
-    atomicBoolean.set(false);
-    poller.addRootCARotationProcessor(
-        certificates -> CompletableFuture.supplyAsync(() -> {
-          atomicBoolean.set(true);
-          Assertions.assertEquals(certificates.size(), 2);
-          return null;
-        }));
-    poller.run();
-    Assertions.assertThrows(TimeoutException.class, () ->
-        GenericTestUtils.waitFor(atomicBoolean::get, 50, 5000));
+    //Then assume that the rootCaRotationProcessors weren't invoked
+    Assertions.assertFalse(poller.pollRootCas());

Review Comment:
   If we just check the poller.pollRootCas() status, then this test doesn't 
match the test function name, as the invoke is not checked.  The way used in 
testPollerRetriesAfterFailure() can be used here too.



-- 
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]

Reply via email to