File tree Expand file tree Collapse file tree 1 file changed +16
-6
lines changed
test/test-clusters/src/main/java/org/elasticsearch/test/cluster/local Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -118,8 +118,11 @@ public void close() {
118118
119119 @ Override
120120 public String getHttpAddresses () {
121- start ();
122- return execute (() -> nodes .parallelStream ().map (Node ::getHttpAddress ).collect (Collectors .joining ("," )));
121+ if (started .get ()) {
122+ return execute (() -> nodes .parallelStream ().map (Node ::getHttpAddress ).collect (Collectors .joining ("," )));
123+ } else {
124+ throw new IllegalStateException ("Elasticsearch cluster [" + name + "] has not been started." );
125+ }
123126 }
124127
125128 @ Override
@@ -129,8 +132,12 @@ public String getHttpAddress(int index) {
129132
130133 @ Override
131134 public String getTransportEndpoints () {
132- start ();
133- return execute (() -> nodes .parallelStream ().map (Node ::getTransportEndpoint ).collect (Collectors .joining ("," )));
135+ if (started .get ()) {
136+ return execute (() -> nodes .parallelStream ().map (Node ::getTransportEndpoint ).collect (Collectors .joining ("," )));
137+ } else {
138+ throw new IllegalStateException ("Elasticsearch cluster [" + name + "] has not been started." );
139+ }
140+
134141 }
135142
136143 @ Override
@@ -153,8 +160,11 @@ public String getTransportEndpoint(int index) {
153160
154161 @ Override
155162 public String getRemoteClusterServerEndpoints () {
156- start ();
157- return execute (() -> nodes .parallelStream ().map (Node ::getRemoteClusterServerEndpoint ).collect (Collectors .joining ("," )));
163+ if (started .get ()) {
164+ return execute (() -> nodes .parallelStream ().map (Node ::getRemoteClusterServerEndpoint ).collect (Collectors .joining ("," )));
165+ } else {
166+ throw new IllegalStateException ("Elasticsearch cluster [" + name + "] has not been started." );
167+ }
158168 }
159169
160170 @ Override
You can’t perform that action at this time.
0 commit comments