From 3ab7d61a985005dad8a621104dab30cb8721058c Mon Sep 17 00:00:00 2001 From: MarinaRazumovsky Date: Sun, 19 Mar 2023 10:54:31 +0200 Subject: [PATCH] fix failed cat segments tests Signed-off-by: MarinaRazumovsky --- .../client/opensearch/integTest/AbstractCatClientIT.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/AbstractCatClientIT.java b/java-client/src/test/java/org/opensearch/client/opensearch/integTest/AbstractCatClientIT.java index 450c91707..85d6877d7 100644 --- a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/AbstractCatClientIT.java +++ b/java-client/src/test/java/org/opensearch/client/opensearch/integTest/AbstractCatClientIT.java @@ -9,6 +9,8 @@ package org.opensearch.client.opensearch.integTest; import org.opensearch.client.opensearch._types.Bytes; +import org.opensearch.client.opensearch._types.Refresh; +import org.opensearch.client.opensearch._types.Result; import org.opensearch.client.opensearch.cat.AliasesResponse; import org.opensearch.client.opensearch.cat.AllocationResponse; import org.opensearch.client.opensearch.cat.IndicesResponse; @@ -24,9 +26,11 @@ import org.opensearch.client.opensearch.cat.recovery.RecoveryRecord; import org.opensearch.client.opensearch.cat.segments.SegmentsRecord; import org.opensearch.client.opensearch.cat.shards.ShardsRecord; +import org.opensearch.client.opensearch.core.IndexResponse; import org.opensearch.client.opensearch.indices.CreateIndexResponse; import java.util.List; +import java.util.Map; import java.util.stream.Collectors; public abstract class AbstractCatClientIT extends OpenSearchJavaClientTestCase { @@ -182,12 +186,12 @@ public void testCatPlugins() throws Exception { public void testCatSegments() throws Exception { createIndex("cat-segments-test-index"); - + final IndexResponse index = javaClient().index(b -> b .index("test-cat-segments-index") .id("id") .refresh(Refresh.True) - .document(Map.of())); + .document(Map.of("test-cat-segments-key", "test-cat-segments-value"))); assertTrue(index.result() == Result.Created); SegmentsResponse segmentsResponse = javaClient().cat().segments(r -> r.headers("index,shard,id,segment,size")); assertNotNull("segmentsResponse.valueBody() is null", segmentsResponse.valueBody());