orpiske commented on code in PR #11055: URL: https://github.com/apache/camel/pull/11055#discussion_r1288118975
########## components/camel-opensearch/src/test/java/org/apache/camel/component/opensearch/integration/OpensearchGetSearchDeleteExistsUpdateIT.java: ########## @@ -289,13 +291,12 @@ void testSearchWithMapQuery() throws Exception { HitsMetadata<?> response = template().requestBody("direct:search", query, HitsMetadata.class); assertNotNull(response, "response should not be null"); assertNotNull(response.total()); - assertEquals(0, response.total().value(), "response hits should be == 0"); // Match actualQuery.put("doc.testSearchWithMapQuery1", "foo"); // Delay the execution, because the search is getting stale results - Thread.sleep(2000); + Awaitility.await().pollDelay(2, TimeUnit.SECONDS).untilAsserted(() -> assertEquals(0, response.total().value(), "response hits should be == 0")); Review Comment: I'm under the impression you have to refresh the reference to the response. As it is, I think you are just delaying the assertion of the `response.total().value()`. I believe, it would need to be similar to this: ``` assertEquals(0, response.total().value(), "response hits should be == 0")); Awaitility.await().pollDelay(2, TimeUnit.SECONDS).untilAsserted(() -> HitsMetadata<?> response = template().requestBody("direct:search", builder, HitsMetadata.class); assertNotNull(response, "response should not be null"); // ... other assertions } ``` You probably need to investigate using the same pattern for the others as well. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org