kirktrue commented on code in PR #14888:
URL: https://github.com/apache/kafka/pull/14888#discussion_r1412678216


##########
clients/src/test/java/org/apache/kafka/common/security/oauthbearer/internals/secured/RefreshingHttpsJwksTest.java:
##########
@@ -134,6 +136,20 @@ public void testSecondaryRefreshAfterElapsedDelay() throws 
Exception {
         String keyId = "abc123";
         MockTime time = new MockTime();
         HttpsJwks httpsJwks = spyHttpsJwks();
+
+        try (RefreshingHttpsJwks refreshingHttpsJwks = 
getRefreshingHttpsJwks(time, httpsJwks, mockExecutorService(time))) {
+            refreshingHttpsJwks.init();
+            // We refresh once at the initialization time from getJsonWebKeys.
+            verify(httpsJwks, times(1)).refresh();
+            assertTrue(refreshingHttpsJwks.maybeExpediteRefresh(keyId));
+            verify(httpsJwks, times(2)).refresh();
+            time.sleep(REFRESH_MS + 1);

Review Comment:
   > Why were we using real time here at all 😅
   
   This test has been using `MockTime` since the start, though 😕



##########
clients/src/test/java/org/apache/kafka/common/security/oauthbearer/internals/secured/RefreshingHttpsJwksTest.java:
##########
@@ -134,6 +136,20 @@ public void testSecondaryRefreshAfterElapsedDelay() throws 
Exception {
         String keyId = "abc123";
         MockTime time = new MockTime();
         HttpsJwks httpsJwks = spyHttpsJwks();
+
+        try (RefreshingHttpsJwks refreshingHttpsJwks = 
getRefreshingHttpsJwks(time, httpsJwks, mockExecutorService(time))) {
+            refreshingHttpsJwks.init();
+            // We refresh once at the initialization time from getJsonWebKeys.
+            verify(httpsJwks, times(1)).refresh();
+            assertTrue(refreshingHttpsJwks.maybeExpediteRefresh(keyId));
+            verify(httpsJwks, times(2)).refresh();
+            time.sleep(REFRESH_MS + 1);

Review Comment:
   > Why were we using real time here at all 😅
   
   This test has been using `MockTime` since the start, though 😕



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to