Fix migrate tool integration test
The command line flag --path.conf was removed yet this test was still
using it. This commit replaces the usage of this flag in this test with
the new mechanism.
Original commit: elastic/x-pack-elasticsearch@92e7fb07acf4c55f258d4f9848dcef27f15188d4
@@ -28,6 +28,7 @@ import org.elasticsearch.xpack.security.client.SecurityClient;
import org.elasticsearch.xpack.security.user.User;
import org.junit.Before;
+import java.nio.file.Path;
import java.util.Arrays;
import java.util.Collections;
@@ -51,8 +52,10 @@ public class MigrateToolIT extends MigrateToolTestCase {
@AwaitsFix(bugUrl = "https://github.com/elastic/x-pack-elasticsearch/issues/2114")
public void testRunMigrateTool() throws Exception {
- logger.info("--> CONF: {}", System.getProperty("tests.config.dir"));
- Settings settings = Settings.builder().put("path.home", PathUtils.get(System.getProperty("tests.config.dir")).getParent()).build();
+ final String testConfigDir = System.getProperty("tests.config.dir");
+ logger.info("--> CONF: {}", testConfigDir);
+ final Path configPath = PathUtils.get(testConfigDir);
+ Settings settings = Settings.builder().put("path.home", configPath.getParent()).build();
// Cluster should already be up
String url = "http://" + getHttpURL();
logger.info("--> using URL: {}", url);
@@ -60,9 +63,8 @@ public class MigrateToolIT extends MigrateToolTestCase {
ESNativeRealmMigrateTool.MigrateUserOrRoles muor = new ESNativeRealmMigrateTool.MigrateUserOrRoles();
OptionParser parser = muor.getParser();
- OptionSet options = parser.parse("-u", "test_admin", "-p", "x-pack-test-password", "-U", url,
- "--path.conf", System.getProperty("tests.config.dir"));
- muor.execute(t, options, new Environment(settings));
+ OptionSet options = parser.parse("-u", "test_admin", "-p", "x-pack-test-password", "-U", url);
+ muor.execute(t, options, new Environment(settings, configPath));
logger.info("--> output:\n{}", t.getOutput());
