Skip to content

Commit

Permalink
fix: fixing tests for ci
Browse files Browse the repository at this point in the history
  • Loading branch information
tamassoltesz committed Dec 21, 2024
1 parent 97bd271 commit d1461c3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
5 changes: 4 additions & 1 deletion src/main/java/io/supertokens/storage/mysql/Start.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import io.supertokens.pluginInterface.authRecipe.AuthRecipeUserInfo;
import io.supertokens.pluginInterface.authRecipe.LoginMethod;
import io.supertokens.pluginInterface.authRecipe.sqlStorage.AuthRecipeSQLStorage;
import io.supertokens.pluginInterface.bulkimport.BulkImportStorage;
import io.supertokens.pluginInterface.bulkimport.BulkImportUser;
import io.supertokens.pluginInterface.bulkimport.ImportUserBase;
import io.supertokens.pluginInterface.bulkimport.exceptions.BulkImportBatchInsertException;
Expand Down Expand Up @@ -947,6 +948,8 @@ public void addInfoToNonAuthRecipesBasedOnUserId(TenantIdentifier tenantIdentifi
/* Since JWT recipe tables do not store userId we do not add any data to them */
} else if (className.equals(OAuthStorage.class.getName())) {
/* Since OAuth recipe tables do not store userId we do not add any data to them */
} else if (className.equals(BulkImportStorage.class.getName())){
//ignore
} else if (className.equals(ActiveUsersStorage.class.getName())) {
try {
ActiveUsersQueries.updateUserLastActive(this, tenantIdentifier.toAppIdentifier(), userId);
Expand Down Expand Up @@ -3754,7 +3757,7 @@ public int getDbActivityCount(String dbname) throws SQLException, StorageQueryEx
});
}

@Override
@Override
public void addBulkImportUsers(AppIdentifier appIdentifier, List<BulkImportUser> users)
throws StorageQueryException,
TenantOrAppNotFoundException,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -991,9 +991,9 @@ public void testWithOneMillionUsers() throws Exception {
return;
}

Main main = startCronProcess(String.valueOf(NUM_THREADS));
Main main = startCronProcess(String.valueOf(16));

int NUMBER_OF_USERS_TO_UPLOAD = 1000000; // million
int NUMBER_OF_USERS_TO_UPLOAD = 500000; // half million

if (StorageLayer.getBaseStorage(main).getType() != STORAGE_TYPE.SQL || StorageLayer.isInMemDb(main)) {
return;
Expand All @@ -1007,11 +1007,12 @@ public void testWithOneMillionUsers() throws Exception {

// upload a bunch of users through the API
{
for (int i = 0; i < (NUMBER_OF_USERS_TO_UPLOAD / 10000); i++) {
JsonObject request = generateUsersJson(10000, i * 10000); // API allows 10k users upload at once
for (int i = 0; i < (NUMBER_OF_USERS_TO_UPLOAD / 1000); i++) {
JsonObject request = generateUsersJson(1000, i * 1000); // API allows 10k users upload at once
JsonObject response = uploadBulkImportUsersJson(main, request);
assertEquals("OK", response.get("status").getAsString());
System.out.println("Uploaded " + (i + 1) * 10000 + " users");
System.out.println("Uploaded " + (i + 1) * 1000 + " users");
Thread.sleep(1000);
}

}
Expand Down Expand Up @@ -1047,6 +1048,7 @@ public void testWithOneMillionUsers() throws Exception {
throw e;
}
}
System.out.println("Elapsed time: " + (System.currentTimeMillis() - processingStarted) / 1000 + " seconds");
Thread.sleep(5000);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public void testThatCUDRecoversWhenItFailsToAddEntryDuringCreation() throws Exce
fail();
} catch (HttpResponseException e) {
// ignore
assertEquals("Http error. Status Code: 500. Message: java.sql.SQLException: Simulated error in addTenantIdInTargetStorage", e.getMessage());
assertEquals("Http error. Status Code: 500. Message: io.supertokens.pluginInterface.exceptions.StorageQueryException: java.sql.SQLException: Simulated error in addTenantIdInTargetStorage", e.getMessage());
}

MultitenancyQueries.simulateErrorInAddingTenantIdInTargetStorage_forTesting = false;
Expand Down

0 comments on commit d1461c3

Please sign in to comment.