Class InternalTestCluster

java.lang.Object
org.elasticsearch.test.TestCluster
org.elasticsearch.test.InternalTestCluster
All Implemented Interfaces:
java.io.Closeable, java.lang.AutoCloseable

public final class InternalTestCluster
extends TestCluster
InternalTestCluster manages a set of JVM private nodes and allows convenient access to them. The cluster supports randomized configuration such that nodes started in the cluster will automatically load asserting services tracking resources like file handles or open searchers.

The Cluster is bound to a test lifecycle where tests must call beforeTest(java.util.Random, double) and afterTest() to initialize and reset the cluster in order to be more reproducible. The term "more" relates to the async nature of Elasticsearch in combination with randomized testing. Once Threads and asynchronous calls are involved reproducibility is very limited. This class should only be used through ESIntegTestCase.

  • Nested Class Summary

    Nested Classes
    Modifier and Type Class Description
    static class  InternalTestCluster.RestartCallback
    An abstract class that is called during rollingRestart(InternalTestCluster.RestartCallback) and / or fullRestart(InternalTestCluster.RestartCallback) to execute actions at certain stages of the restart.
  • Field Summary

    Fields
    Modifier and Type Field Description
    static int DEFAULT_HIGH_NUM_MASTER_NODES  
    static int DEFAULT_LOW_NUM_MASTER_NODES  
    static InternalTestCluster.RestartCallback EMPTY_CALLBACK  
    static int REMOVED_MINIMUM_MASTER_NODES  
    static java.lang.String TRANSPORT_CLIENT_PREFIX  

    Fields inherited from class org.elasticsearch.test.TestCluster

    random, transportClientRatio
  • Constructor Summary

    Constructors
    Constructor Description
    InternalTestCluster​(long clusterSeed, java.nio.file.Path baseDir, boolean randomlyAddDedicatedMasters, boolean autoManageMasterNodes, int minNumDataNodes, int maxNumDataNodes, java.lang.String clusterName, NodeConfigurationSource nodeConfigurationSource, int numClientNodes, java.lang.String nodePrefix, java.util.Collection<java.lang.Class<? extends org.elasticsearch.plugins.Plugin>> mockPlugins, java.util.function.Function<org.elasticsearch.client.Client,​org.elasticsearch.client.Client> clientWrapper)  
    InternalTestCluster​(long clusterSeed, java.nio.file.Path baseDir, boolean randomlyAddDedicatedMasters, boolean autoManageMasterNodes, int minNumDataNodes, int maxNumDataNodes, java.lang.String clusterName, NodeConfigurationSource nodeConfigurationSource, int numClientNodes, java.lang.String nodePrefix, java.util.Collection<java.lang.Class<? extends org.elasticsearch.plugins.Plugin>> mockPlugins, java.util.function.Function<org.elasticsearch.client.Client,​org.elasticsearch.client.Client> clientWrapper, boolean forbidPrivateIndexSettings)  
  • Method Summary

    Modifier and Type Method Description
    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 assertConsistentHistoryBetweenTranslogAndLuceneIndex()
    Asserts that the document history in Lucene index is consistent with Translog's on every index shard of the cluster.
    void assertNoInFlightDocsInEngine()  
    void assertRequestsFinished()  
    void assertSameDocIdsOnShards()
    Asserts that all shards with the same shardId should have document Ids.
    void assertSeqNos()  
    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.
    void clearDisruptionScheme()  
    void clearDisruptionScheme​(boolean ensureHealthyCluster)  
    org.elasticsearch.client.Client client()
    Returns a client connected to any node in the cluster
    org.elasticsearch.client.Client client​(java.lang.String nodeName)
    Returns a node client to a given node.
    void close()
    Closes the current cluster
    void closeNonSharedNodes​(boolean wipeData)  
    static java.lang.String clusterName​(java.lang.String prefix, long clusterSeed)  
    org.elasticsearch.cluster.service.ClusterService clusterService()
    Returns a reference to a random node's ClusterService
    org.elasticsearch.cluster.service.ClusterService clusterService​(java.lang.String node)
    Returns a reference to a node's ClusterService.
    org.elasticsearch.client.Client coordOnlyNodeClient()
    Returns a client to a coordinating only node
    org.elasticsearch.client.Client dataNodeClient()
    Returns a node client to a data node in the cluster.
    org.elasticsearch.common.settings.Settings dataPathSettings​(java.lang.String node)  
    void ensureAtLeastNumDataNodes​(int n)
    Ensures that at least n data nodes are present in the cluster.
    void ensureAtMostNumDataNodes​(int n)
    Ensures that at most n are up and running.
    void ensureEstimatedStats()
    Ensures that any breaker statistics are reset to 0.
    void fullRestart()
    Restarts all nodes in the cluster.
    void fullRestart​(InternalTestCluster.RestartCallback callback)
    Restarts all nodes in the cluster.
    boolean getAutoManageMinMasterNode()
    returns true if the ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING setting is auto managed by this cluster
    java.lang.Iterable<org.elasticsearch.client.Client> getClients()
    Returns an Iterable over all clients in this test cluster
    java.lang.String getClusterName()
    Returns the cluster name
    <T> T getCurrentMasterNodeInstance​(java.lang.Class<T> clazz)  
    <T> T getDataNodeInstance​(java.lang.Class<T> clazz)  
    <T> java.lang.Iterable<T> getDataNodeInstances​(java.lang.Class<T> clazz)
    Returns an Iterable to all instances for the given class >T< across all data nodes in the cluster.
    <T> java.lang.Iterable<T> getDataOrMasterNodeInstances​(java.lang.Class<T> clazz)
    Returns an Iterable to all instances for the given class >T< across all data and master nodes in the cluster.
    org.elasticsearch.common.settings.Settings getDefaultSettings()  
    <T> T getInstance​(java.lang.Class<T> clazz)
    Returns a reference to a random nodes instances of the given class >T<
    <T> T getInstance​(java.lang.Class<T> clazz, java.lang.String node)
    Returns a reference to the given nodes instances of the given class >T<
    <T> java.lang.Iterable<T> getInstances​(java.lang.Class<T> clazz)
    Returns an Iterable to all instances for the given class >T< across all nodes in the cluster.
    java.lang.String getMasterName()
    Returns the name of the current master node in the cluster.
    java.lang.String getMasterName​(java.lang.String viaNode)
    Returns the name of the current master node in the cluster and executes the request via the node specified in the viaNode parameter.
    <T> T getMasterNodeInstance​(java.lang.Class<T> clazz)  
    org.elasticsearch.common.io.stream.NamedWriteableRegistry getNamedWriteableRegistry()
    Returns this clusters NamedWriteableRegistry this is needed to deserialize binary content from this cluster that might include custom named writeables
    java.lang.String[] getNodeNames()  
    java.util.Collection<java.lang.Class<? extends org.elasticsearch.plugins.Plugin>> getPlugins()  
    java.net.InetSocketAddress[] httpAddresses()
    Returns the http addresses of the nodes within the cluster.
    org.elasticsearch.client.Client masterClient()
    Returns a node client to the current master node.
    static java.util.function.Predicate<org.elasticsearch.common.settings.Settings> nameFilter​(java.lang.String... nodeNames)
    Returns a predicate that only accepts settings of nodes with one of the given names.
    java.util.Set<java.lang.String> nodesInclude​(java.lang.String index)
    Returns a set of nodes that have at least one shard of the given index.
    org.elasticsearch.client.Client nonMasterClient()
    Returns a node client to random node but not the master.
    int numDataAndMasterNodes()
    Returns the number of data and master eligible nodes in the cluster.
    int numDataNodes()
    Returns the number of data nodes in the cluster.
    int numMasterNodes()  
    void restartNode​(java.lang.String nodeName)
    Restarts a node.
    void restartNode​(java.lang.String nodeName, InternalTestCluster.RestartCallback callback)
    Restarts a node and calls the callback during restart.
    void restartRandomDataNode()
    Restarts a random data node in the cluster
    void restartRandomDataNode​(InternalTestCluster.RestartCallback callback)
    Restarts a random data node in the cluster and calls the callback during restart.
    void rollingRestart​(InternalTestCluster.RestartCallback callback)
    Restarts all nodes in a rolling restart fashion ie.
    void setBootstrapMasterNodeIndex​(int bootstrapMasterNodeIndex)
    Sets bootstrapMasterNodeIndex to the given value, see bootstrapMasterNodeWithSpecifiedIndex(List) for the description of how this field is used.
    void setDisruptionScheme​(ServiceDisruptionScheme scheme)  
    int size()
    Returns the number of nodes in the cluster.
    org.elasticsearch.client.Client smartClient()
    Returns a "smart" node client to a random node in the cluster
    java.lang.String startCoordinatingOnlyNode​(org.elasticsearch.common.settings.Settings settings)  
    java.lang.String startDataOnlyNode()  
    java.lang.String startDataOnlyNode​(org.elasticsearch.common.settings.Settings settings)  
    java.util.List<java.lang.String> startDataOnlyNodes​(int numNodes)  
    java.util.List<java.lang.String> startDataOnlyNodes​(int numNodes, org.elasticsearch.common.settings.Settings settings)  
    java.lang.String startMasterOnlyNode()  
    java.lang.String startMasterOnlyNode​(org.elasticsearch.common.settings.Settings settings)  
    java.util.List<java.lang.String> startMasterOnlyNodes​(int numNodes)  
    java.util.List<java.lang.String> startMasterOnlyNodes​(int numNodes, org.elasticsearch.common.settings.Settings settings)  
    java.lang.String startNode()
    Starts a node with default settings and returns its name.
    java.lang.String startNode​(org.elasticsearch.common.settings.Settings settings)
    Starts a node with the given settings and returns its name.
    java.lang.String startNode​(org.elasticsearch.common.settings.Settings.Builder settings)
    Starts a node with the given settings builder and returns its name.
    java.util.List<java.lang.String> startNodes​(int numOfNodes)
    Starts multiple nodes with default settings and returns their names
    java.util.List<java.lang.String> startNodes​(int numOfNodes, org.elasticsearch.common.settings.Settings settings)
    Starts multiple nodes with the given settings and returns their names
    java.util.List<java.lang.String> startNodes​(org.elasticsearch.common.settings.Settings... extraSettings)
    Starts multiple nodes with the given settings and returns their names
    void stopCurrentMasterNode()
    Stops the current master node forcefully
    boolean stopNode​(java.lang.String nodeName)
    Stops a specific node in the cluster.
    boolean stopRandomDataNode()
    Stops a random data node in the cluster.
    void stopRandomNode​(java.util.function.Predicate<org.elasticsearch.common.settings.Settings> filter)
    Stops a random node in the cluster that applies to the given filter.
    void stopRandomNonMasterNode()
    Stops any of the current nodes but not the master node.
    org.elasticsearch.client.Client transportClient()
    Returns a transport client
    void validateClusterFormed()
    ensure a cluster is formed with all published nodes.
    void wipePendingDataDirectories()  

    Methods inherited from class org.elasticsearch.test.TestCluster

    seed, wipe, wipeAllTemplates, wipeIndices, wipeRepositories, wipeTemplates

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • InternalTestCluster

      public InternalTestCluster​(long clusterSeed, java.nio.file.Path baseDir, boolean randomlyAddDedicatedMasters, boolean autoManageMasterNodes, int minNumDataNodes, int maxNumDataNodes, java.lang.String clusterName, NodeConfigurationSource nodeConfigurationSource, int numClientNodes, java.lang.String nodePrefix, java.util.Collection<java.lang.Class<? extends org.elasticsearch.plugins.Plugin>> mockPlugins, java.util.function.Function<org.elasticsearch.client.Client,​org.elasticsearch.client.Client> clientWrapper)
    • InternalTestCluster

      public InternalTestCluster​(long clusterSeed, java.nio.file.Path baseDir, boolean randomlyAddDedicatedMasters, boolean autoManageMasterNodes, int minNumDataNodes, int maxNumDataNodes, java.lang.String clusterName, NodeConfigurationSource nodeConfigurationSource, int numClientNodes, java.lang.String nodePrefix, java.util.Collection<java.lang.Class<? extends org.elasticsearch.plugins.Plugin>> mockPlugins, java.util.function.Function<org.elasticsearch.client.Client,​org.elasticsearch.client.Client> clientWrapper, boolean forbidPrivateIndexSettings)
  • Method Details

    • setBootstrapMasterNodeIndex

      public void setBootstrapMasterNodeIndex​(int bootstrapMasterNodeIndex)
      Sets bootstrapMasterNodeIndex to the given value, see bootstrapMasterNodeWithSpecifiedIndex(List) for the description of how this field is used. It's only possible to change bootstrapMasterNodeIndex value if autoManageMasterNodes is false.
    • getClusterName

      public java.lang.String getClusterName()
      Description copied from class: TestCluster
      Returns the cluster name
      Specified by:
      getClusterName in class TestCluster
    • getAutoManageMinMasterNode

      public boolean getAutoManageMinMasterNode()
      returns true if the ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING setting is auto managed by this cluster
    • getNodeNames

      public java.lang.String[] getNodeNames()
    • getPlugins

      public java.util.Collection<java.lang.Class<? extends org.elasticsearch.plugins.Plugin>> getPlugins()
    • clusterName

      public static java.lang.String clusterName​(java.lang.String prefix, long clusterSeed)
    • ensureAtLeastNumDataNodes

      public void ensureAtLeastNumDataNodes​(int n)
      Ensures that at least n data nodes are present in the cluster. if more nodes than n are present this method will not stop any of the running nodes.
    • ensureAtMostNumDataNodes

      public void ensureAtMostNumDataNodes​(int n) throws java.io.IOException
      Ensures that at most n are up and running. If less nodes that n are running this method will not start any additional nodes.
      Throws:
      java.io.IOException
    • client

      public org.elasticsearch.client.Client client()
      Description copied from class: TestCluster
      Returns a client connected to any node in the cluster
      Specified by:
      client in class TestCluster
    • dataNodeClient

      public org.elasticsearch.client.Client dataNodeClient()
      Returns a node client to a data node in the cluster. Note: use this with care tests should not rely on a certain nodes client.
    • masterClient

      public org.elasticsearch.client.Client masterClient()
      Returns a node client to the current master node. Note: use this with care tests should not rely on a certain nodes client.
    • nonMasterClient

      public org.elasticsearch.client.Client nonMasterClient()
      Returns a node client to random node but not the master. This method will fail if no non-master client is available.
    • coordOnlyNodeClient

      public org.elasticsearch.client.Client coordOnlyNodeClient()
      Returns a client to a coordinating only node
    • startCoordinatingOnlyNode

      public java.lang.String startCoordinatingOnlyNode​(org.elasticsearch.common.settings.Settings settings)
    • transportClient

      public org.elasticsearch.client.Client transportClient()
      Returns a transport client
    • client

      public org.elasticsearch.client.Client client​(java.lang.String nodeName)
      Returns a node client to a given node.
    • smartClient

      public org.elasticsearch.client.Client smartClient()
      Returns a "smart" node client to a random node in the cluster
    • close

      public void close() throws java.io.IOException
      Description copied from class: TestCluster
      Closes the current cluster
      Specified by:
      close in interface java.lang.AutoCloseable
      Specified by:
      close in interface java.io.Closeable
      Specified by:
      close in class TestCluster
      Throws:
      java.io.IOException
    • beforeTest

      public void beforeTest​(java.util.Random random, double transportClientRatio) throws java.io.IOException, java.lang.InterruptedException
      Description copied from class: TestCluster
      This method should be executed before each test to reset the cluster to its initial state.
      Overrides:
      beforeTest in class TestCluster
      Throws:
      java.io.IOException
      java.lang.InterruptedException
    • validateClusterFormed

      public void validateClusterFormed()
      ensure a cluster is formed with all published nodes.
    • 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 class TestCluster
    • beforeIndexDeletion

      public void beforeIndexDeletion() throws java.lang.Exception
      Description copied from class: TestCluster
      Assertions that should run before the cluster is wiped should be called in this method
      Overrides:
      beforeIndexDeletion in class TestCluster
      Throws:
      java.lang.Exception
    • assertConsistentHistoryBetweenTranslogAndLuceneIndex

      public void assertConsistentHistoryBetweenTranslogAndLuceneIndex() throws java.io.IOException
      Asserts that the document history in Lucene index is consistent with Translog's on every index shard of the cluster. This assertion might be expensive, thus we prefer not to execute on every test but only interesting tests.
      Throws:
      java.io.IOException
    • assertNoInFlightDocsInEngine

      public void assertNoInFlightDocsInEngine() throws java.lang.Exception
      Throws:
      java.lang.Exception
    • assertSeqNos

      public void assertSeqNos() throws java.lang.Exception
      Throws:
      java.lang.Exception
    • assertSameDocIdsOnShards

      public void assertSameDocIdsOnShards() throws java.lang.Exception
      Asserts that all shards with the same shardId should have document Ids.
      Throws:
      java.lang.Exception
    • wipePendingDataDirectories

      public void wipePendingDataDirectories()
    • clusterService

      public org.elasticsearch.cluster.service.ClusterService clusterService()
      Returns a reference to a random node's ClusterService
    • clusterService

      public org.elasticsearch.cluster.service.ClusterService clusterService​(@Nullable java.lang.String node)
      Returns a reference to a node's ClusterService. If the given node is null, a random node will be selected.
    • getInstances

      public <T> java.lang.Iterable<T> getInstances​(java.lang.Class<T> clazz)
      Returns an Iterable to all instances for the given class >T< across all nodes in the cluster.
    • getDataNodeInstances

      public <T> java.lang.Iterable<T> getDataNodeInstances​(java.lang.Class<T> clazz)
      Returns an Iterable to all instances for the given class >T< across all data nodes in the cluster.
    • getCurrentMasterNodeInstance

      public <T> T getCurrentMasterNodeInstance​(java.lang.Class<T> clazz)
    • getDataOrMasterNodeInstances

      public <T> java.lang.Iterable<T> getDataOrMasterNodeInstances​(java.lang.Class<T> clazz)
      Returns an Iterable to all instances for the given class >T< across all data and master nodes in the cluster.
    • getInstance

      public <T> T getInstance​(java.lang.Class<T> clazz, java.lang.String node)
      Returns a reference to the given nodes instances of the given class >T<
    • getDataNodeInstance

      public <T> T getDataNodeInstance​(java.lang.Class<T> clazz)
    • getMasterNodeInstance

      public <T> T getMasterNodeInstance​(java.lang.Class<T> clazz)
    • getInstance

      public <T> T getInstance​(java.lang.Class<T> clazz)
      Returns a reference to a random nodes instances of the given class >T<
    • dataPathSettings

      public org.elasticsearch.common.settings.Settings dataPathSettings​(java.lang.String node)
    • size

      public int size()
      Description copied from class: TestCluster
      Returns the number of nodes in the cluster.
      Specified by:
      size in class TestCluster
    • httpAddresses

      public java.net.InetSocketAddress[] 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 class TestCluster
    • stopRandomDataNode

      public boolean stopRandomDataNode() throws java.io.IOException
      Stops a random data node in the cluster. Returns true if a node was found to stop, false otherwise.
      Throws:
      java.io.IOException
    • stopNode

      public boolean stopNode​(java.lang.String nodeName) throws java.io.IOException
      Stops a specific node in the cluster. Returns true if the node was found to stop, false otherwise.
      Throws:
      java.io.IOException
    • stopRandomNode

      public void stopRandomNode​(java.util.function.Predicate<org.elasticsearch.common.settings.Settings> filter) throws java.io.IOException
      Stops a random node in the cluster that applies to the given filter. Does nothing if none of the nodes match the filter.
      Throws:
      java.io.IOException
    • stopCurrentMasterNode

      public void stopCurrentMasterNode() throws java.io.IOException
      Stops the current master node forcefully
      Throws:
      java.io.IOException
    • stopRandomNonMasterNode

      public void stopRandomNonMasterNode() throws java.io.IOException
      Stops any of the current nodes but not the master node.
      Throws:
      java.io.IOException
    • restartRandomDataNode

      public void restartRandomDataNode() throws java.lang.Exception
      Restarts a random data node in the cluster
      Throws:
      java.lang.Exception
    • restartRandomDataNode

      public void restartRandomDataNode​(InternalTestCluster.RestartCallback callback) throws java.lang.Exception
      Restarts a random data node in the cluster and calls the callback during restart.
      Throws:
      java.lang.Exception
    • restartNode

      public void restartNode​(java.lang.String nodeName) throws java.lang.Exception
      Restarts a node.
      Throws:
      java.lang.Exception
    • restartNode

      public void restartNode​(java.lang.String nodeName, InternalTestCluster.RestartCallback callback) throws java.lang.Exception
      Restarts a node and calls the callback during restart.
      Throws:
      java.lang.Exception
    • fullRestart

      public void fullRestart() throws java.lang.Exception
      Restarts all nodes in the cluster. It first stops all nodes and then restarts all the nodes again.
      Throws:
      java.lang.Exception
    • rollingRestart

      public void rollingRestart​(InternalTestCluster.RestartCallback callback) throws java.lang.Exception
      Restarts all nodes in a rolling restart fashion ie. only restarts on node a time.
      Throws:
      java.lang.Exception
    • fullRestart

      public void fullRestart​(InternalTestCluster.RestartCallback callback) throws java.lang.Exception
      Restarts all nodes in the cluster. It first stops all nodes and then restarts all the nodes again.
      Throws:
      java.lang.Exception
    • getMasterName

      public java.lang.String getMasterName()
      Returns the name of the current master node in the cluster.
    • getMasterName

      public java.lang.String getMasterName​(@Nullable java.lang.String viaNode)
      Returns the name of the current master node in the cluster and executes the request via the node specified in the viaNode parameter. If viaNode isn't specified a random node will be picked to the send the request to.
    • nodesInclude

      public java.util.Set<java.lang.String> nodesInclude​(java.lang.String index)
      Returns a set of nodes that have at least one shard of the given index.
    • startNode

      public java.lang.String startNode()
      Starts a node with default settings and returns its name.
    • startNode

      public java.lang.String startNode​(org.elasticsearch.common.settings.Settings.Builder settings)
      Starts a node with the given settings builder and returns its name.
    • startNode

      public java.lang.String startNode​(org.elasticsearch.common.settings.Settings settings)
      Starts a node with the given settings and returns its name.
    • startNodes

      public java.util.List<java.lang.String> startNodes​(int numOfNodes)
      Starts multiple nodes with default settings and returns their names
    • startNodes

      public java.util.List<java.lang.String> startNodes​(int numOfNodes, org.elasticsearch.common.settings.Settings settings)
      Starts multiple nodes with the given settings and returns their names
    • startNodes

      public java.util.List<java.lang.String> startNodes​(org.elasticsearch.common.settings.Settings... extraSettings)
      Starts multiple nodes with the given settings and returns their names
    • startMasterOnlyNodes

      public java.util.List<java.lang.String> startMasterOnlyNodes​(int numNodes)
    • startMasterOnlyNodes

      public java.util.List<java.lang.String> startMasterOnlyNodes​(int numNodes, org.elasticsearch.common.settings.Settings settings)
    • startDataOnlyNodes

      public java.util.List<java.lang.String> startDataOnlyNodes​(int numNodes)
    • startDataOnlyNodes

      public java.util.List<java.lang.String> startDataOnlyNodes​(int numNodes, org.elasticsearch.common.settings.Settings settings)
    • startMasterOnlyNode

      public java.lang.String startMasterOnlyNode()
    • startMasterOnlyNode

      public java.lang.String startMasterOnlyNode​(org.elasticsearch.common.settings.Settings settings)
    • startDataOnlyNode

      public java.lang.String startDataOnlyNode()
    • startDataOnlyNode

      public java.lang.String startDataOnlyNode​(org.elasticsearch.common.settings.Settings settings)
    • closeNonSharedNodes

      public void closeNonSharedNodes​(boolean wipeData) throws java.io.IOException
      Throws:
      java.io.IOException
    • numDataNodes

      public int numDataNodes()
      Description copied from class: TestCluster
      Returns the number of data nodes in the cluster.
      Specified by:
      numDataNodes in class TestCluster
    • 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 class TestCluster
    • numMasterNodes

      public int numMasterNodes()
    • setDisruptionScheme

      public void setDisruptionScheme​(ServiceDisruptionScheme scheme)
    • clearDisruptionScheme

      public void clearDisruptionScheme()
    • clearDisruptionScheme

      public void clearDisruptionScheme​(boolean ensureHealthyCluster)
    • getClients

      public java.lang.Iterable<org.elasticsearch.client.Client> getClients()
      Description copied from class: TestCluster
      Returns an Iterable over all clients in this test cluster
      Specified by:
      getClients in class TestCluster
    • getNamedWriteableRegistry

      public org.elasticsearch.common.io.stream.NamedWriteableRegistry getNamedWriteableRegistry()
      Description copied from class: TestCluster
      Returns this clusters NamedWriteableRegistry this is needed to deserialize binary content from this cluster that might include custom named writeables
      Specified by:
      getNamedWriteableRegistry in class TestCluster
    • nameFilter

      public static java.util.function.Predicate<org.elasticsearch.common.settings.Settings> nameFilter​(java.lang.String... nodeNames)
      Returns a predicate that only accepts settings of nodes with one of the given names.
    • getDefaultSettings

      public org.elasticsearch.common.settings.Settings getDefaultSettings()
    • 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 class TestCluster
    • assertAfterTest

      public void assertAfterTest() throws java.lang.Exception
      Description copied from class: TestCluster
      This method checks all the things that need to be checked after each test
      Overrides:
      assertAfterTest in class TestCluster
      Throws:
      java.lang.Exception
    • assertRequestsFinished

      public void assertRequestsFinished()