Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flaky test SearchRestCancellationIT.testAutomaticCancellationMultiSearchDuringFetchPhase #7985

Merged
merged 6 commits into from
Jun 13, 2023

Conversation

stephen-crawford
Copy link
Contributor

@stephen-crawford stephen-crawford commented Jun 9, 2023

Description

This PR seeks to correct a flaky test SearchRestCancellationIT.testAutomaticCancellationMultiSearchDuringFetchPhase.
In the test, a multisearch REST request is created and then cancelled. The test sometimes fails on a runner because the latch had not been set to await for its countdown. By adding the latch.await(2, Seconds) statement the latch should force the following block

CountDownLatch latch = new CountDownLatch(1);
        AtomicReference<Exception> error = new AtomicReference<>();
        Cancellable cancellable = getRestClient().performRequestAsync(searchRequest, new ResponseListener() {
            @Override
            public void onSuccess(Response response) {
                latch.countDown();
            }

            @Override
            public void onFailure(Exception exception) {
                error.set(exception);
                latch.countDown();
            }
        });

        latch.await(2, SECONDS);

to perform the asynchronous request before continuing. This should mean that even on a faster runner, the request will have had to execute before the later assertion can be checked.

Related Issues

Resolves #7980

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff
  • Commit changes are listed out in CHANGELOG.md file (See: Changelog)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Stephen Crawford <[email protected]>
Signed-off-by: Stephen Crawford <[email protected]>
Signed-off-by: Stephen Crawford <[email protected]>
Signed-off-by: Stephen Crawford <[email protected]>
@github-actions
Copy link
Contributor

github-actions bot commented Jun 9, 2023

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

github-actions bot commented Jun 9, 2023

Gradle Check (Jenkins) Run Completed with:

  • RESULT: UNSTABLE ❕
  • TEST FAILURES:
      1 org.opensearch.remotestore.SegmentReplicationUsingRemoteStoreIT.testDropPrimaryDuringReplication

@codecov
Copy link

codecov bot commented Jun 9, 2023

Codecov Report

Merging #7985 (50cf7bc) into main (812b3e3) will increase coverage by 0.15%.
The diff coverage is n/a.

@@             Coverage Diff              @@
##               main    #7985      +/-   ##
============================================
+ Coverage     70.84%   70.99%   +0.15%     
- Complexity    56452    56551      +99     
============================================
  Files          4714     4714              
  Lines        267213   267213              
  Branches      39182    39182              
============================================
+ Hits         189294   189709     +415     
+ Misses        61918    61438     -480     
- Partials      16001    16066      +65     

see 448 files with indirect coverage changes

@github-actions
Copy link
Contributor

github-actions bot commented Jun 9, 2023

Gradle Check (Jenkins) Run Completed with:

  • RESULT: UNSTABLE ❕
  • TEST FAILURES:
      2 org.opensearch.indices.replication.RemoteStoreReplicationSourceTests.classMethod
      1 org.opensearch.search.backpressure.SearchBackpressureIT.testSearchTaskCancellationWithHighCpu
      1 org.opensearch.indices.replication.RemoteStoreReplicationSourceTests.testGetCheckpointMetadata

@github-actions
Copy link
Contributor

github-actions bot commented Jun 9, 2023

Gradle Check (Jenkins) Run Completed with:

  • RESULT: UNSTABLE ❕
  • TEST FAILURES:
      1 org.opensearch.remotestore.SegmentReplicationUsingRemoteStoreIT.testDropPrimaryDuringReplication
      1 org.opensearch.remotestore.RemoteStoreRefreshListenerIT.testRemoteRefreshRetryOnFailure

@github-actions
Copy link
Contributor

github-actions bot commented Jun 9, 2023

Gradle Check (Jenkins) Run Completed with:

  • RESULT: UNSTABLE ❕
  • TEST FAILURES:
      1 org.opensearch.search.backpressure.SearchBackpressureIT.testSearchShardTaskCancellationWithHighCpu

@stephen-crawford stephen-crawford marked this pull request as ready for review June 9, 2023 16:34
@stephen-crawford
Copy link
Contributor Author

Gradle Check (Jenkins) Run Completed with:

* **RESULT:** UNSTABLE ❕

