Skip to content

Commit

Permalink
fix failed cat segments tests
Browse files Browse the repository at this point in the history
Signed-off-by: MarinaRazumovsky <rzm.mrn@gmail.com>
  • Loading branch information
MarinaRazumovsky committed Mar 19, 2023
1 parent 2145216 commit 3ab7d61
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit 3ab7d61

Please sign in to comment.