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:
Shay Banon 2013-10-30 02:09:43 +01:00
parent 9cb54c0f2e
commit 8f21d2831a
4 changed files with 31 additions and 11 deletions

View File

@ -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");

View File

@ -48,7 +48,9 @@ import static org.hamcrest.CoreMatchers.*;
@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

View File

@ -44,7 +44,11 @@ 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

View File

@ -50,6 +50,7 @@ public class SitePluginTests extends AbstractIntegrationTest {
return settingsBuilder()
.put(super.nodeSettings(nodeOrdinal))
.put("path.plugins", pluginDir.getAbsolutePath())
.put("force.http.enabled", true)
.build();
} catch (URISyntaxException ex) {
throw new RuntimeException(ex);