From 66f9042cce1c244de2619c94565ec0732cb3b617 Mon Sep 17 00:00:00 2001 From: Marc Handalian Date: Wed, 25 Jan 2023 22:34:29 -0800 Subject: [PATCH] Fix error message to print expected and actual doc counts. Signed-off-by: Marc Handalian --- .../opensearch/indices/replication/SegmentReplicationIT.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/src/internalClusterTest/java/org/opensearch/indices/replication/SegmentReplicationIT.java b/server/src/internalClusterTest/java/org/opensearch/indices/replication/SegmentReplicationIT.java index 1dd69f696c7ed..ad66ccca5c042 100644 --- a/server/src/internalClusterTest/java/org/opensearch/indices/replication/SegmentReplicationIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/indices/replication/SegmentReplicationIT.java @@ -730,8 +730,9 @@ private void waitForSearchableDocs(long docCount, List nodes) throws Exc assertBusy(() -> { for (String node : nodes) { final SearchResponse response = client(node).prepareSearch(INDEX_NAME).setSize(0).setPreference("_only_local").get(); - if (response.getHits().getTotalHits().value < docCount) { - fail("Expected search hits on node: " + node + " to be at least " + docCount); + final long hits = response.getHits().getTotalHits().value; + if (hits < docCount) { + fail("Expected search hits on node: " + node + " to be at least " + docCount + " but was: " + hits); } } }, 1, TimeUnit.MINUTES);