From b3b81d6a7675b19e6a99f7edcc7ca3147c83a4f9 Mon Sep 17 00:00:00 2001 From: mhajas Date: Wed, 4 Apr 2018 11:19:18 +0200 Subject: [PATCH] KEYCLOAK-6806 timeSkew tolerance in tests (#5110) --- .../adapter/javascript/JavascriptAdapterTest.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/javascript/JavascriptAdapterTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/javascript/JavascriptAdapterTest.java index ac9a10f14d..b04f24107e 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/javascript/JavascriptAdapterTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/javascript/JavascriptAdapterTest.java @@ -464,9 +464,15 @@ public class JavascriptAdapterTest extends AbstractJavascriptTest { .add("refreshToken", refreshToken) .add("timeSkew", -600) , 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")) - .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);