Skip to content

Commit

Permalink
[Backport 2.x] Fix Bug with Install demo configuration running in clu…
Browse files Browse the repository at this point in the history
…ster mode with -y (#3936)

Backport f217fa8 from #3935.

Signed-off-by: Derek Ho <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent f58e99d commit 9ff7521
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,6 @@ void gatherUserInputs() {
cluster_mode = confirmAction(scanner, "Enable cluster mode?");
}
}
} else {
initsecurity = true;
cluster_mode = true;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ public void testGatherInputs_withAssumeYes() {

installer.gatherUserInputs();

assertThat(installer.initsecurity, is(true));
assertThat(installer.cluster_mode, is(true));
assertThat(installer.initsecurity, is(false));
assertThat(installer.cluster_mode, is(false));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,18 @@ public void testIsStringAlreadyPresentInFile_isPresent() throws IOException {
assertThat(isKeyPresentInYMLFile(installer.OPENSEARCH_CONF_FILE, str2), is(equalTo(false)));
}

@Test
public void testAssumeYesDoesNotInitializeClusterMode() throws IOException {
String nodeName = "node.name"; // cluster_mode
String securityIndex = "plugins.security.allow_default_init_securityindex"; // init_security

installer.assumeyes = true;
securitySettingsConfigurer.writeSecurityConfigToOpenSearchYML();

assertThat(isKeyPresentInYMLFile(installer.OPENSEARCH_CONF_FILE, nodeName), is(false));
assertThat(isKeyPresentInYMLFile(installer.OPENSEARCH_CONF_FILE, securityIndex), is(false));
}

@Test
public void testCreateSecurityAdminDemoScriptAndGetSecurityAdminCommands() throws IOException {
String demoPath = installer.OPENSEARCH_CONF_DIR + "securityadmin_demo" + installer.FILE_EXTENSION;
Expand Down

0 comments on commit 9ff7521

Please sign in to comment.