Skip to content

Commit d176823

Browse files
authored
Fix testCancelViaExpirationOnRemoteResultsWithMinimizeRoundtrips test (#145130) (#145196)
(cherry picked from commit 6043968) # Conflicts: # muted-tests.yml
1 parent 8f5a686 commit d176823

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

x-pack/plugin/async-search/src/internalClusterTest/java/org/elasticsearch/xpack/search/CrossClusterAsyncSearchIT.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1432,6 +1432,7 @@ public void testCancelViaExpirationOnRemoteResultsWithMinimizeRoundtrips() throw
14321432
request.setKeepOnCompletion(true);
14331433

14341434
final AsyncSearchResponse response = submitAsyncSearch(request);
1435+
final long asyncSearchExpirationTimeMillis = response.getExpirationTime();
14351436
try {
14361437
assertNotNull(response.getSearchResponse());
14371438
} finally {
@@ -1468,13 +1469,10 @@ public void testCancelViaExpirationOnRemoteResultsWithMinimizeRoundtrips() throw
14681469
remoteClusterSearchTask.get().cancelled()
14691470
);
14701471

1471-
AsyncSearchResponse asyncSearchResponse = getAsyncSearch(response.getId());
1472-
asyncSearchResponse.decRef();
1473-
14741472
// wait until the async search has expired (takes one second - keep alive can't be set lower than 1s)
14751473
// don't call get async search as that triggers cancellation of the task - we want to verify that we can cancel it
14761474
// as we get results from a remote cluster
1477-
assertBusy(() -> assertThat(System.currentTimeMillis(), greaterThanOrEqualTo(asyncSearchResponse.getExpirationTime())));
1475+
assertBusy(() -> assertThat(System.currentTimeMillis(), greaterThanOrEqualTo(asyncSearchExpirationTimeMillis)));
14781476

14791477
{
14801478
// check that the tasks are cancelled

0 commit comments

Comments
 (0)