mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-25 07:37:19 -04:00
Test: Make rest test framework accept http directly for the test cluster
The rest test framework, because it used to be tightly integrated with ESIntegTestCase, currently expects the addresses for the test cluster to be passed using the transport protocol port. However, it only uses this to then find the http address. This change makes ESRestTestCase extend from ESTestCase instead of ESIntegTestCase, and changes the sysprop used to tests.rest.cluster, which now takes the http address. closes #15459
This commit is contained in:
parent
b6c9eaa24a
commit
ef4f0a8699
33 changed files with 100 additions and 294 deletions
|
@ -46,9 +46,9 @@ class ClusterFormationTasks {
|
||||||
/**
|
/**
|
||||||
* Adds dependent tasks to the given task to start and stop a cluster with the given configuration.
|
* Adds dependent tasks to the given task to start and stop a cluster with the given configuration.
|
||||||
*
|
*
|
||||||
* Returns an object that will resolve at execution time of the given task to a uri for the cluster.
|
* Returns a NodeInfo object for the first node in the cluster.
|
||||||
*/
|
*/
|
||||||
static Object setup(Project project, Task task, ClusterConfiguration config) {
|
static NodeInfo setup(Project project, Task task, ClusterConfiguration config) {
|
||||||
if (task.getEnabled() == false) {
|
if (task.getEnabled() == false) {
|
||||||
// no need to add cluster formation tasks if the task won't run!
|
// no need to add cluster formation tasks if the task won't run!
|
||||||
return
|
return
|
||||||
|
@ -66,7 +66,7 @@ class ClusterFormationTasks {
|
||||||
task.dependsOn(wait)
|
task.dependsOn(wait)
|
||||||
|
|
||||||
// delay the resolution of the uri by wrapping in a closure, so it is not used until read for tests
|
// delay the resolution of the uri by wrapping in a closure, so it is not used until read for tests
|
||||||
return "${-> nodes[0].transportUri()}"
|
return nodes[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Adds a dependency on the given distribution */
|
/** Adds a dependency on the given distribution */
|
||||||
|
|
|
@ -20,7 +20,6 @@ package org.elasticsearch.gradle.test
|
||||||
|
|
||||||
import com.carrotsearch.gradle.junit4.RandomizedTestingTask
|
import com.carrotsearch.gradle.junit4.RandomizedTestingTask
|
||||||
import org.elasticsearch.gradle.BuildPlugin
|
import org.elasticsearch.gradle.BuildPlugin
|
||||||
import org.gradle.api.GradleException
|
|
||||||
import org.gradle.api.Task
|
import org.gradle.api.Task
|
||||||
import org.gradle.api.internal.tasks.options.Option
|
import org.gradle.api.internal.tasks.options.Option
|
||||||
import org.gradle.api.plugins.JavaBasePlugin
|
import org.gradle.api.plugins.JavaBasePlugin
|
||||||
|
@ -61,8 +60,9 @@ public class RestIntegTestTask extends RandomizedTestingTask {
|
||||||
// this must run after all projects have been configured, so we know any project
|
// this must run after all projects have been configured, so we know any project
|
||||||
// references can be accessed as a fully configured
|
// references can be accessed as a fully configured
|
||||||
project.gradle.projectsEvaluated {
|
project.gradle.projectsEvaluated {
|
||||||
Object clusterUri = ClusterFormationTasks.setup(project, this, clusterConfig)
|
NodeInfo node = ClusterFormationTasks.setup(project, this, clusterConfig)
|
||||||
systemProperty('tests.cluster', clusterUri)
|
systemProperty('tests.rest.cluster', "localhost:${-> new URL('http://' + node.httpUri()).getPort()}")
|
||||||
|
systemProperty('tests.cluster', "${-> node.transportUri()}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,21 +21,14 @@ package org.elasticsearch.script.expression;
|
||||||
|
|
||||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
||||||
import org.elasticsearch.plugins.Plugin;
|
|
||||||
import org.elasticsearch.test.rest.ESRestTestCase;
|
import org.elasticsearch.test.rest.ESRestTestCase;
|
||||||
import org.elasticsearch.test.rest.RestTestCandidate;
|
import org.elasticsearch.test.rest.RestTestCandidate;
|
||||||
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
public class ExpressionRestIT extends ESRestTestCase {
|
public class ExpressionRestIT extends ESRestTestCase {
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Collection<Class<? extends Plugin>> nodePlugins() {
|
|
||||||
return pluginList(ExpressionPlugin.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ExpressionRestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
public ExpressionRestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
||||||
super(testCandidate);
|
super(testCandidate);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,21 +21,14 @@ package org.elasticsearch.script.groovy;
|
||||||
|
|
||||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
||||||
import org.elasticsearch.plugins.Plugin;
|
|
||||||
import org.elasticsearch.test.rest.ESRestTestCase;
|
import org.elasticsearch.test.rest.ESRestTestCase;
|
||||||
import org.elasticsearch.test.rest.RestTestCandidate;
|
import org.elasticsearch.test.rest.RestTestCandidate;
|
||||||
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
public class GroovyRestIT extends ESRestTestCase {
|
public class GroovyRestIT extends ESRestTestCase {
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Collection<Class<? extends Plugin>> nodePlugins() {
|
|
||||||
return pluginList(GroovyPlugin.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public GroovyRestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
public GroovyRestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
||||||
super(testCandidate);
|
super(testCandidate);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,21 +21,14 @@ package org.elasticsearch.script.mustache;
|
||||||
|
|
||||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
||||||
import org.elasticsearch.plugins.Plugin;
|
|
||||||
import org.elasticsearch.test.rest.ESRestTestCase;
|
import org.elasticsearch.test.rest.ESRestTestCase;
|
||||||
import org.elasticsearch.test.rest.RestTestCandidate;
|
import org.elasticsearch.test.rest.RestTestCandidate;
|
||||||
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
public class MustacheRestIT extends ESRestTestCase {
|
public class MustacheRestIT extends ESRestTestCase {
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Collection<Class<? extends Plugin>> nodePlugins() {
|
|
||||||
return pluginList(MustachePlugin.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public MustacheRestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
public MustacheRestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
||||||
super(testCandidate);
|
super(testCandidate);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,22 +21,14 @@ package org.elasticsearch.index.analysis;
|
||||||
|
|
||||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
||||||
import org.elasticsearch.plugin.analysis.icu.AnalysisICUPlugin;
|
|
||||||
import org.elasticsearch.plugins.Plugin;
|
|
||||||
import org.elasticsearch.test.rest.ESRestTestCase;
|
import org.elasticsearch.test.rest.ESRestTestCase;
|
||||||
import org.elasticsearch.test.rest.RestTestCandidate;
|
import org.elasticsearch.test.rest.RestTestCandidate;
|
||||||
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
public class AnalysisICURestIT extends ESRestTestCase {
|
public class AnalysisICURestIT extends ESRestTestCase {
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Collection<Class<? extends Plugin>> nodePlugins() {
|
|
||||||
return pluginList(AnalysisICUPlugin.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public AnalysisICURestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
public AnalysisICURestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
||||||
super(testCandidate);
|
super(testCandidate);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,23 +21,14 @@ package org.elasticsearch.index.analysis;
|
||||||
|
|
||||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
||||||
import org.elasticsearch.plugin.analysis.kuromoji.AnalysisKuromojiPlugin;
|
|
||||||
import org.elasticsearch.plugins.Plugin;
|
|
||||||
import org.elasticsearch.test.rest.ESRestTestCase;
|
import org.elasticsearch.test.rest.ESRestTestCase;
|
||||||
import org.elasticsearch.test.rest.RestTestCandidate;
|
import org.elasticsearch.test.rest.RestTestCandidate;
|
||||||
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
public class AnalysisKuromojiRestIT extends ESRestTestCase {
|
public class AnalysisKuromojiRestIT extends ESRestTestCase {
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Collection<Class<? extends Plugin>> nodePlugins() {
|
|
||||||
return pluginList(AnalysisKuromojiPlugin.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public AnalysisKuromojiRestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
public AnalysisKuromojiRestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
||||||
super(testCandidate);
|
super(testCandidate);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,22 +21,14 @@ package org.elasticsearch.index.analysis;
|
||||||
|
|
||||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
||||||
import org.elasticsearch.plugin.analysis.AnalysisPhoneticPlugin;
|
|
||||||
import org.elasticsearch.plugins.Plugin;
|
|
||||||
import org.elasticsearch.test.rest.ESRestTestCase;
|
import org.elasticsearch.test.rest.ESRestTestCase;
|
||||||
import org.elasticsearch.test.rest.RestTestCandidate;
|
import org.elasticsearch.test.rest.RestTestCandidate;
|
||||||
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
public class AnalysisPhoneticRestIT extends ESRestTestCase {
|
public class AnalysisPhoneticRestIT extends ESRestTestCase {
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Collection<Class<? extends Plugin>> nodePlugins() {
|
|
||||||
return pluginList(AnalysisPhoneticPlugin.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public AnalysisPhoneticRestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
public AnalysisPhoneticRestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
||||||
super(testCandidate);
|
super(testCandidate);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,22 +21,14 @@ package org.elasticsearch.index.analysis;
|
||||||
|
|
||||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
||||||
import org.elasticsearch.plugin.analysis.smartcn.AnalysisSmartChinesePlugin;
|
|
||||||
import org.elasticsearch.plugins.Plugin;
|
|
||||||
import org.elasticsearch.test.rest.ESRestTestCase;
|
import org.elasticsearch.test.rest.ESRestTestCase;
|
||||||
import org.elasticsearch.test.rest.RestTestCandidate;
|
import org.elasticsearch.test.rest.RestTestCandidate;
|
||||||
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
public class AnalysisSmartChineseRestIT extends ESRestTestCase {
|
public class AnalysisSmartChineseRestIT extends ESRestTestCase {
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Collection<Class<? extends Plugin>> nodePlugins() {
|
|
||||||
return pluginList(AnalysisSmartChinesePlugin.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public AnalysisSmartChineseRestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
public AnalysisSmartChineseRestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
||||||
super(testCandidate);
|
super(testCandidate);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,22 +21,14 @@ package org.elasticsearch.index.analysis;
|
||||||
|
|
||||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
||||||
import org.elasticsearch.plugin.analysis.stempel.AnalysisStempelPlugin;
|
|
||||||
import org.elasticsearch.plugins.Plugin;
|
|
||||||
import org.elasticsearch.test.rest.ESRestTestCase;
|
import org.elasticsearch.test.rest.ESRestTestCase;
|
||||||
import org.elasticsearch.test.rest.RestTestCandidate;
|
import org.elasticsearch.test.rest.RestTestCandidate;
|
||||||
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
public class AnalysisPolishRestIT extends ESRestTestCase {
|
public class AnalysisPolishRestIT extends ESRestTestCase {
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Collection<Class<? extends Plugin>> nodePlugins() {
|
|
||||||
return pluginList(AnalysisStempelPlugin.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public AnalysisPolishRestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
public AnalysisPolishRestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
||||||
super(testCandidate);
|
super(testCandidate);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,22 +21,14 @@ package org.elasticsearch.plugin.deletebyquery.test.rest;
|
||||||
|
|
||||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
||||||
import org.elasticsearch.plugin.deletebyquery.DeleteByQueryPlugin;
|
|
||||||
import org.elasticsearch.plugins.Plugin;
|
|
||||||
import org.elasticsearch.test.rest.ESRestTestCase;
|
import org.elasticsearch.test.rest.ESRestTestCase;
|
||||||
import org.elasticsearch.test.rest.RestTestCandidate;
|
import org.elasticsearch.test.rest.RestTestCandidate;
|
||||||
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
public class DeleteByQueryRestIT extends ESRestTestCase {
|
public class DeleteByQueryRestIT extends ESRestTestCase {
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Collection<Class<? extends Plugin>> nodePlugins() {
|
|
||||||
return pluginList(DeleteByQueryPlugin.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public DeleteByQueryRestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
public DeleteByQueryRestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
||||||
super(testCandidate);
|
super(testCandidate);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,22 +21,14 @@ package org.elasticsearch.discovery.azure;
|
||||||
|
|
||||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
||||||
import org.elasticsearch.plugin.discovery.azure.AzureDiscoveryPlugin;
|
|
||||||
import org.elasticsearch.plugins.Plugin;
|
|
||||||
import org.elasticsearch.test.rest.ESRestTestCase;
|
import org.elasticsearch.test.rest.ESRestTestCase;
|
||||||
import org.elasticsearch.test.rest.RestTestCandidate;
|
import org.elasticsearch.test.rest.RestTestCandidate;
|
||||||
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
public class AzureDiscoveryRestIT extends ESRestTestCase {
|
public class AzureDiscoveryRestIT extends ESRestTestCase {
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Collection<Class<? extends Plugin>> nodePlugins() {
|
|
||||||
return pluginList(AzureDiscoveryPlugin.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public AzureDiscoveryRestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
public AzureDiscoveryRestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
||||||
super(testCandidate);
|
super(testCandidate);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,22 +21,14 @@ package org.elasticsearch.cloud.aws;
|
||||||
|
|
||||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
||||||
import org.elasticsearch.plugin.discovery.ec2.Ec2DiscoveryPlugin;
|
|
||||||
import org.elasticsearch.plugins.Plugin;
|
|
||||||
import org.elasticsearch.test.rest.ESRestTestCase;
|
import org.elasticsearch.test.rest.ESRestTestCase;
|
||||||
import org.elasticsearch.test.rest.RestTestCandidate;
|
import org.elasticsearch.test.rest.RestTestCandidate;
|
||||||
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
public class DiscoveryEc2RestIT extends ESRestTestCase {
|
public class DiscoveryEc2RestIT extends ESRestTestCase {
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Collection<Class<? extends Plugin>> nodePlugins() {
|
|
||||||
return pluginList(Ec2DiscoveryPlugin.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public DiscoveryEc2RestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
public DiscoveryEc2RestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
||||||
super(testCandidate);
|
super(testCandidate);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,22 +21,14 @@ package org.elasticsearch.discovery.gce;
|
||||||
|
|
||||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
||||||
import org.elasticsearch.plugin.discovery.gce.GceDiscoveryPlugin;
|
|
||||||
import org.elasticsearch.plugins.Plugin;
|
|
||||||
import org.elasticsearch.test.rest.ESRestTestCase;
|
import org.elasticsearch.test.rest.ESRestTestCase;
|
||||||
import org.elasticsearch.test.rest.RestTestCandidate;
|
import org.elasticsearch.test.rest.RestTestCandidate;
|
||||||
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
public class DiscoveryGCERestIT extends ESRestTestCase {
|
public class DiscoveryGCERestIT extends ESRestTestCase {
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Collection<Class<? extends Plugin>> nodePlugins() {
|
|
||||||
return pluginList(GceDiscoveryPlugin.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public DiscoveryGCERestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
public DiscoveryGCERestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
||||||
super(testCandidate);
|
super(testCandidate);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,21 +21,14 @@ package org.elasticsearch.plugin.discovery.multicast;
|
||||||
|
|
||||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
||||||
import org.elasticsearch.plugins.Plugin;
|
|
||||||
import org.elasticsearch.test.rest.ESRestTestCase;
|
import org.elasticsearch.test.rest.ESRestTestCase;
|
||||||
import org.elasticsearch.test.rest.RestTestCandidate;
|
import org.elasticsearch.test.rest.RestTestCandidate;
|
||||||
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
public class MulticastDiscoveryRestIT extends ESRestTestCase {
|
public class MulticastDiscoveryRestIT extends ESRestTestCase {
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Collection<Class<? extends Plugin>> nodePlugins() {
|
|
||||||
return pluginList(MulticastDiscoveryPlugin.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public MulticastDiscoveryRestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
public MulticastDiscoveryRestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
||||||
super(testCandidate);
|
super(testCandidate);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,21 +21,14 @@ package org.elasticsearch.plugin.example;
|
||||||
|
|
||||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
||||||
import org.elasticsearch.plugins.Plugin;
|
|
||||||
import org.elasticsearch.test.rest.ESRestTestCase;
|
import org.elasticsearch.test.rest.ESRestTestCase;
|
||||||
import org.elasticsearch.test.rest.RestTestCandidate;
|
import org.elasticsearch.test.rest.RestTestCandidate;
|
||||||
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
public class JvmExampleRestIT extends ESRestTestCase {
|
public class JvmExampleRestIT extends ESRestTestCase {
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Collection<Class<? extends Plugin>> nodePlugins() {
|
|
||||||
return pluginList(JvmExamplePlugin.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public JvmExampleRestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
public JvmExampleRestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
||||||
super(testCandidate);
|
super(testCandidate);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,22 +21,14 @@ package org.elasticsearch.script.javascript;
|
||||||
|
|
||||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
||||||
import org.elasticsearch.plugin.javascript.JavaScriptPlugin;
|
|
||||||
import org.elasticsearch.plugins.Plugin;
|
|
||||||
import org.elasticsearch.test.rest.ESRestTestCase;
|
import org.elasticsearch.test.rest.ESRestTestCase;
|
||||||
import org.elasticsearch.test.rest.RestTestCandidate;
|
import org.elasticsearch.test.rest.RestTestCandidate;
|
||||||
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
public class LangJavaScriptRestIT extends ESRestTestCase {
|
public class LangJavaScriptRestIT extends ESRestTestCase {
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Collection<Class<? extends Plugin>> nodePlugins() {
|
|
||||||
return pluginList(JavaScriptPlugin.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public LangJavaScriptRestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
public LangJavaScriptRestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
||||||
super(testCandidate);
|
super(testCandidate);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,22 +21,15 @@ package org.elasticsearch.plan.a;
|
||||||
|
|
||||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
||||||
import org.elasticsearch.plugins.Plugin;
|
|
||||||
import org.elasticsearch.test.rest.ESRestTestCase;
|
import org.elasticsearch.test.rest.ESRestTestCase;
|
||||||
import org.elasticsearch.test.rest.RestTestCandidate;
|
import org.elasticsearch.test.rest.RestTestCandidate;
|
||||||
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
/** Runs yaml rest tests */
|
/** Runs yaml rest tests */
|
||||||
public class PlanARestIT extends ESRestTestCase {
|
public class PlanARestIT extends ESRestTestCase {
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Collection<Class<? extends Plugin>> nodePlugins() {
|
|
||||||
return pluginList(PlanAPlugin.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public PlanARestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
public PlanARestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
||||||
super(testCandidate);
|
super(testCandidate);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,22 +21,14 @@ package org.elasticsearch.script.python;
|
||||||
|
|
||||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
||||||
import org.elasticsearch.plugin.python.PythonPlugin;
|
|
||||||
import org.elasticsearch.plugins.Plugin;
|
|
||||||
import org.elasticsearch.test.rest.ESRestTestCase;
|
import org.elasticsearch.test.rest.ESRestTestCase;
|
||||||
import org.elasticsearch.test.rest.RestTestCandidate;
|
import org.elasticsearch.test.rest.RestTestCandidate;
|
||||||
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
public class LangPythonScriptRestIT extends ESRestTestCase {
|
public class LangPythonScriptRestIT extends ESRestTestCase {
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Collection<Class<? extends Plugin>> nodePlugins() {
|
|
||||||
return pluginList(PythonPlugin.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public LangPythonScriptRestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
public LangPythonScriptRestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
||||||
super(testCandidate);
|
super(testCandidate);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,6 @@ package org.elasticsearch.mapper.attachments;
|
||||||
|
|
||||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
|
||||||
import org.elasticsearch.test.rest.ESRestTestCase;
|
import org.elasticsearch.test.rest.ESRestTestCase;
|
||||||
import org.elasticsearch.test.rest.RestTestCandidate;
|
import org.elasticsearch.test.rest.RestTestCandidate;
|
||||||
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
||||||
|
@ -30,14 +29,6 @@ import java.io.IOException;
|
||||||
|
|
||||||
public class MapperAttachmentsRestIT extends ESRestTestCase {
|
public class MapperAttachmentsRestIT extends ESRestTestCase {
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Settings nodeSettings(int nodeOrdinal) {
|
|
||||||
return Settings.builder()
|
|
||||||
.put(super.nodeSettings(nodeOrdinal))
|
|
||||||
.put("plugin.types", MapperAttachmentsPlugin.class.getName())
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
public MapperAttachmentsRestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
public MapperAttachmentsRestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
||||||
super(testCandidate);
|
super(testCandidate);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,22 +21,14 @@ package org.elasticsearch.index.mapper.murmur3;
|
||||||
|
|
||||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
||||||
import org.elasticsearch.plugin.mapper.MapperMurmur3Plugin;
|
|
||||||
import org.elasticsearch.plugins.Plugin;
|
|
||||||
import org.elasticsearch.test.rest.ESRestTestCase;
|
import org.elasticsearch.test.rest.ESRestTestCase;
|
||||||
import org.elasticsearch.test.rest.RestTestCandidate;
|
import org.elasticsearch.test.rest.RestTestCandidate;
|
||||||
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
public class MapperMurmur3RestIT extends ESRestTestCase {
|
public class MapperMurmur3RestIT extends ESRestTestCase {
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Collection<Class<? extends Plugin>> nodePlugins() {
|
|
||||||
return pluginList(MapperMurmur3Plugin.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public MapperMurmur3RestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
public MapperMurmur3RestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
||||||
super(testCandidate);
|
super(testCandidate);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,22 +21,14 @@ package org.elasticsearch.index.mapper.size;
|
||||||
|
|
||||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
||||||
import org.elasticsearch.plugin.mapper.MapperSizePlugin;
|
|
||||||
import org.elasticsearch.plugins.Plugin;
|
|
||||||
import org.elasticsearch.test.rest.ESRestTestCase;
|
import org.elasticsearch.test.rest.ESRestTestCase;
|
||||||
import org.elasticsearch.test.rest.RestTestCandidate;
|
import org.elasticsearch.test.rest.RestTestCandidate;
|
||||||
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
public class MapperSizeRestIT extends ESRestTestCase {
|
public class MapperSizeRestIT extends ESRestTestCase {
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Collection<Class<? extends Plugin>> nodePlugins() {
|
|
||||||
return pluginList(MapperSizePlugin.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public MapperSizeRestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
public MapperSizeRestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
||||||
super(testCandidate);
|
super(testCandidate);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,22 +21,14 @@ package org.elasticsearch.repositories.azure;
|
||||||
|
|
||||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
||||||
import org.elasticsearch.plugin.repository.azure.AzureRepositoryPlugin;
|
|
||||||
import org.elasticsearch.plugins.Plugin;
|
|
||||||
import org.elasticsearch.test.rest.ESRestTestCase;
|
import org.elasticsearch.test.rest.ESRestTestCase;
|
||||||
import org.elasticsearch.test.rest.RestTestCandidate;
|
import org.elasticsearch.test.rest.RestTestCandidate;
|
||||||
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
public class AzureRepositoryRestIT extends ESRestTestCase {
|
public class AzureRepositoryRestIT extends ESRestTestCase {
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Collection<Class<? extends Plugin>> nodePlugins() {
|
|
||||||
return pluginList(AzureRepositoryPlugin.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public AzureRepositoryRestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
public AzureRepositoryRestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
||||||
super(testCandidate);
|
super(testCandidate);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,24 +19,15 @@
|
||||||
package org.elasticsearch.repositories.hdfs;
|
package org.elasticsearch.repositories.hdfs;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
||||||
|
|
||||||
import org.elasticsearch.plugins.Plugin;
|
|
||||||
import org.elasticsearch.repositories.hdfs.HdfsPlugin;
|
|
||||||
import org.elasticsearch.test.rest.ESRestTestCase;
|
import org.elasticsearch.test.rest.ESRestTestCase;
|
||||||
import org.elasticsearch.test.rest.RestTestCandidate;
|
import org.elasticsearch.test.rest.RestTestCandidate;
|
||||||
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
||||||
|
|
||||||
public class HdfsRepositoryRestIT extends ESRestTestCase {
|
public class HdfsRepositoryRestIT extends ESRestTestCase {
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Collection<Class<? extends Plugin>> nodePlugins() {
|
|
||||||
return pluginList(HdfsPlugin.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public HdfsRepositoryRestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
public HdfsRepositoryRestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
||||||
super(testCandidate);
|
super(testCandidate);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,22 +21,14 @@ package org.elasticsearch.repositories.s3;
|
||||||
|
|
||||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
||||||
import org.elasticsearch.plugin.repository.s3.S3RepositoryPlugin;
|
|
||||||
import org.elasticsearch.plugins.Plugin;
|
|
||||||
import org.elasticsearch.test.rest.ESRestTestCase;
|
import org.elasticsearch.test.rest.ESRestTestCase;
|
||||||
import org.elasticsearch.test.rest.RestTestCandidate;
|
import org.elasticsearch.test.rest.RestTestCandidate;
|
||||||
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
public class RepositoryS3RestIT extends ESRestTestCase {
|
public class RepositoryS3RestIT extends ESRestTestCase {
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Collection<Class<? extends Plugin>> nodePlugins() {
|
|
||||||
return pluginList(S3RepositoryPlugin.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public RepositoryS3RestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
public RepositoryS3RestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
||||||
super(testCandidate);
|
super(testCandidate);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,22 +21,14 @@ package org.elasticsearch.index.store;
|
||||||
|
|
||||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
||||||
import org.elasticsearch.plugin.store.smb.SMBStorePlugin;
|
|
||||||
import org.elasticsearch.plugins.Plugin;
|
|
||||||
import org.elasticsearch.test.rest.ESRestTestCase;
|
import org.elasticsearch.test.rest.ESRestTestCase;
|
||||||
import org.elasticsearch.test.rest.RestTestCandidate;
|
import org.elasticsearch.test.rest.RestTestCandidate;
|
||||||
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
public class SMBStoreRestIT extends ESRestTestCase {
|
public class SMBStoreRestIT extends ESRestTestCase {
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Collection<Class<? extends Plugin>> nodePlugins() {
|
|
||||||
return pluginList(SMBStorePlugin.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public SMBStoreRestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
public SMBStoreRestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
||||||
super(testCandidate);
|
super(testCandidate);
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,11 +67,6 @@ public abstract class ESSmokeClientTestCase extends LuceneTestCase {
|
||||||
*/
|
*/
|
||||||
public static final String TESTS_CLUSTER = "tests.cluster";
|
public static final String TESTS_CLUSTER = "tests.cluster";
|
||||||
|
|
||||||
/**
|
|
||||||
* Defaults to localhost:9300
|
|
||||||
*/
|
|
||||||
public static final String TESTS_CLUSTER_DEFAULT = "localhost:9300";
|
|
||||||
|
|
||||||
protected static final ESLogger logger = ESLoggerFactory.getLogger(ESSmokeClientTestCase.class.getName());
|
protected static final ESLogger logger = ESLoggerFactory.getLogger(ESSmokeClientTestCase.class.getName());
|
||||||
|
|
||||||
private static final AtomicInteger counter = new AtomicInteger();
|
private static final AtomicInteger counter = new AtomicInteger();
|
||||||
|
@ -131,11 +126,10 @@ public abstract class ESSmokeClientTestCase extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void initializeSettings() throws UnknownHostException {
|
public static void initializeSettings() {
|
||||||
clusterAddresses = System.getProperty(TESTS_CLUSTER);
|
clusterAddresses = System.getProperty(TESTS_CLUSTER);
|
||||||
if (clusterAddresses == null || clusterAddresses.isEmpty()) {
|
if (clusterAddresses == null || clusterAddresses.isEmpty()) {
|
||||||
clusterAddresses = TESTS_CLUSTER_DEFAULT;
|
fail("Must specify " + TESTS_CLUSTER + " for smoke client test");
|
||||||
logger.info("[{}] not set. Falling back to [{}]", TESTS_CLUSTER, TESTS_CLUSTER_DEFAULT);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.elasticsearch.common.logging.ESLogger;
|
||||||
import org.elasticsearch.common.logging.Loggers;
|
import org.elasticsearch.common.logging.Loggers;
|
||||||
import org.elasticsearch.test.ESIntegTestCase;
|
import org.elasticsearch.test.ESIntegTestCase;
|
||||||
import org.elasticsearch.test.ESTestCase;
|
import org.elasticsearch.test.ESTestCase;
|
||||||
|
import org.elasticsearch.test.rest.ESRestTestCase;
|
||||||
import org.junit.internal.AssumptionViolatedException;
|
import org.junit.internal.AssumptionViolatedException;
|
||||||
import org.junit.runner.Description;
|
import org.junit.runner.Description;
|
||||||
import org.junit.runner.notification.Failure;
|
import org.junit.runner.notification.Failure;
|
||||||
|
@ -39,7 +40,6 @@ import static org.elasticsearch.test.ESIntegTestCase.TESTS_CLUSTER;
|
||||||
import static org.elasticsearch.test.rest.ESRestTestCase.REST_TESTS_BLACKLIST;
|
import static org.elasticsearch.test.rest.ESRestTestCase.REST_TESTS_BLACKLIST;
|
||||||
import static org.elasticsearch.test.rest.ESRestTestCase.REST_TESTS_SPEC;
|
import static org.elasticsearch.test.rest.ESRestTestCase.REST_TESTS_SPEC;
|
||||||
import static org.elasticsearch.test.rest.ESRestTestCase.REST_TESTS_SUITE;
|
import static org.elasticsearch.test.rest.ESRestTestCase.REST_TESTS_SUITE;
|
||||||
import static org.elasticsearch.test.rest.ESRestTestCase.Rest;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link RunListener} that emits to {@link System#err} a string with command
|
* A {@link RunListener} that emits to {@link System#err} a string with command
|
||||||
|
@ -82,7 +82,7 @@ public class ReproduceInfoPrinter extends RunListener {
|
||||||
gradleMessageBuilder.appendAllOpts(failure.getDescription());
|
gradleMessageBuilder.appendAllOpts(failure.getDescription());
|
||||||
|
|
||||||
//Rest tests are a special case as they allow for additional parameters
|
//Rest tests are a special case as they allow for additional parameters
|
||||||
if (failure.getDescription().getTestClass().isAnnotationPresent(Rest.class)) {
|
if (ESRestTestCase.class.isAssignableFrom(failure.getDescription().getTestClass())) {
|
||||||
gradleMessageBuilder.appendRestTestsProperties();
|
gradleMessageBuilder.appendRestTestsProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,20 +20,12 @@
|
||||||
package org.elasticsearch.test.rest;
|
package org.elasticsearch.test.rest;
|
||||||
|
|
||||||
import com.carrotsearch.randomizedtesting.RandomizedTest;
|
import com.carrotsearch.randomizedtesting.RandomizedTest;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.TestGroup;
|
|
||||||
import com.carrotsearch.randomizedtesting.annotations.TimeoutSuite;
|
|
||||||
import org.apache.lucene.util.IOUtils;
|
import org.apache.lucene.util.IOUtils;
|
||||||
import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;
|
|
||||||
import org.apache.lucene.util.LuceneTestCase.SuppressFsync;
|
|
||||||
import org.apache.lucene.util.TimeUnits;
|
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
import org.elasticsearch.common.SuppressForbidden;
|
import org.elasticsearch.common.SuppressForbidden;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.xcontent.XContentHelper;
|
import org.elasticsearch.common.xcontent.XContentHelper;
|
||||||
import org.elasticsearch.node.Node;
|
import org.elasticsearch.test.ESTestCase;
|
||||||
import org.elasticsearch.repositories.uri.URLRepository;
|
|
||||||
import org.elasticsearch.test.ESIntegTestCase;
|
|
||||||
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
|
|
||||||
import org.elasticsearch.test.rest.client.RestException;
|
import org.elasticsearch.test.rest.client.RestException;
|
||||||
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
||||||
import org.elasticsearch.test.rest.parser.RestTestSuiteParser;
|
import org.elasticsearch.test.rest.parser.RestTestSuiteParser;
|
||||||
|
@ -45,17 +37,14 @@ import org.elasticsearch.test.rest.section.TestSection;
|
||||||
import org.elasticsearch.test.rest.spec.RestApi;
|
import org.elasticsearch.test.rest.spec.RestApi;
|
||||||
import org.elasticsearch.test.rest.spec.RestSpec;
|
import org.elasticsearch.test.rest.spec.RestSpec;
|
||||||
import org.elasticsearch.test.rest.support.FileUtils;
|
import org.elasticsearch.test.rest.support.FileUtils;
|
||||||
|
import org.junit.After;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.lang.annotation.ElementType;
|
import java.net.InetSocketAddress;
|
||||||
import java.lang.annotation.Inherited;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
@ -67,6 +56,7 @@ import java.nio.file.StandardCopyOption;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -74,27 +64,7 @@ import java.util.Set;
|
||||||
/**
|
/**
|
||||||
* Runs the clients test suite against an elasticsearch cluster.
|
* Runs the clients test suite against an elasticsearch cluster.
|
||||||
*/
|
*/
|
||||||
@ESRestTestCase.Rest
|
public abstract class ESRestTestCase extends ESTestCase {
|
||||||
@SuppressFsync // we aren't trying to test this here, and it can make the test slow
|
|
||||||
@SuppressCodecs("*") // requires custom completion postings format
|
|
||||||
@ClusterScope(randomDynamicTemplates = false)
|
|
||||||
@TimeoutSuite(millis = 40 * TimeUnits.MINUTE) // timeout the suite after 40min and fail the test.
|
|
||||||
public abstract class ESRestTestCase extends ESIntegTestCase {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Property that allows to control whether the REST tests are run (default) or not
|
|
||||||
*/
|
|
||||||
public static final String TESTS_REST = "tests.rest";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Annotation for REST tests
|
|
||||||
*/
|
|
||||||
@Inherited
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.TYPE)
|
|
||||||
@TestGroup(enabled = true, sysProperty = ESRestTestCase.TESTS_REST)
|
|
||||||
public @interface Rest {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property that allows to control which REST tests get run. Supports comma separated list of tests
|
* Property that allows to control which REST tests get run. Supports comma separated list of tests
|
||||||
|
@ -132,7 +102,9 @@ public abstract class ESRestTestCase extends ESIntegTestCase {
|
||||||
private static final String PATHS_SEPARATOR = "(?<!\\\\),";
|
private static final String PATHS_SEPARATOR = "(?<!\\\\),";
|
||||||
|
|
||||||
private final List<BlacklistedPathPatternMatcher> blacklistPathMatchers = new ArrayList<>();
|
private final List<BlacklistedPathPatternMatcher> blacklistPathMatchers = new ArrayList<>();
|
||||||
|
private final URL[] clusterUrls;
|
||||||
private static RestTestExecutionContext restTestExecutionContext;
|
private static RestTestExecutionContext restTestExecutionContext;
|
||||||
|
private static RestTestExecutionContext adminExecutionContext;
|
||||||
|
|
||||||
private final RestTestCandidate testCandidate;
|
private final RestTestCandidate testCandidate;
|
||||||
|
|
||||||
|
@ -142,6 +114,20 @@ public abstract class ESRestTestCase extends ESIntegTestCase {
|
||||||
for (String entry : blacklist) {
|
for (String entry : blacklist) {
|
||||||
this.blacklistPathMatchers.add(new BlacklistedPathPatternMatcher(entry));
|
this.blacklistPathMatchers.add(new BlacklistedPathPatternMatcher(entry));
|
||||||
}
|
}
|
||||||
|
String cluster = System.getProperty("tests.rest.cluster");
|
||||||
|
if (cluster == null) {
|
||||||
|
throw new RuntimeException("Must specify tests.rest.cluster for rest tests");
|
||||||
|
}
|
||||||
|
String[] stringUrls = cluster.split(",");
|
||||||
|
clusterUrls = new URL[stringUrls.length];
|
||||||
|
int i = 0;
|
||||||
|
try {
|
||||||
|
for (String stringUrl : stringUrls) {
|
||||||
|
clusterUrls[i++] = new URL("http://" + stringUrl);
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException("Failed to parse cluster addresses for rest test", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -150,28 +136,7 @@ public abstract class ESRestTestCase extends ESIntegTestCase {
|
||||||
super.afterIfFailed(errors);
|
super.afterIfFailed(errors);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Settings nodeSettings(int nodeOrdinal) {
|
|
||||||
return Settings.builder()
|
|
||||||
.putArray(URLRepository.ALLOWED_URLS_SETTING, "http://snapshot.test*")
|
|
||||||
.put(Node.HTTP_ENABLED, true)
|
|
||||||
.put("node.testattr", "test")
|
|
||||||
.put(super.nodeSettings(nodeOrdinal)).build();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Iterable<Object[]> createParameters(int id, int count) throws IOException, RestTestParseException {
|
public static Iterable<Object[]> createParameters(int id, int count) throws IOException, RestTestParseException {
|
||||||
TestGroup testGroup = Rest.class.getAnnotation(TestGroup.class);
|
|
||||||
String sysProperty = TestGroup.Utilities.getSysProperty(Rest.class);
|
|
||||||
boolean enabled;
|
|
||||||
try {
|
|
||||||
enabled = RandomizedTest.systemPropertyAsBoolean(sysProperty, testGroup.enabled());
|
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
// Ignore malformed system property, disable the group if malformed though.
|
|
||||||
enabled = false;
|
|
||||||
}
|
|
||||||
if (!enabled) {
|
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
|
||||||
//parse tests only if rest test group is enabled, otherwise rest tests might not even be available on file system
|
//parse tests only if rest test group is enabled, otherwise rest tests might not even be available on file system
|
||||||
List<RestTestCandidate> restTestCandidates = collectTestCandidates(id, count);
|
List<RestTestCandidate> restTestCandidates = collectTestCandidates(id, count);
|
||||||
List<Object[]> objects = new ArrayList<>();
|
List<Object[]> objects = new ArrayList<>();
|
||||||
|
@ -274,6 +239,7 @@ public abstract class ESRestTestCase extends ESIntegTestCase {
|
||||||
}
|
}
|
||||||
validateSpec(restSpec);
|
validateSpec(restSpec);
|
||||||
restTestExecutionContext = new RestTestExecutionContext(restSpec);
|
restTestExecutionContext = new RestTestExecutionContext(restSpec);
|
||||||
|
adminExecutionContext = new RestTestExecutionContext(restSpec);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void validateSpec(RestSpec restSpec) {
|
private static void validateSpec(RestSpec restSpec) {
|
||||||
|
@ -293,27 +259,42 @@ public abstract class ESRestTestCase extends ESIntegTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void wipeCluster() throws Exception {
|
||||||
|
|
||||||
|
// wipe indices
|
||||||
|
Map<String, String> deleteIndicesArgs = new HashMap<>();
|
||||||
|
deleteIndicesArgs.put("index", "*");
|
||||||
|
try {
|
||||||
|
adminExecutionContext.callApi("indices.delete", deleteIndicesArgs, Collections.emptyList(), Collections.emptyMap());
|
||||||
|
} catch (RestException e) {
|
||||||
|
// 404 here just means we had no indexes
|
||||||
|
if (e.statusCode() != 404) {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// wipe index templates
|
||||||
|
Map<String, String> deleteTemplatesArgs = new HashMap<>();
|
||||||
|
deleteTemplatesArgs.put("name", "*");
|
||||||
|
adminExecutionContext.callApi("indices.delete_template", deleteTemplatesArgs, Collections.emptyList(), Collections.emptyMap());
|
||||||
|
|
||||||
|
// wipe snapshots
|
||||||
|
Map<String, String> deleteSnapshotsArgs = new HashMap<>();
|
||||||
|
deleteSnapshotsArgs.put("repository", "*");
|
||||||
|
adminExecutionContext.callApi("snapshot.delete_repository", deleteSnapshotsArgs, Collections.emptyList(), Collections.emptyMap());
|
||||||
|
}
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
public static void close() {
|
public static void close() {
|
||||||
if (restTestExecutionContext != null) {
|
if (restTestExecutionContext != null) {
|
||||||
restTestExecutionContext.close();
|
restTestExecutionContext.close();
|
||||||
|
adminExecutionContext.close();
|
||||||
restTestExecutionContext = null;
|
restTestExecutionContext = null;
|
||||||
|
adminExecutionContext = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected int maximumNumberOfShards() {
|
|
||||||
return 3; // never go crazy in the REST tests
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected int maximumNumberOfReplicas() {
|
|
||||||
// hardcoded 1 since this is what clients also do and our tests must expect that we have only node
|
|
||||||
// with replicas set to 1 ie. the cluster won't be green
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to obtain settings for the REST client that is used to send REST requests.
|
* Used to obtain settings for the REST client that is used to send REST requests.
|
||||||
*/
|
*/
|
||||||
|
@ -321,15 +302,29 @@ public abstract class ESRestTestCase extends ESIntegTestCase {
|
||||||
return Settings.EMPTY;
|
return Settings.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Returns the REST client settings used for admin actions like cleaning up after the test has completed. */
|
||||||
|
protected Settings restAdminSettings() {
|
||||||
|
return restClientSettings(); // default to the same client settings
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Returns the addresses the client uses to connect to the test cluster. */
|
||||||
|
protected URL[] getClusterUrls() {
|
||||||
|
return clusterUrls;
|
||||||
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void reset() throws IOException, RestException {
|
public void reset() throws IOException, RestException {
|
||||||
|
// admin context must be available for @After always, regardless of whether the test was blacklisted
|
||||||
|
adminExecutionContext.initClient(clusterUrls, restAdminSettings());
|
||||||
|
adminExecutionContext.clear();
|
||||||
|
|
||||||
//skip test if it matches one of the blacklist globs
|
//skip test if it matches one of the blacklist globs
|
||||||
for (BlacklistedPathPatternMatcher blacklistedPathMatcher : blacklistPathMatchers) {
|
for (BlacklistedPathPatternMatcher blacklistedPathMatcher : blacklistPathMatchers) {
|
||||||
String testPath = testCandidate.getSuitePath() + "/" + testCandidate.getTestSection().getName();
|
String testPath = testCandidate.getSuitePath() + "/" + testCandidate.getTestSection().getName();
|
||||||
assumeFalse("[" + testCandidate.getTestPath() + "] skipped, reason: blacklisted", blacklistedPathMatcher.isSuffixMatch(testPath));
|
assumeFalse("[" + testCandidate.getTestPath() + "] skipped, reason: blacklisted", blacklistedPathMatcher.isSuffixMatch(testPath));
|
||||||
}
|
}
|
||||||
//The client needs non static info to get initialized, therefore it can't be initialized in the before class
|
//The client needs non static info to get initialized, therefore it can't be initialized in the before class
|
||||||
restTestExecutionContext.initClient(cluster().httpAddresses(), restClientSettings());
|
restTestExecutionContext.initClient(clusterUrls, restClientSettings());
|
||||||
restTestExecutionContext.clear();
|
restTestExecutionContext.clear();
|
||||||
|
|
||||||
//skip test if the whole suite (yaml file) is disabled
|
//skip test if the whole suite (yaml file) is disabled
|
||||||
|
|
|
@ -31,6 +31,7 @@ import org.elasticsearch.test.rest.spec.RestSpec;
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
|
import java.net.URL;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -119,9 +120,9 @@ public class RestTestExecutionContext implements Closeable {
|
||||||
/**
|
/**
|
||||||
* Creates the embedded REST client when needed. Needs to be called before each test.
|
* Creates the embedded REST client when needed. Needs to be called before each test.
|
||||||
*/
|
*/
|
||||||
public void initClient(InetSocketAddress[] addresses, Settings settings) throws IOException, RestException {
|
public void initClient(URL[] urls, Settings settings) throws IOException, RestException {
|
||||||
if (restClient == null) {
|
if (restClient == null) {
|
||||||
restClient = new RestClient(restSpec, settings, addresses);
|
restClient = new RestClient(restSpec, settings, urls);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ import org.elasticsearch.common.Strings;
|
||||||
import org.elasticsearch.common.io.PathUtils;
|
import org.elasticsearch.common.io.PathUtils;
|
||||||
import org.elasticsearch.common.logging.ESLogger;
|
import org.elasticsearch.common.logging.ESLogger;
|
||||||
import org.elasticsearch.common.logging.Loggers;
|
import org.elasticsearch.common.logging.Loggers;
|
||||||
|
import org.elasticsearch.common.network.InetAddresses;
|
||||||
import org.elasticsearch.common.network.NetworkAddress;
|
import org.elasticsearch.common.network.NetworkAddress;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.util.set.Sets;
|
import org.elasticsearch.common.util.set.Sets;
|
||||||
|
@ -48,6 +49,7 @@ import java.io.Closeable;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
|
import java.net.URL;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.security.KeyManagementException;
|
import java.security.KeyManagementException;
|
||||||
|
@ -80,18 +82,18 @@ public class RestClient implements Closeable {
|
||||||
private final RestSpec restSpec;
|
private final RestSpec restSpec;
|
||||||
private final CloseableHttpClient httpClient;
|
private final CloseableHttpClient httpClient;
|
||||||
private final Headers headers;
|
private final Headers headers;
|
||||||
private final InetSocketAddress[] addresses;
|
private final URL[] urls;
|
||||||
private final Version esVersion;
|
private final Version esVersion;
|
||||||
|
|
||||||
public RestClient(RestSpec restSpec, Settings settings, InetSocketAddress[] addresses) throws IOException, RestException {
|
public RestClient(RestSpec restSpec, Settings settings, URL[] urls) throws IOException, RestException {
|
||||||
assert addresses.length > 0;
|
assert urls.length > 0;
|
||||||
this.restSpec = restSpec;
|
this.restSpec = restSpec;
|
||||||
this.headers = new Headers(settings);
|
this.headers = new Headers(settings);
|
||||||
this.protocol = settings.get(PROTOCOL, "http");
|
this.protocol = settings.get(PROTOCOL, "http");
|
||||||
this.httpClient = createHttpClient(settings);
|
this.httpClient = createHttpClient(settings);
|
||||||
this.addresses = addresses;
|
this.urls = urls;
|
||||||
this.esVersion = readAndCheckVersion();
|
this.esVersion = readAndCheckVersion();
|
||||||
logger.info("REST client initialized {}, elasticsearch version: [{}]", addresses, esVersion);
|
logger.info("REST client initialized {}, elasticsearch version: [{}]", urls, esVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Version readAndCheckVersion() throws IOException, RestException {
|
private Version readAndCheckVersion() throws IOException, RestException {
|
||||||
|
@ -102,8 +104,8 @@ public class RestClient implements Closeable {
|
||||||
assert restApi.getMethods().size() == 1;
|
assert restApi.getMethods().size() == 1;
|
||||||
|
|
||||||
String version = null;
|
String version = null;
|
||||||
for (InetSocketAddress address : addresses) {
|
for (URL url : urls) {
|
||||||
RestResponse restResponse = new RestResponse(httpRequestBuilder(address)
|
RestResponse restResponse = new RestResponse(httpRequestBuilder(url)
|
||||||
.path(restApi.getPaths().get(0))
|
.path(restApi.getPaths().get(0))
|
||||||
.method(restApi.getMethods().get(0)).execute());
|
.method(restApi.getMethods().get(0)).execute());
|
||||||
checkStatusCode(restResponse);
|
checkStatusCode(restResponse);
|
||||||
|
@ -152,6 +154,8 @@ public class RestClient implements Closeable {
|
||||||
|
|
||||||
HttpRequestBuilder httpRequestBuilder = callApiBuilder(apiName, requestParams, body);
|
HttpRequestBuilder httpRequestBuilder = callApiBuilder(apiName, requestParams, body);
|
||||||
for (Map.Entry<String, String> header : headers.entrySet()) {
|
for (Map.Entry<String, String> header : headers.entrySet()) {
|
||||||
|
logger.error("Adding header " + header.getKey());
|
||||||
|
logger.error(" with value " + header.getValue());
|
||||||
httpRequestBuilder.addHeader(header.getKey(), header.getValue());
|
httpRequestBuilder.addHeader(header.getKey(), header.getValue());
|
||||||
}
|
}
|
||||||
logger.debug("calling api [{}]", apiName);
|
logger.debug("calling api [{}]", apiName);
|
||||||
|
@ -246,17 +250,18 @@ public class RestClient implements Closeable {
|
||||||
return restApi;
|
return restApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected HttpRequestBuilder httpRequestBuilder(InetSocketAddress address) {
|
protected HttpRequestBuilder httpRequestBuilder(URL url) {
|
||||||
return new HttpRequestBuilder(httpClient)
|
return new HttpRequestBuilder(httpClient)
|
||||||
.addHeaders(headers)
|
.addHeaders(headers)
|
||||||
.protocol(protocol)
|
.protocol(protocol)
|
||||||
.host(NetworkAddress.formatAddress(address.getAddress())).port(address.getPort());
|
.host(url.getHost())
|
||||||
|
.port(url.getPort());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected HttpRequestBuilder httpRequestBuilder() {
|
protected HttpRequestBuilder httpRequestBuilder() {
|
||||||
//the address used is randomized between the available ones
|
//the address used is randomized between the available ones
|
||||||
InetSocketAddress address = RandomizedTest.randomFrom(addresses);
|
URL url = RandomizedTest.randomFrom(urls);
|
||||||
return httpRequestBuilder(address);
|
return httpRequestBuilder(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected CloseableHttpClient createHttpClient(Settings settings) throws IOException {
|
protected CloseableHttpClient createHttpClient(Settings settings) throws IOException {
|
||||||
|
|
|
@ -136,7 +136,7 @@ public class RestTestSuiteParseContext {
|
||||||
token = parser.nextToken();
|
token = parser.nextToken();
|
||||||
}
|
}
|
||||||
if (token != XContentParser.Token.FIELD_NAME) {
|
if (token != XContentParser.Token.FIELD_NAME) {
|
||||||
throw new RestTestParseException("malformed test section: field name expected but found " + token);
|
throw new RestTestParseException("malformed test section: field name expected but found " + token + " at " + parser.getTokenLocation());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,11 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.test.rest.parser;
|
package org.elasticsearch.test.rest.parser;
|
||||||
|
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
|
||||||
import org.elasticsearch.common.xcontent.yaml.YamlXContent;
|
|
||||||
import org.elasticsearch.test.rest.section.RestTestSuite;
|
|
||||||
import org.elasticsearch.test.rest.section.TestSection;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.channels.FileChannel;
|
import java.nio.channels.FileChannel;
|
||||||
|
@ -30,6 +25,11 @@ import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.StandardOpenOption;
|
import java.nio.file.StandardOpenOption;
|
||||||
|
|
||||||
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
|
import org.elasticsearch.common.xcontent.yaml.YamlXContent;
|
||||||
|
import org.elasticsearch.test.rest.section.RestTestSuite;
|
||||||
|
import org.elasticsearch.test.rest.section.TestSection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parser for a complete test suite (yaml file)
|
* Parser for a complete test suite (yaml file)
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue