Package org.elasticsearch.test
Class ExternalTestCluster
java.lang.Object
org.elasticsearch.test.TestCluster
org.elasticsearch.test.ExternalTestCluster
- All Implemented Interfaces:
Closeable,AutoCloseable
External cluster to run the tests against.
It is a pure immutable test cluster that allows to send requests to a pre-existing cluster
and supports by nature all the needed test operations like wipeIndices etc.
-
Field Summary
FieldsFields inherited from class org.elasticsearch.test.TestCluster
random -
Constructor Summary
ConstructorsConstructorDescriptionExternalTestCluster(Path tempDir, org.elasticsearch.common.settings.Settings additionalSettings, Collection<Class<? extends org.elasticsearch.plugins.Plugin>> pluginClasses, Function<org.elasticsearch.client.internal.Client, org.elasticsearch.client.internal.Client> clientWrapper, String clusterName, org.elasticsearch.common.transport.TransportAddress... transportAddresses) -
Method Summary
Modifier and TypeMethodDescriptionvoidThis method should be executed during tear down, after each test (but after assertAfterTest)org.elasticsearch.client.internal.Clientclient()Returns a client connected to any node in the clustervoidclose()Closes the current clustervoidEnsures that any breaker statistics are reset to 0.Iterable<org.elasticsearch.client.internal.Client>Returns anIterableover all clients in this test clusterReturns the cluster nameorg.elasticsearch.common.io.stream.NamedWriteableRegistryReturns this clustersNamedWriteableRegistrythis is needed to deserialize binary content from this cluster that might include custom named writeablesReturns the http addresses of the nodes within the cluster.intReturns the number of data and master eligible nodes in the cluster.intReturns the number of data nodes in the cluster.intsize()Returns the number of nodes in the cluster.Methods inherited from class org.elasticsearch.test.TestCluster
assertAfterTest, beforeIndexDeletion, beforeTest, seed, wipe, wipeAllComponentTemplates, wipeAllComposableIndexTemplates, wipeAllDataStreams, wipeAllTemplates, wipeIndices, wipeRepositories, wipeTemplates
-
Field Details
-
EXTERNAL_CLUSTER_PREFIX
- See Also:
-
-
Constructor Details
-
ExternalTestCluster
public ExternalTestCluster(Path tempDir, org.elasticsearch.common.settings.Settings additionalSettings, Collection<Class<? extends org.elasticsearch.plugins.Plugin>> pluginClasses, Function<org.elasticsearch.client.internal.Client, org.elasticsearch.client.internal.Client> clientWrapper, String clusterName, org.elasticsearch.common.transport.TransportAddress... transportAddresses)
-
-
Method Details
-
afterTest
public void afterTest()Description copied from class:TestClusterThis method should be executed during tear down, after each test (but after assertAfterTest)- Specified by:
afterTestin classTestCluster
-
client
public org.elasticsearch.client.internal.Client client()Description copied from class:TestClusterReturns a client connected to any node in the cluster- Specified by:
clientin classTestCluster
-
size
public int size()Description copied from class:TestClusterReturns the number of nodes in the cluster.- Specified by:
sizein classTestCluster
-
numDataNodes
public int numDataNodes()Description copied from class:TestClusterReturns the number of data nodes in the cluster.- Specified by:
numDataNodesin classTestCluster
-
numDataAndMasterNodes
public int numDataAndMasterNodes()Description copied from class:TestClusterReturns the number of data and master eligible nodes in the cluster.- Specified by:
numDataAndMasterNodesin classTestCluster
-
httpAddresses
Description copied from class:TestClusterReturns the http addresses of the nodes within the cluster. Can be used to run REST tests against the test cluster.- Specified by:
httpAddressesin classTestCluster
-
close
Description copied from class:TestClusterCloses the current cluster- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classTestCluster- Throws:
IOException
-
ensureEstimatedStats
public void ensureEstimatedStats()Description copied from class:TestClusterEnsures that any breaker statistics are reset to 0. The implementation is specific to the test cluster, because the act of checking some breaker stats can increase them.- Specified by:
ensureEstimatedStatsin classTestCluster
-
getClients
Description copied from class:TestClusterReturns anIterableover all clients in this test cluster- Specified by:
getClientsin classTestCluster
-
getNamedWriteableRegistry
public org.elasticsearch.common.io.stream.NamedWriteableRegistry getNamedWriteableRegistry()Description copied from class:TestClusterReturns this clustersNamedWriteableRegistrythis is needed to deserialize binary content from this cluster that might include custom named writeables- Specified by:
getNamedWriteableRegistryin classTestCluster
-
getClusterName
Description copied from class:TestClusterReturns the cluster name- Specified by:
getClusterNamein classTestCluster
-