timothyw553 commented on code in PR #18910:
URL: https://github.com/apache/iceberg/pull/18910#discussion_r4724964509
##########
core/src/test/java/org/apache/iceberg/rest/auth/TestOAuth2Util.java:
##########
@@ -206,6 +227,36 @@ void refreshUsesRefreshedTokenExpiry() throws IOException {
}
}
+ @Test
+ void refreshOpaqueTokenUsesExpiresIn() throws IOException {
+ AuthConfig authConfig =
+ AuthConfig.builder()
+ .token("opaque-access-token")
+ .tokenType(OAuth2Properties.ACCESS_TOKEN_TYPE)
+ .keepRefreshed(true)
+ .exchangeEnabled(false)
+ .credential("testClientId:testClientSecret")
+ .oauth2ServerUri("/v1/token")
+ .build();
+
+ OAuthTokenResponse response =
childTokenResponse("refreshed-opaque-access-token", 500);
+
+ try (RESTClient client = Mockito.mock(RESTClient.class);
+ AuthSession session = new AuthSession(Map.of(), authConfig)) {
+ Mockito.when(client.postForm(any(), anyMap(), any(), anyMap(),
any())).thenReturn(response);
+
+ long beforeRefreshMillis = System.currentTimeMillis();
+ session.refresh(client);
+ long afterRefreshMillis = System.currentTimeMillis();
+
+ assertThat(session.expiresAtMillis())
Review Comment:
since this succeeds on the first attempt, it would still pass if
`requestStartMillis` were captured once before retries instead of per attempt.
could we make the first attempt fail and verify `expiresAtMillis` is measured
from the successful retry's start time?
--
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]