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.FailedToResolveConfigException;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static org.elasticsearch.common.Strings.cleanPath;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
|
||||
|
@ -97,6 +99,16 @@ public class InternalSettingsPreparer {
|
|||
}
|
||||
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
|
||||
if (settingsBuilder.get("name") == null) {
|
||||
String name = System.getProperty("name");
|
||||
|
|
|
@ -45,10 +45,12 @@ import java.net.URL;
|
|||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
|
||||
@ClusterScope(scope=Scope.TEST, numNodes=0)
|
||||
@ClusterScope(scope = Scope.TEST, numNodes = 0)
|
||||
public class PluginManagerTests extends AbstractIntegrationTest {
|
||||
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";
|
||||
|
||||
@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
|
||||
* To activate the test, use -Dtests.network=true
|
||||
*/
|
||||
@Test @Network
|
||||
@Test
|
||||
@Network
|
||||
public void testInstallPluginWithInternet() throws IOException {
|
||||
// We test regular form: username/reponame/version
|
||||
// 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
|
||||
*/
|
||||
@ClusterScope(scope=Scope.SUITE, numNodes=1)
|
||||
@ClusterScope(scope = Scope.SUITE, numNodes = 1)
|
||||
public class ResponseHeaderPluginTests extends AbstractIntegrationTest {
|
||||
|
||||
@Override
|
||||
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
|
||||
|
|
|
@ -39,18 +39,19 @@ import static org.hamcrest.Matchers.equalTo;
|
|||
/**
|
||||
* We want to test site plugins
|
||||
*/
|
||||
@ClusterScope(scope=Scope.SUITE, numNodes=1)
|
||||
@ClusterScope(scope = Scope.SUITE, numNodes = 1)
|
||||
public class SitePluginTests extends AbstractIntegrationTest {
|
||||
|
||||
|
||||
@Override
|
||||
protected Settings nodeSettings(int nodeOrdinal) {
|
||||
try {
|
||||
File pluginDir = new File(SitePluginTests.class.getResource("/org/elasticsearch/plugin").toURI());
|
||||
return settingsBuilder()
|
||||
.put(super.nodeSettings(nodeOrdinal))
|
||||
.put("path.plugins", pluginDir.getAbsolutePath())
|
||||
.build();
|
||||
File pluginDir = new File(SitePluginTests.class.getResource("/org/elasticsearch/plugin").toURI());
|
||||
return settingsBuilder()
|
||||
.put(super.nodeSettings(nodeOrdinal))
|
||||
.put("path.plugins", pluginDir.getAbsolutePath())
|
||||
.put("force.http.enabled", true)
|
||||
.build();
|
||||
} catch (URISyntaxException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue