nastra commented on code in PR #6990:
URL: https://github.com/apache/iceberg/pull/6990#discussion_r1123532700


##########
core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java:
##########
@@ -1037,71 +1037,75 @@ public void testCatalogTokenRefresh() throws Exception {
     catalog.initialize(
         "prod", ImmutableMap.of(CatalogProperties.URI, "ignored", 
"credential", "catalog:secret"));
 
-    Thread.sleep(3_000); // sleep until after 2 refresh calls
-
-    // call client credentials with no initial auth
-    Mockito.verify(adapter)
-        .execute(
-            eq(HTTPMethod.POST),
-            eq("v1/oauth/tokens"),
-            any(),
-            any(),
-            eq(OAuthTokenResponse.class),
-            eq(emptyHeaders),
-            any());
-
-    // use the client credential token for config
-    Mockito.verify(adapter)
-        .execute(
-            eq(HTTPMethod.GET),
-            eq("v1/config"),
-            any(),
-            any(),
-            eq(ConfigResponse.class),
-            eq(catalogHeaders),
-            any());
-
-    // verify the first token exchange
-    Map<String, String> firstRefreshRequest =
-        ImmutableMap.of(
-            "grant_type", "urn:ietf:params:oauth:grant-type:token-exchange",
-            "subject_token", "client-credentials-token:sub=catalog",
-            "subject_token_type", 
"urn:ietf:params:oauth:token-type:access_token",
-            "scope", "catalog");
-    Mockito.verify(adapter)
-        .execute(
-            eq(HTTPMethod.POST),
-            eq("v1/oauth/tokens"),
-            any(),
-            Mockito.argThat(firstRefreshRequest::equals),
-            eq(OAuthTokenResponse.class),
-            eq(catalogHeaders),
-            any());
-
-    // verify that a second exchange occurs
-    Map<String, String> secondRefreshRequest =
-        ImmutableMap.of(
-            "grant_type", "urn:ietf:params:oauth:grant-type:token-exchange",
-            "subject_token", 
"token-exchange-token:sub=client-credentials-token:sub=catalog",
-            "subject_token_type", 
"urn:ietf:params:oauth:token-type:access_token",
-            "scope", "catalog");
-    Map<String, String> secondRefreshHeaders =
-        ImmutableMap.of(
-            "Authorization",
-            "Bearer 
token-exchange-token:sub=client-credentials-token:sub=catalog");
-    Mockito.verify(adapter)
-        .execute(
-            eq(HTTPMethod.POST),
-            eq("v1/oauth/tokens"),
-            any(),
-            Mockito.argThat(secondRefreshRequest::equals),
-            eq(OAuthTokenResponse.class),
-            eq(secondRefreshHeaders),
-            any());
+    Awaitility.await()

Review Comment:
   We're relying here on the default polling delay, which should be fine for 
these tests, but note that this can be modified as outlined in 
https://github.com/awaitility/awaitility/wiki/Usage#polling



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