Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/test/java/io/supertokens/test/ActiveUsersTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void updateAndCountUserLastActiveTest() throws Exception {

assert ActiveUsers.countUsersActiveSince(main, now) == 2;

Thread.sleep(100);
Thread.sleep(1);

long now2 = System.currentTimeMillis();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ public void testGoodInput() throws Exception {
responseBody.addProperty("email", "random@gmail.com");
responseBody.addProperty("password", "validPass123");

Thread.sleep(1); // add a small delay to ensure a unique timestamp
long beforeSignIn = System.currentTimeMillis();

JsonObject signInResponse = HttpRequestForTesting.sendJsonPOSTRequest(process.getProcess(), "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void testBadInput() throws Exception {
return;
}

long beforeTestTs = System.currentTimeMillis();
long startTs = System.currentTimeMillis();

{
try {
Expand Down Expand Up @@ -111,7 +111,7 @@ public void testBadInput() throws Exception {
}
}

int activeUsers = ActiveUsers.countUsersActiveSince(process.getProcess(), beforeTestTs);
int activeUsers = ActiveUsers.countUsersActiveSince(process.getProcess(), startTs);
assert (activeUsers == 0);

process.kill();
Expand All @@ -130,7 +130,7 @@ public void testGoodInput() throws Exception {
return;
}

long beforeSignUpTs = System.currentTimeMillis();
long startTS = System.currentTimeMillis();

JsonObject signUpResponse = Utils.signUpRequest_2_5(process, "random@gmail.com", "validPass123");
assertEquals(signUpResponse.get("status").getAsString(), "OK");
Expand All @@ -140,7 +140,7 @@ public void testGoodInput() throws Exception {
assertEquals(signUpUser.get("email").getAsString(), "random@gmail.com");
assertNotNull(signUpUser.get("id"));

int activeUsers = ActiveUsers.countUsersActiveSince(process.getProcess(), beforeSignUpTs);
int activeUsers = ActiveUsers.countUsersActiveSince(process.getProcess(), startTS);
assert (activeUsers == 1);

UserInfo user = StorageLayer.getEmailPasswordStorage(process.getProcess())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ public void activeUsersTest() throws Exception {
request.add("userDataInDatabase", userDataInDatabase);
request.addProperty("enableAntiCsrf", false);

Thread.sleep(1); // Ensures a unique timestamp
long startTs = System.currentTimeMillis();

JsonObject sessionInfo = HttpRequestForTesting.sendJsonPOSTRequest(process.getProcess(), "",
Expand All @@ -452,6 +453,7 @@ public void activeUsersTest() throws Exception {
sessionInfo.get("refreshToken").getAsJsonObject().get("token").getAsString());
sessionRefreshBody.addProperty("enableAntiCsrf", false);

Thread.sleep(1); // ensures a unique timestamp
long afterSessionCreateTs = System.currentTimeMillis();

JsonObject sessionRefreshResponse = HttpRequestForTesting.sendJsonPOSTRequest(process.getProcess(), "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public void activeUsersTest() throws Exception {
assertEquals(s2Info.get("status").getAsString(), "OK");

// remove s2 and make sure they are returned

Thread.sleep(1); // ensures a unique timestamp
long checkpoint1 = System.currentTimeMillis();

JsonObject sessionRemoveBody = new JsonObject();
Expand Down Expand Up @@ -135,6 +135,7 @@ public void activeUsersTest() throws Exception {
"session");
assertEquals(session2Info.get("status").getAsString(), "OK");

Thread.sleep(1); // ensures a unique timestamp
long checkpoint1 = System.currentTimeMillis();

// remove session using user id
Expand Down