Skip to content

Commit

Permalink
fix: update test
Browse files Browse the repository at this point in the history
  • Loading branch information
sattvikc committed Apr 16, 2024
1 parent 4b41024 commit 93030dc
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.google.gson.JsonObject;
import io.supertokens.Main;
import io.supertokens.ProcessState;
import io.supertokens.config.Config;
import io.supertokens.featureflag.EE_FEATURES;
import io.supertokens.featureflag.FeatureFlagTestContent;
import io.supertokens.featureflag.exceptions.FeatureNotEnabledException;
Expand All @@ -44,7 +45,10 @@
import org.junit.Before;
import org.junit.Test;

import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

import static org.junit.Assert.*;
import static io.supertokens.storage.postgresql.QueryExecutorTemplate.update;
Expand Down Expand Up @@ -205,6 +209,23 @@ public void testThatCoreDoesNotStartWithThereIsAnErrorDuringTenantCreation() thr
allTenants = MultitenancyHelper.getInstance(process.getProcess()).getAllTenants();
assertEquals(2, allTenants.length); // should have the new CUD

File errorLog = new File(Config.getConfig(process.getProcess()).getErrorLogPath(process.getProcess()));

boolean foundSimulatedError = false;

try (Scanner scanner = new Scanner(errorLog, StandardCharsets.UTF_8)) {
while (scanner.hasNextLine()) {
String line = scanner.nextLine();
System.out.println(line);
if (line.contains("Simulated error")) {
foundSimulatedError = true;
break;
}
}
}

assertTrue(foundSimulatedError);

MultitenancyQueries.simulateErrorInAddingTenantIdInTargetStorage = false;

// this should succeed now
Expand Down

0 comments on commit 93030dc

Please sign in to comment.