Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed testServerTime test #106

Merged
merged 5 commits into from
Nov 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions library/src/androidTest/java/IntegrationTests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,14 @@ class IntegrationTests {
val date = future.get(20, TimeUnit.SECONDS)
Assert.assertNotNull(date)

// Sometimes the CI or the emulator on the CI are behind with time because emulator boot takes some time.
// To verify that the time makes sense (the diff is not like hours or days) we accept 10 minus window.
val maxDiffSeconds = 60 * 10

val secDiff = kotlin.math.abs(date.toEpochSecond() - ZonedDateTime.now().toEpochSecond())
// if the difference between the server and the device is more than 20 seconds, there is something wrong with the server
// or there is a bug. Both cases needs a fix
Assert.assertTrue(secDiff < 20)
// If the difference between the server and the device is more than the limit, there is something wrong with the server
// or there is a bug. Both cases need a fix.
Assert.assertTrue("Difference is $secDiff seconds, but max $maxDiffSeconds seconds is allowed", secDiff < maxDiffSeconds)
}

// 1FA test are temporally disabled
Expand Down
Loading