Fix uncaught checked exception in AzureTestUtils

This commit fixes an uncaught checked IOException now thrown in
AzureTestUtils after 3adaf096758a6015ca4f733e2e49ee5528ac3cd5.
This commit is contained in:
Jason Tedor 2016-06-03 14:17:25 -04:00
parent bbd5f26d45
commit 974c753bf6

View File

@ -24,6 +24,8 @@ import org.elasticsearch.common.io.PathUtils;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.settings.SettingsException;
import java.io.IOException;
public class AzureTestUtils {
/**
* Read settings from file when running integration tests with ThirdParty annotation.
@ -36,7 +38,11 @@ public class AzureTestUtils {
// if explicit, just load it and don't load from env
try {
if (Strings.hasText(System.getProperty("tests.config"))) {
settings.loadFromPath(PathUtils.get((System.getProperty("tests.config"))));
try {
settings.loadFromPath(PathUtils.get((System.getProperty("tests.config"))));
} catch (IOException e) {
throw new IllegalArgumentException("could not load azure tests config", e);
}
} else {
throw new IllegalStateException("to run integration tests, you need to set -Dtests.thirdparty=true and " +
"-Dtests.config=/path/to/elasticsearch.yml");