Fix retrieve roles and users tests

This commit removes the use of a now removed --path.conf command-line
flag from the retrieve roles and users tests.

Original commit: elastic/x-pack-elasticsearch@30d5f5f648
This commit is contained in:
Jason Tedor 2017-07-28 18:04:05 +09:00
parent e77db8faf4
commit 8176adfc26
1 changed files with 5 additions and 5 deletions

View File

@ -69,7 +69,7 @@ public class ESNativeMigrateToolTests extends NativeRealmIntegTestCase {
public void testRetrieveUsers() throws Exception { public void testRetrieveUsers() throws Exception {
final Environment nodeEnvironment = nodeEnvironment(); final Environment nodeEnvironment = nodeEnvironment();
String home = Environment.PATH_HOME_SETTING.get(nodeEnvironment.settings()); String home = Environment.PATH_HOME_SETTING.get(nodeEnvironment.settings());
String conf = nodeEnvironment.configFile().toString(); Path conf = nodeEnvironment.configFile();
SecurityClient c = new SecurityClient(client()); SecurityClient c = new SecurityClient(client());
logger.error("--> creating users"); logger.error("--> creating users");
int numToAdd = randomIntBetween(1,10); int numToAdd = randomIntBetween(1,10);
@ -90,16 +90,16 @@ public class ESNativeMigrateToolTests extends NativeRealmIntegTestCase {
Settings.Builder builder = Settings.builder() Settings.Builder builder = Settings.builder()
.put("path.home", home) .put("path.home", home)
.put("path.conf", conf); .put("path.conf", conf.toString());
SecuritySettingsSource.addSSLSettingsForStore(builder, SecuritySettingsSource.addSSLSettingsForStore(builder,
"/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.jks", "testnode"); "/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.jks", "testnode");
Settings settings = builder.build(); Settings settings = builder.build();
logger.error("--> retrieving users using URL: {}, home: {}", url, home); logger.error("--> retrieving users using URL: {}, home: {}", url, home);
OptionParser parser = muor.getParser(); OptionParser parser = muor.getParser();
OptionSet options = parser.parse("-u", username, "-p", password, "-U", url, "--path.conf", conf); OptionSet options = parser.parse("-u", username, "-p", password, "-U", url);
logger.info("--> options: {}", options.asMap()); logger.info("--> options: {}", options.asMap());
Set<String> users = muor.getUsersThatExist(t, settings, new Environment(settings), options); Set<String> users = muor.getUsersThatExist(t, settings, new Environment(settings, conf), options);
logger.info("--> output: \n{}", t.getOutput()); logger.info("--> output: \n{}", t.getOutput());
for (String u : addedUsers) { for (String u : addedUsers) {
assertThat("expected list to contain: " + u + ", real list: " + users, users.contains(u), is(true)); assertThat("expected list to contain: " + u + ", real list: " + users, users.contains(u), is(true));
@ -139,7 +139,7 @@ public class ESNativeMigrateToolTests extends NativeRealmIntegTestCase {
logger.error("--> retrieving roles using URL: {}, home: {}", url, home); logger.error("--> retrieving roles using URL: {}, home: {}", url, home);
OptionParser parser = muor.getParser(); OptionParser parser = muor.getParser();
OptionSet options = parser.parse("-u", username, "-p", password, "-U", url, "--path.conf", conf.toString()); OptionSet options = parser.parse("-u", username, "-p", password, "-U", url);
Set<String> roles = muor.getRolesThatExist(t, settings, new Environment(settings, conf), options); Set<String> roles = muor.getRolesThatExist(t, settings, new Environment(settings, conf), options);
logger.info("--> output: \n{}", t.getOutput());; logger.info("--> output: \n{}", t.getOutput());;
for (String r : addedRoles) { for (String r : addedRoles) {