File tree Expand file tree Collapse file tree 3 files changed +31
-0
lines changed
test/test-clusters/src/main/java/org/elasticsearch/test/cluster Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,12 @@ public interface ClusterHandle extends Closeable {
2929 */
3030 void stop (boolean forcibly );
3131
32+ /**
33+ * Stops the node at a given index.
34+ * @param index of the node to stop
35+ */
36+ void stopNode (int index );
37+
3238 /**
3339 * Restarts the cluster. Effectively the same as calling {@link #stop(boolean)} followed by {@link #start()}
3440 *
@@ -60,6 +66,11 @@ public interface ClusterHandle extends Closeable {
6066 */
6167 String getHttpAddress (int index );
6268
69+ /**
70+ * Get the name of the node for the given index.
71+ */
72+ String getName (int index );
73+
6374 /**
6475 * Returns a comma-separated list of TCP transport endpoints for cluster. If this method is called on an unstarted cluster, the cluster
6576 * will be started. This method is thread-safe and subsequent calls will wait for cluster start and availability.
Original file line number Diff line number Diff line change @@ -53,6 +53,12 @@ public void stop(boolean forcibly) {
5353 handle .stop (forcibly );
5454 }
5555
56+ @ Override
57+ public void stopNode (int index ) {
58+ checkHandle ();
59+ handle .stopNode (index );
60+ }
61+
5662 @ Override
5763 public void restart (boolean forcibly ) {
5864 checkHandle ();
@@ -83,6 +89,12 @@ public String getHttpAddress(int index) {
8389 return handle .getHttpAddress (index );
8490 }
8591
92+ @ Override
93+ public String getName (int index ) {
94+ checkHandle ();
95+ return handle .getName (index );
96+ }
97+
8698 @ Override
8799 public String getTransportEndpoints () {
88100 checkHandle ();
Original file line number Diff line number Diff line change @@ -156,6 +156,14 @@ public void upgradeToVersion(Version version) {
156156 waitUntilReady ();
157157 }
158158
159+ public String getName (int index ) {
160+ return nodes .get (index ).getName ();
161+ }
162+
163+ public void stopNode (int index ) {
164+ nodes .get (index ).stop (false );
165+ }
166+
159167 protected void waitUntilReady () {
160168 writeUnicastHostsFile ();
161169 try {
You can’t perform that action at this time.
0 commit comments