* **TEST FAILURES:**
      1 org.opensearch.search.backpressure.SearchBackpressureIT.testSearchShardTaskCancellationWithHighCpu
* **URL:** https://build.ci.opensearch.org/job/gradle-check/17227/

* **CommitID:** [50cf7bc](https://github.com/opensearch-project/OpenSearch/commit/50cf7bcf97ae40f7839d9cfec25d4daa1dd8434f)
  Please review all [flaky tests](https://github.com/opensearch-project/OpenSearch/blob/main/DEVELOPER_GUIDE.md#flaky-tests) that succeeded after retry and create an issue if one does not already exist to track the flaky failure.

Looks like the previous change to correct this test did not work...

@dblock dblock merged commit df517a6 into opensearch-project:main Jun 13, 2023
@dblock dblock added the backport 2.x Backport to 2.x branch label Jun 13, 2023
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jun 13, 2023
…tiSearchDuringFetchPhase` (#7985)

* add latch.await

Signed-off-by: Stephen Crawford <[email protected]>

* remove space

Signed-off-by: Stephen Crawford <[email protected]>

* Fix await timing

Signed-off-by: Stephen Crawford <[email protected]>

* fix line

Signed-off-by: Stephen Crawford <[email protected]>

* shorten await

Signed-off-by: Stephen Crawford <[email protected]>

---------

Signed-off-by: Stephen Crawford <[email protected]>
(cherry picked from commit df517a6)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@stephen-crawford stephen-crawford deleted the restCancellation branch June 13, 2023 15:48
kotwanikunal pushed a commit that referenced this pull request Jun 13, 2023
…tiSearchDuringFetchPhase` (#7985) (#8042)

* add latch.await



* remove space



* Fix await timing



* fix line



* shorten await



---------


(cherry picked from commit df517a6)

Signed-off-by: Stephen Crawford <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
gaiksaya pushed a commit to gaiksaya/OpenSearch that referenced this pull request Jun 15, 2023
…tiSearchDuringFetchPhase` (opensearch-project#7985)

* add latch.await

Signed-off-by: Stephen Crawford <[email protected]>

* remove space

Signed-off-by: Stephen Crawford <[email protected]>

* Fix await timing

Signed-off-by: Stephen Crawford <[email protected]>

* fix line

Signed-off-by: Stephen Crawford <[email protected]>

* shorten await

Signed-off-by: Stephen Crawford <[email protected]>

---------

Signed-off-by: Stephen Crawford <[email protected]>
gaiksaya pushed a commit to gaiksaya/OpenSearch that referenced this pull request Jun 26, 2023
…tiSearchDuringFetchPhase` (opensearch-project#7985) (opensearch-project#8042)

* add latch.await



* remove space



* Fix await timing



* fix line



* shorten await



---------


(cherry picked from commit df517a6)

Signed-off-by: Stephen Crawford <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
imRishN pushed a commit to imRishN/OpenSearch that referenced this pull request Jun 27, 2023
…tiSearchDuringFetchPhase` (opensearch-project#7985)

* add latch.await

Signed-off-by: Stephen Crawford <[email protected]>

* remove space

Signed-off-by: Stephen Crawford <[email protected]>

* Fix await timing

Signed-off-by: Stephen Crawford <[email protected]>

* fix line

Signed-off-by: Stephen Crawford <[email protected]>

* shorten await

Signed-off-by: Stephen Crawford <[email protected]>

---------

Signed-off-by: Stephen Crawford <[email protected]>
Signed-off-by: Rishab Nahata <[email protected]>
shiv0408 pushed a commit to Gaurav614/OpenSearch that referenced this pull request Apr 25, 2024
…tiSearchDuringFetchPhase` (opensearch-project#7985)

* add latch.await

Signed-off-by: Stephen Crawford <[email protected]>

* remove space

Signed-off-by: Stephen Crawford <[email protected]>

* Fix await timing

Signed-off-by: Stephen Crawford <[email protected]>

* fix line

Signed-off-by: Stephen Crawford <[email protected]>

* shorten await

Signed-off-by: Stephen Crawford <[email protected]>

---------

Signed-off-by: Stephen Crawford <[email protected]>
Signed-off-by: Shivansh Arora <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Backport to 2.x branch skip-changelog
Projects
None yet
4 participants