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@c37050894c
This commit is contained in:
Jason Tedor 2017-07-28 21:33:54 +09:00
parent 21b437e140
commit 826df4eb72

View File

@ -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;
@ -49,10 +50,11 @@ public class MigrateToolIT extends MigrateToolTestCase {
assertTrue(pur.created());
}
@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 +62,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());