public abstract class TestCluster
extends java.lang.Object
implements java.io.Closeable
Modifier and Type | Field and Description |
---|---|
protected org.apache.logging.log4j.Logger |
logger |
protected java.util.Random |
random |
protected double |
transportClientRatio |
Constructor and Description |
---|
TestCluster(long seed) |
Modifier and Type | Method and Description |
---|---|
abstract void |
afterTest()
This method should be executed during tear down, after each test (but after assertAfterTest)
|
void |
assertAfterTest()
This method checks all the things that need to be checked after each test
|
void |
beforeIndexDeletion()
Assertions that should run before the cluster is wiped should be called in this method
|
void |
beforeTest(java.util.Random random,
double transportClientRatio)
This method should be executed before each test to reset the cluster to its initial state.
|
abstract org.elasticsearch.client.Client |
client()
Returns a client connected to any node in the cluster
|
abstract void |
close()
Closes the current cluster
|
abstract void |
ensureEstimatedStats()
Ensures that any breaker statistics are reset to 0.
|
abstract java.lang.Iterable<org.elasticsearch.client.Client> |
getClients()
Returns an
Iterable over all clients in this test cluster |
abstract java.lang.String |
getClusterName()
Returns the cluster name
|
abstract java.net.InetSocketAddress[] |
httpAddresses()
Returns the http addresses of the nodes within the cluster.
|
abstract int |
numDataAndMasterNodes()
Returns the number of data and master eligible nodes in the cluster.
|
abstract int |
numDataNodes()
Returns the number of data nodes in the cluster.
|
long |
seed() |
abstract int |
size()
Returns the number of nodes in the cluster.
|
void |
wipe(java.util.Set<java.lang.String> excludeTemplates)
Wipes any data that a test can leave behind: indices, templates (except exclude templates) and repositories
|
void |
wipeAllTemplates(java.util.Set<java.lang.String> exclude)
Removes all templates, except the templates defined in the exclude
|
void |
wipeIndices(java.lang.String... indices)
Deletes the given indices from the tests cluster.
|
void |
wipeRepositories(java.lang.String... repositories)
Deletes repositories, supports wildcard notation.
|
void |
wipeTemplates(java.lang.String... templates)
Deletes index templates, support wildcard notation.
|
protected final org.apache.logging.log4j.Logger logger
protected java.util.Random random
protected double transportClientRatio
public long seed()
public void beforeTest(java.util.Random random, double transportClientRatio) throws java.io.IOException, java.lang.InterruptedException
java.io.IOException
java.lang.InterruptedException
public void wipe(java.util.Set<java.lang.String> excludeTemplates)
public void beforeIndexDeletion()
public void assertAfterTest() throws java.io.IOException
java.io.IOException
public abstract void afterTest() throws java.io.IOException
java.io.IOException
public abstract org.elasticsearch.client.Client client()
public abstract int size()
public abstract int numDataNodes()
public abstract int numDataAndMasterNodes()
public abstract java.net.InetSocketAddress[] httpAddresses()
public abstract void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException
public void wipeIndices(java.lang.String... indices)
public void wipeAllTemplates(java.util.Set<java.lang.String> exclude)
public void wipeTemplates(java.lang.String... templates)
public void wipeRepositories(java.lang.String... repositories)
public abstract void ensureEstimatedStats()
public abstract java.lang.String getClusterName()
public abstract java.lang.Iterable<org.elasticsearch.client.Client> getClients()
Iterable
over all clients in this test cluster