Skip to content

Commit 34295fa

Browse files
committed
HLREST: AwaitsFix ML Test
It leaks state into other tests causing them to fail sometimes. Relates to #32993
1 parent faa42de commit 34295fa

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

client/rest-high-level/src/test/java/org/elasticsearch/client/ClusterClientIT.java

+6
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
package org.elasticsearch.client;
2121

22+
import org.apache.http.util.EntityUtils;
2223
import org.elasticsearch.ElasticsearchException;
2324
import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest;
2425
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
@@ -34,6 +35,7 @@
3435
import org.elasticsearch.common.unit.ByteSizeUnit;
3536
import org.elasticsearch.common.xcontent.XContentType;
3637
import org.elasticsearch.common.xcontent.support.XContentMapValues;
38+
import org.elasticsearch.client.Request;
3739
import org.elasticsearch.indices.recovery.RecoverySettings;
3840
import org.elasticsearch.rest.RestStatus;
3941

@@ -174,6 +176,8 @@ public void testClusterHealthYellowClusterLevel() throws IOException {
174176
request.timeout("5s");
175177
ClusterHealthResponse response = execute(request, highLevelClient().cluster()::health, highLevelClient().cluster()::healthAsync);
176178

179+
logger.info("Shard stats\n{}", EntityUtils.toString(
180+
client().performRequest(new Request("GET", "/_cat/shards")).getEntity()));
177181
assertYellowShards(response);
178182
assertThat(response.getIndices().size(), equalTo(0));
179183
}
@@ -186,6 +190,8 @@ public void testClusterHealthYellowIndicesLevel() throws IOException {
186190
request.level(ClusterHealthRequest.Level.INDICES);
187191
ClusterHealthResponse response = execute(request, highLevelClient().cluster()::health, highLevelClient().cluster()::healthAsync);
188192

193+
logger.info("Shard stats\n{}", EntityUtils.toString(
194+
client().performRequest(new Request("GET", "/_cat/shards")).getEntity()));
189195
assertYellowShards(response);
190196
assertThat(response.getIndices().size(), equalTo(2));
191197
for (Map.Entry<String, ClusterIndexHealth> entry : response.getIndices().entrySet()) {

client/rest-high-level/src/test/java/org/elasticsearch/client/MachineLearningIT.java

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
package org.elasticsearch.client;
2020

2121
import com.carrotsearch.randomizedtesting.generators.CodepointSetGenerator;
22+
import org.apache.lucene.util.LuceneTestCase.AwaitsFix;
2223
import org.elasticsearch.common.unit.TimeValue;
2324
import org.elasticsearch.protocol.xpack.ml.DeleteJobRequest;
2425
import org.elasticsearch.protocol.xpack.ml.DeleteJobResponse;
@@ -36,6 +37,7 @@
3637

3738
import static org.hamcrest.Matchers.is;
3839

40+
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/32993")
3941
public class MachineLearningIT extends ESRestHighLevelClientTestCase {
4042

4143
public void testPutJob() throws Exception {

0 commit comments

Comments
 (0)