KEYCLOAK-6806 timeSkew tolerance in tests (#5110)

This commit is contained in:
mhajas 2018-04-04 11:19:18 +02:00 committed by Stian Thorgersen
parent 0b2fe75828
commit b3b81d6a76

View file

@ -464,9 +464,15 @@ public class JavascriptAdapterTest extends AbstractJavascriptTest {
.add("refreshToken", refreshToken) .add("refreshToken", refreshToken)
.add("timeSkew", -600) .add("timeSkew", -600)
, this::assertSuccessfullyLoggedIn) , this::assertSuccessfullyLoggedIn)
.checkTimeSkew((driver1, output, events) -> assertThat(output, equalTo(-600L))) .checkTimeSkew((driver1, output, events) -> assertThat((Long) output, is(
both(greaterThan(-600L - TIME_SKEW_TOLERANCE))
.and(lessThan(-600L + TIME_SKEW_TOLERANCE))
)))
.refreshToken(9999, assertEventsContains("Auth Refresh Success")) .refreshToken(9999, assertEventsContains("Auth Refresh Success"))
.checkTimeSkew((driver1, output, events) -> assertThat(output, equalTo(-600L))); .checkTimeSkew((driver1, output, events) -> assertThat((Long) output, is(
both(greaterThan(-600L - TIME_SKEW_TOLERANCE))
.and(lessThan(-600L + TIME_SKEW_TOLERANCE))
)));
setTimeOffset(0); setTimeOffset(0);