@@ -741,8 +741,12 @@ public void getExecutableResponse_oidcResponse() throws IOException, Interrupted
741741 assertTrue (response .isSuccessful ());
742742 assertEquals (TOKEN_TYPE_OIDC , response .getTokenType ());
743743 assertEquals (ID_TOKEN , response .getSubjectToken ());
744- assertEquals (
745- Instant .now ().getEpochSecond () + EXPIRATION_DURATION , (long ) response .getExpirationTime ());
744+ // The response's expirationTime is set to be the current time + EXPIRATION_DURATION
745+ // Comparing Instant.now().getEpochSecond() is flaky and dependant on VM performance
746+ // Only assert that the expirationTime is some time in the future from now
747+ assertTrue (
748+ Instant .now ().getEpochSecond ()
749+ < Instant .ofEpochSecond (response .getExpirationTime ()).getEpochSecond ());
746750 // Current env map should include the mappings from options.
747751 assertEquals (4 , currentEnv .size ());
748752 assertEquals (expectedMap , currentEnv );
@@ -788,8 +792,12 @@ public void getExecutableResponse_samlResponse() throws IOException, Interrupted
788792 assertTrue (response .isSuccessful ());
789793 assertEquals (TOKEN_TYPE_SAML , response .getTokenType ());
790794 assertEquals (SAML_RESPONSE , response .getSubjectToken ());
791- assertEquals (
792- Instant .now ().getEpochSecond () + EXPIRATION_DURATION , (long ) response .getExpirationTime ());
795+ // The response's expirationTime is set to be the current time + EXPIRATION_DURATION
796+ // Comparing Instant.now().getEpochSecond() is flaky and dependant on VM performance
797+ // Only assert that the expirationTime is some time in the future from now
798+ assertTrue (
799+ Instant .now ().getEpochSecond ()
800+ < Instant .ofEpochSecond (response .getExpirationTime ()).getEpochSecond ());
793801
794802 // Current env map should include the mappings from options.
795803 assertEquals (4 , currentEnv .size ());
0 commit comments