Skip to content

Commit

Permalink
Add number of nodes accessor to test cluster handle (#108484)
Browse files Browse the repository at this point in the history
Local test clusters have several methods allowing interaction with nodes
by ordinal number. However, there is currently no way to know how mnany
nodes were actually configured for the cluster. This commit adds an
accessor for the number of nodes the cluster handle knows about.
  • Loading branch information
rjernst committed May 9, 2024
1 parent 0b71746 commit 1bc6474
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
Expand Up @@ -65,6 +65,11 @@ public DefaultLocalClusterHandle(String name, List<Node> nodes) {
this.nodes = nodes;
}

@Override
public int getNumNodes() {
return nodes.size();
}

@Override
public void start() {
if (started.getAndSet(true) == false) {
Expand Down
Expand Up @@ -54,6 +54,11 @@ public void evaluate() throws Throwable {
};
}

@Override
public int getNumNodes() {
return handle.getNumNodes();
}

@Override
public void start() {
checkHandle();
Expand Down
Expand Up @@ -16,6 +16,12 @@
import java.io.InputStream;

public interface LocalClusterHandle extends ClusterHandle {

/**
* Returns the number of nodes that are part of this cluster.
*/
int getNumNodes();

/**
* Stops the node at a given index.
* @param index of the node to stop
Expand Down

0 comments on commit 1bc6474

Please sign in to comment.