From c91dea71c8d3f7cc84f336f0ba2aafc8ce1449c4 Mon Sep 17 00:00:00 2001 From: Sattvik Chakravarthy Date: Wed, 13 Mar 2024 20:20:10 +0530 Subject: [PATCH] fix: one million users --- .../postgresql/test/OneMillionUsersTest.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/test/java/io/supertokens/storage/postgresql/test/OneMillionUsersTest.java b/src/test/java/io/supertokens/storage/postgresql/test/OneMillionUsersTest.java index 1fd1cc1c..5f002be2 100644 --- a/src/test/java/io/supertokens/storage/postgresql/test/OneMillionUsersTest.java +++ b/src/test/java/io/supertokens/storage/postgresql/test/OneMillionUsersTest.java @@ -385,9 +385,9 @@ private void createSessions(Main main) throws Exception { @Test public void testCreatingOneMillionUsers() throws Exception { -// if (System.getenv("ONE_MILLION_USERS_TEST") == null) { -// return; -// } + if (System.getenv("ONE_MILLION_USERS_TEST") == null) { + return; + } String[] args = {"../"}; TestingProcessManager.TestingProcess process = TestingProcessManager.start(args, false); @@ -443,13 +443,18 @@ public void testCreatingOneMillionUsers() throws Exception { } sanityCheckAPIs(process.getProcess()); + allUserIds.clear(); + allPrimaryUserIds.clear(); + userIdMappings.clear(); + primaryUserIdMappings.clear(); + + process.kill(false); Runtime.getRuntime().gc(); System.gc(); System.runFinalization(); Thread.sleep(10000); - - process.kill(false); + process = TestingProcessManager.start(args, false); Utils.setValueInConfig("firebase_password_hashing_signer_key", "gRhC3eDeQOdyEn4bMd9c6kxguWVmcIVq/SKa0JDPFeM6TcEevkaW56sIWfx88OHbJKnCXdWscZx0l2WbCJ1wbg=="); @@ -487,7 +492,7 @@ public void testCreatingOneMillionUsers() throws Exception { memoryChecker.join(); System.out.println("Max memory used: " + (maxMemory.get() / (1024 * 1024)) + " MB"); - assert maxMemory.get() < 256 * 1024 * 1024; // must be less than 320 mb + assert maxMemory.get() < 256 * 1024 * 1024; // must be less than 256 mb process.kill(); assertNotNull(process.checkOrWaitForEvent(ProcessState.PROCESS_STATE.STOPPED));