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@c6e44da98205b58d2db531a2f32a432b252204f2
@@ -69,7 +69,7 @@ public class ESNativeMigrateToolTests extends NativeRealmIntegTestCase {
public void testRetrieveUsers() throws Exception {
final Environment nodeEnvironment = nodeEnvironment();
String home = Environment.PATH_HOME_SETTING.get(nodeEnvironment.settings());
- String conf = nodeEnvironment.configFile().toString();
+ Path conf = nodeEnvironment.configFile();
SecurityClient c = new SecurityClient(client());
logger.error("--> creating users");
int numToAdd = randomIntBetween(1,10);
@@ -90,16 +90,16 @@ public class ESNativeMigrateToolTests extends NativeRealmIntegTestCase {
Settings.Builder builder = Settings.builder()
.put("path.home", home)
- .put("path.conf", conf);
+ .put("path.conf", conf.toString());
SecuritySettingsSource.addSSLSettingsForStore(builder,
"/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.jks", "testnode");
Settings settings = builder.build();
logger.error("--> retrieving users using URL: {}, home: {}", url, home);
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());
- 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());
for (String u : addedUsers) {
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);
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);
logger.info("--> output: \n{}", t.getOutput());;
for (String r : addedRoles) {
