Skip to content

Commit 12037be

Browse files
SattvikSattvik
authored andcommitted
fix: tests
1 parent 093ac7d commit 12037be

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/test/java/io/supertokens/storage/postgresql/test/ConfigTest.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ public void testThatInvalidConfigThrowsRightError() throws Exception {
120120
public void testThatMissingConfigFileThrowsError() throws Exception {
121121
String[] args = {"../"};
122122

123-
ProcessBuilder pb = new ProcessBuilder("rm", "-r", "config.yaml");
123+
String workerId = System.getProperty("org.gradle.test.worker");
124+
ProcessBuilder pb = new ProcessBuilder("rm", "-r", "config" + workerId + ".yaml");
124125
pb.directory(new File(args[0]));
125126
Process process1 = pb.start();
126127
process1.waitFor();
@@ -130,7 +131,7 @@ public void testThatMissingConfigFileThrowsError() throws Exception {
130131
ProcessState.EventAndException e = process.checkOrWaitForEvent(ProcessState.PROCESS_STATE.INIT_FAILURE);
131132
assertNotNull(e);
132133
TestCase.assertEquals(e.exception.getMessage(),
133-
"../config.yaml (No such file or directory)");
134+
"config" + workerId + ".yaml (No such file or directory)");
134135

135136
process.kill();
136137
assertNotNull(process.checkOrWaitForEvent(ProcessState.PROCESS_STATE.STOPPED));
@@ -468,7 +469,8 @@ public void testAddingSchemaViaConnectionUriWorks3() throws Exception {
468469
@Test
469470
public void testValidConnectionURI() throws Exception {
470471
final ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
471-
PostgreSQLConfig userConfig = mapper.readValue(new File("../config.yaml"), PostgreSQLConfig.class);
472+
String workerId = System.getProperty("org.gradle.test.worker");
473+
PostgreSQLConfig userConfig = mapper.readValue(new File("../config" + workerId + ".yaml"), PostgreSQLConfig.class);
472474
userConfig.validateAndNormalise();
473475

474476
String hostname = userConfig.getHostName();
@@ -573,7 +575,8 @@ public void testValidConnectionURI() throws Exception {
573575
@Test
574576
public void testInvalidConnectionURI() throws Exception {
575577
final ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
576-
PostgreSQLConfig userConfig = mapper.readValue(new File("../config.yaml"), PostgreSQLConfig.class);
578+
String workerId = System.getProperty("org.gradle.test.worker");
579+
PostgreSQLConfig userConfig = mapper.readValue(new File("../config" + workerId + ".yaml"), PostgreSQLConfig.class);
577580
userConfig.validateAndNormalise();
578581

579582
String hostname = userConfig.getHostName();
@@ -620,7 +623,8 @@ public void testInvalidConnectionURI() throws Exception {
620623
@Test
621624
public void testValidConnectionURIAttributes() throws Exception {
622625
final ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
623-
PostgreSQLConfig userConfig = mapper.readValue(new File("../config.yaml"), PostgreSQLConfig.class);
626+
String workerId = System.getProperty("org.gradle.test.worker");
627+
PostgreSQLConfig userConfig = mapper.readValue(new File("../config" + workerId + ".yaml"), PostgreSQLConfig.class);
624628
userConfig.validateAndNormalise();
625629
String hostname = userConfig.getHostName();
626630
{
@@ -674,7 +678,8 @@ public void testAllConfigsHaveAnAnnotation() throws Exception {
674678

675679
public static void checkConfig(PostgreSQLConfig config) throws IOException, InvalidConfigException {
676680
final ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
677-
PostgreSQLConfig userConfig = mapper.readValue(new File("../config.yaml"), PostgreSQLConfig.class);
681+
String workerId = System.getProperty("org.gradle.test.worker");
682+
PostgreSQLConfig userConfig = mapper.readValue(new File("../config" + workerId + ".yaml"), PostgreSQLConfig.class);
678683
userConfig.validateAndNormalise();
679684

680685
String hostname = userConfig.getHostName();

0 commit comments

Comments
 (0)