explicitly enable http when running plugin tests
add an option to force a setting when building a node, overriding if its explicitly set as system property
This commit is contained in:
parent
9cb54c0f2e
commit
8f21d2831a
|
@ -27,6 +27,8 @@ import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.env.Environment;
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.env.FailedToResolveConfigException;
|
import org.elasticsearch.env.FailedToResolveConfigException;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import static org.elasticsearch.common.Strings.cleanPath;
|
import static org.elasticsearch.common.Strings.cleanPath;
|
||||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||||
|
|
||||||
|
@ -97,6 +99,16 @@ public class InternalSettingsPreparer {
|
||||||
}
|
}
|
||||||
settingsBuilder.replacePropertyPlaceholders();
|
settingsBuilder.replacePropertyPlaceholders();
|
||||||
|
|
||||||
|
// allow to force set properties based on configuration of the settings provided
|
||||||
|
for (Map.Entry<String, String> entry : pSettings.getAsMap().entrySet()) {
|
||||||
|
String setting = entry.getKey();
|
||||||
|
if (setting.startsWith("force.")) {
|
||||||
|
settingsBuilder.remove(setting);
|
||||||
|
settingsBuilder.put(setting.substring(".force".length()), entry.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
settingsBuilder.replacePropertyPlaceholders();
|
||||||
|
|
||||||
// generate the name
|
// generate the name
|
||||||
if (settingsBuilder.get("name") == null) {
|
if (settingsBuilder.get("name") == null) {
|
||||||
String name = System.getProperty("name");
|
String name = System.getProperty("name");
|
||||||
|
|
|
@ -45,10 +45,12 @@ import java.net.URL;
|
||||||
|
|
||||||
import static org.hamcrest.CoreMatchers.*;
|
import static org.hamcrest.CoreMatchers.*;
|
||||||
|
|
||||||
@ClusterScope(scope=Scope.TEST, numNodes=0)
|
@ClusterScope(scope = Scope.TEST, numNodes = 0)
|
||||||
public class PluginManagerTests extends AbstractIntegrationTest {
|
public class PluginManagerTests extends AbstractIntegrationTest {
|
||||||
private static final Settings SETTINGS = ImmutableSettings.settingsBuilder()
|
private static final Settings SETTINGS = ImmutableSettings.settingsBuilder()
|
||||||
.put("discovery.zen.ping.multicast.enabled", false).build();
|
.put("discovery.zen.ping.multicast.enabled", false)
|
||||||
|
.put("force.http.enabled", true)
|
||||||
|
.build();
|
||||||
private static final String PLUGIN_DIR = "plugins";
|
private static final String PLUGIN_DIR = "plugins";
|
||||||
|
|
||||||
@After
|
@After
|
||||||
|
@ -211,7 +213,8 @@ public class PluginManagerTests extends AbstractIntegrationTest {
|
||||||
* We are ignoring by default these tests as they require to have an internet access
|
* We are ignoring by default these tests as they require to have an internet access
|
||||||
* To activate the test, use -Dtests.network=true
|
* To activate the test, use -Dtests.network=true
|
||||||
*/
|
*/
|
||||||
@Test @Network
|
@Test
|
||||||
|
@Network
|
||||||
public void testInstallPluginWithInternet() throws IOException {
|
public void testInstallPluginWithInternet() throws IOException {
|
||||||
// We test regular form: username/reponame/version
|
// We test regular form: username/reponame/version
|
||||||
// It should find it in download.elasticsearch.org service
|
// It should find it in download.elasticsearch.org service
|
||||||
|
|
|
@ -39,12 +39,16 @@ import static org.hamcrest.Matchers.equalTo;
|
||||||
/**
|
/**
|
||||||
* Test a rest action that sets special response headers
|
* Test a rest action that sets special response headers
|
||||||
*/
|
*/
|
||||||
@ClusterScope(scope=Scope.SUITE, numNodes=1)
|
@ClusterScope(scope = Scope.SUITE, numNodes = 1)
|
||||||
public class ResponseHeaderPluginTests extends AbstractIntegrationTest {
|
public class ResponseHeaderPluginTests extends AbstractIntegrationTest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Settings nodeSettings(int nodeOrdinal) {
|
protected Settings nodeSettings(int nodeOrdinal) {
|
||||||
return ImmutableSettings.settingsBuilder().put("plugin.types", TestResponseHeaderPlugin.class.getName()).put(super.nodeSettings(nodeOrdinal)).build();
|
return ImmutableSettings.settingsBuilder()
|
||||||
|
.put("plugin.types", TestResponseHeaderPlugin.class.getName())
|
||||||
|
.put("force.http.enabled", true)
|
||||||
|
.put(super.nodeSettings(nodeOrdinal))
|
||||||
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -39,7 +39,7 @@ import static org.hamcrest.Matchers.equalTo;
|
||||||
/**
|
/**
|
||||||
* We want to test site plugins
|
* We want to test site plugins
|
||||||
*/
|
*/
|
||||||
@ClusterScope(scope=Scope.SUITE, numNodes=1)
|
@ClusterScope(scope = Scope.SUITE, numNodes = 1)
|
||||||
public class SitePluginTests extends AbstractIntegrationTest {
|
public class SitePluginTests extends AbstractIntegrationTest {
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,6 +50,7 @@ public class SitePluginTests extends AbstractIntegrationTest {
|
||||||
return settingsBuilder()
|
return settingsBuilder()
|
||||||
.put(super.nodeSettings(nodeOrdinal))
|
.put(super.nodeSettings(nodeOrdinal))
|
||||||
.put("path.plugins", pluginDir.getAbsolutePath())
|
.put("path.plugins", pluginDir.getAbsolutePath())
|
||||||
|
.put("force.http.enabled", true)
|
||||||
.build();
|
.build();
|
||||||
} catch (URISyntaxException ex) {
|
} catch (URISyntaxException ex) {
|
||||||
throw new RuntimeException(ex);
|
throw new RuntimeException(ex);
|
||||||
|
|
Loading…
Reference in New Issue