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


##########
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 😅 
   So now we refresh once more due to mock time passing?



##########
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 😅 
   So now we refresh once more due to mock time passing?



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