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
Fields inherited from class org.elasticsearch.test.TestCluster
random
-
Constructor Summary
ConstructorDescriptionExternalTestCluster
(Path tempDir, Settings additionalSettings, Collection<Class<? extends Plugin>> pluginClasses, Function<Client, Client> clientWrapper, String clusterName, TransportAddress... transportAddresses) -
Method Summary
Modifier and TypeMethodDescriptionvoid
This method should be executed during tear down, after each test (but after assertAfterTest)client()
Returns a client connected to any node in the clustervoid
close()
Closes the current clustervoid
Ensures that any breaker statistics are reset to 0.Returns anIterable
over all clients in this test clusterReturns the cluster nameReturns this clustersNamedWriteableRegistry
this is needed to deserialize binary content from this cluster that might include custom named writeablesReturns the http addresses of the nodes within the cluster.int
Returns the number of data and master eligible nodes in the cluster.int
Returns the number of data nodes in the cluster.int
size()
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, Settings additionalSettings, Collection<Class<? extends Plugin>> pluginClasses, Function<Client, Client> clientWrapper, String clusterName, TransportAddress... transportAddresses)
-
-
Method Details
-
afterTest
public void afterTest()Description copied from class:TestCluster
This method should be executed during tear down, after each test (but after assertAfterTest)- Specified by:
afterTest
in classTestCluster
-
client
Description copied from class:TestCluster
Returns a client connected to any node in the cluster- Specified by:
client
in classTestCluster
-
size
public int size()Description copied from class:TestCluster
Returns the number of nodes in the cluster.- Specified by:
size
in classTestCluster
-
numDataNodes
public int numDataNodes()Description copied from class:TestCluster
Returns the number of data nodes in the cluster.- Specified by:
numDataNodes
in classTestCluster
-
numDataAndMasterNodes
public int numDataAndMasterNodes()Description copied from class:TestCluster
Returns the number of data and master eligible nodes in the cluster.- Specified by:
numDataAndMasterNodes
in classTestCluster
-
httpAddresses
Description copied from class:TestCluster
Returns the http addresses of the nodes within the cluster. Can be used to run REST tests against the test cluster.- Specified by:
httpAddresses
in classTestCluster
-
close
Description copied from class:TestCluster
Closes the current cluster- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in classTestCluster
- Throws:
IOException
-
ensureEstimatedStats
public void ensureEstimatedStats()Description copied from class:TestCluster
Ensures 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:
ensureEstimatedStats
in classTestCluster
-
getClients
Description copied from class:TestCluster
Returns anIterable
over all clients in this test cluster- Specified by:
getClients
in classTestCluster
-
getNamedWriteableRegistry
Description copied from class:TestCluster
Returns this clustersNamedWriteableRegistry
this is needed to deserialize binary content from this cluster that might include custom named writeables- Specified by:
getNamedWriteableRegistry
in classTestCluster
-
getClusterName
Description copied from class:TestCluster
Returns the cluster name- Specified by:
getClusterName
in classTestCluster
-