Skip to content

Commit

Permalink
Updates tests to reflect to changes around buildOptions
Browse files Browse the repository at this point in the history
Signed-off-by: Darshit Chanpura <[email protected]>
  • Loading branch information
DarshitChanpura committed Dec 11, 2023
1 parent 74c36b6 commit 99d6356
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -424,4 +424,12 @@ void finishScriptExecution() {
System.out.println(e.getMessage());
}
}

/**
* FOR TESTS ONLY
* resets the installer state to allow testing with fresh instance for the next test.
*/
static void resetInstance() {
instance = null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ public class CertificateGeneratorTests {
@Before
public void setUp() {
installer = Installer.getInstance();
installer.buildOptions();
installer.OPENSEARCH_CONF_DIR = System.getProperty("user.dir") + File.separator + "test-conf";
createDirectory(installer.OPENSEARCH_CONF_DIR);
}

@After
public void tearDown() {

deleteDirectoryRecursive(installer.OPENSEARCH_CONF_DIR);
Installer.resetInstance();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public class InstallerTests {
public void setUpStreams() {
System.setOut(new PrintStream(outContent));
installer = Installer.getInstance();
installer.buildOptions();
}

@After
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public class SecuritySettingsConfigurerTests {
public void setUp() {
System.setOut(new PrintStream(outContent));
installer = Installer.getInstance();
installer.buildOptions();
securitySettingsConfigurer = new SecuritySettingsConfigurer(installer);
setUpConf();
}
Expand All @@ -73,7 +74,7 @@ public void tearDown() throws NoSuchFieldException, IllegalAccessException {
System.setOut(originalOut);
System.setIn(originalIn);
deleteDirectoryRecursive(installer.OPENSEARCH_CONF_DIR);
installer.environment = ExecutionEnvironment.DEMO;
// installer.environment = ExecutionEnvironment.DEMO;
unsetEnv(adminPasswordKey);
Installer.resetInstance();
}
Expand Down

0 comments on commit 99d6356

Please sign in to comment.