@@ -59,18 +59,8 @@ public void beforeEach() {
5959 Utils .reset ();
6060 }
6161
62- @ Test
63- public void testUserCreationLinkingAndGetByIdSpeeds () throws Exception {
64- String [] args = {"../" };
65- TestingProcessManager .TestingProcess process = TestingProcessManager .start (args , false );
66- Utils .setValueInConfig ("postgresql_connection_pool_size" , "100" );
67- Utils .setValueInConfig ("mysql_connection_pool_size" , "100" );
68-
69- FeatureFlagTestContent .getInstance (process .getProcess ())
70- .setKeyValue (FeatureFlagTestContent .ENABLED_FEATURES , new EE_FEATURES []{
71- EE_FEATURES .ACCOUNT_LINKING , EE_FEATURES .MULTI_TENANCY });
72- process .startProcess ();
73- assertNotNull (process .checkOrWaitForEvent (ProcessState .PROCESS_STATE .STARTED ));
62+ public void testUserCreationLinkingAndGetByIdSpeedsCommon (TestingProcessManager .TestingProcess process ,
63+ long createTime , long linkingTime , long getTime ) throws Exception {
7464
7565 if (StorageLayer .getStorage (process .getProcess ()).getType () != STORAGE_TYPE .SQL ) {
7666 return ;
@@ -81,6 +71,7 @@ public void testUserCreationLinkingAndGetByIdSpeeds() throws Exception {
8171 }
8272
8373 int numberOfUsers = 10000 ;
74+
8475 List <String > userIds = new ArrayList <>();
8576 List <String > userIds2 = new ArrayList <>();
8677 Lock lock = new ReentrantLock ();
@@ -108,7 +99,7 @@ public void testUserCreationLinkingAndGetByIdSpeeds() throws Exception {
10899
109100 long end = System .currentTimeMillis ();
110101 System .out .println ("Created users " + numberOfUsers + " in " + (end - start ) + "ms" );
111- assert end - start < 25000 ; // 25 sec
102+ assert end - start < createTime ; // 25 sec
112103 }
113104
114105 Thread .sleep (10000 ); // wait for index
@@ -148,7 +139,7 @@ public void testUserCreationLinkingAndGetByIdSpeeds() throws Exception {
148139 es .awaitTermination (5 , TimeUnit .MINUTES );
149140 long end = System .currentTimeMillis ();
150141 System .out .println ("Accounts linked in " + (end - start ) + "ms" );
151- assert end - start < 50000 ; // 50 sec
142+ assert end - start < linkingTime ; // 50 sec
152143 }
153144
154145 Thread .sleep (10000 ); // wait for index
@@ -169,10 +160,44 @@ public void testUserCreationLinkingAndGetByIdSpeeds() throws Exception {
169160 es .awaitTermination (5 , TimeUnit .MINUTES );
170161 long end = System .currentTimeMillis ();
171162 System .out .println ("Time taken for " + numberOfUsers + " users: " + (end - start ) + "ms" );
172- assert end - start < 20000 ; // 20 sec
163+ assert end - start < getTime ; // 20 sec
173164 }
174165
175166 process .kill ();
176167 assertNotNull (process .checkOrWaitForEvent (ProcessState .PROCESS_STATE .STOPPED ));
177168 }
169+
170+ @ Test
171+ public void testUserCreationLinkingAndGetByIdSpeedsWithoutMinIdle () throws Exception {
172+ String [] args = {"../" };
173+ TestingProcessManager .TestingProcess process = TestingProcessManager .start (args , false );
174+ Utils .setValueInConfig ("postgresql_connection_pool_size" , "100" );
175+ Utils .setValueInConfig ("mysql_connection_pool_size" , "100" );
176+
177+ FeatureFlagTestContent .getInstance (process .getProcess ())
178+ .setKeyValue (FeatureFlagTestContent .ENABLED_FEATURES , new EE_FEATURES []{
179+ EE_FEATURES .ACCOUNT_LINKING , EE_FEATURES .MULTI_TENANCY });
180+ process .startProcess ();
181+ assertNotNull (process .checkOrWaitForEvent (ProcessState .PROCESS_STATE .STARTED ));
182+
183+ testUserCreationLinkingAndGetByIdSpeedsCommon (process , 25000 , 50000 , 20000 );
184+ }
185+
186+ @ Test
187+ public void testUserCreationLinkingAndGetByIdSpeedsWithMinIdle () throws Exception {
188+ String [] args = {"../" };
189+ TestingProcessManager .TestingProcess process = TestingProcessManager .start (args , false );
190+ Utils .setValueInConfig ("postgresql_connection_pool_size" , "100" );
191+ Utils .setValueInConfig ("mysql_connection_pool_size" , "100" );
192+ Utils .setValueInConfig ("postgresql_minimum_idle_connections" , "1" );
193+ Utils .setValueInConfig ("mysql_minimum_idle_connections" , "1" );
194+
195+ FeatureFlagTestContent .getInstance (process .getProcess ())
196+ .setKeyValue (FeatureFlagTestContent .ENABLED_FEATURES , new EE_FEATURES []{
197+ EE_FEATURES .ACCOUNT_LINKING , EE_FEATURES .MULTI_TENANCY });
198+ process .startProcess ();
199+ assertNotNull (process .checkOrWaitForEvent (ProcessState .PROCESS_STATE .STARTED ));
200+
201+ testUserCreationLinkingAndGetByIdSpeedsCommon (process , 60000 , 50000 , 20000 );
202+ }
178203}
0 commit comments