Skip to content

Commit 1b52a6f

Browse files
author
Rishabh
committed
fixes how config value is changed in tests
1 parent 2742f29 commit 1b52a6f

File tree

1 file changed

+10
-7
lines changed
  • src/test/java/io/supertokens/storage/postgresql/test

1 file changed

+10
-7
lines changed

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

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ static void reset() {
8080
Main.makeConsolePrintSilent = true;
8181
String installDir = "../";
8282
try {
83-
// if the default config is not the same as the current config, we must reset the storage layer
83+
// if the default config is not the same as the current config, we must reset
84+
// the storage layer
8485
File ogConfig = new File("../temp/config.yaml");
8586
File currentConfig = new File("../config.yaml");
8687
if (currentConfig.isFile()) {
@@ -129,11 +130,12 @@ public void write(int b) {
129130
}
130131

131132
public static void setValueInConfig(String key, String value) throws FileNotFoundException, IOException {
132-
// we close the storage layer since there might be a change in the db related config.
133+
// we close the storage layer since there might be a change in the db related
134+
// config.
133135
StorageLayer.close();
134136

135-
String oldStr = "((#\\s)?)" + key + "(:|((:\\s).+))\n";
136-
String newStr = key + ": " + value + "\n";
137+
String oldStr = "\n((#\\s)?)" + key + "(:|((:\\s).+))\n";
138+
String newStr = "\n" + key + ": " + value + "\n";
137139
StringBuilder originalFileContent = new StringBuilder();
138140
try (BufferedReader reader = new BufferedReader(new FileReader("../config.yaml"))) {
139141
String currentReadingLine = reader.readLine();
@@ -149,11 +151,12 @@ public static void setValueInConfig(String key, String value) throws FileNotFoun
149151
}
150152

151153
public static void commentConfigValue(String key) throws IOException {
152-
// we close the storage layer since there might be a change in the db related config.
154+
// we close the storage layer since there might be a change in the db related
155+
// config.
153156
StorageLayer.close();
154157

155-
String oldStr = "((#\\s)?)" + key + "(:|((:\\s).+))\n";
156-
String newStr = "# " + key + ":";
158+
String oldStr = "\n((#\\s)?)" + key + "(:|((:\\s).+))\n";
159+
String newStr = "\n# " + key + ":";
157160

158161
StringBuilder originalFileContent = new StringBuilder();
159162
try (BufferedReader reader = new BufferedReader(new FileReader("../config.yaml"))) {

0 commit comments

Comments
 (0)