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

[flaky tests] Fix flaky ShutdownTest::testDestructor #62

Conversation

BewareMyPower
Copy link
Contributor

Fixes #61

Motivation

testDestructor is flaky because the destructor might not be called immediately after the shared_ptr object goes out of the scope. It's similar like the flaky testReferenceCount before in apache/pulsar#17645.

Modifications

Add back WaitUtils.h, which was removed in #55, add use waitUntil to wait until the assertion.

Verifications

Run the reproduce script in #61. Even if the loop count was increased to 100, it still never failed.

Documentation

  • doc-required
    (Your PR needs to update docs and you will update later)

  • doc-not-needed
    (Please explain why)

  • doc
    (Your PR contains doc changes)

  • doc-complete
    (Docs have been already added)

Fixes apache#61

### Motivation

`testDestructor` is flaky because the destructor might not be called
immediately after the `shared_ptr` object goes out of the scope. It's
similar like the flaky `testReferenceCount` before in
apache/pulsar#17645.

### Modifications

Add back `WaitUtils.h`, which was removed in apache#55, add use `waitUntil` to
wait until the assertion.

### Verifications

Run the reproduce script in apache#61. Even if the loop count was increased to
100, it still never failed.
@merlimat merlimat merged commit 7bb6402 into apache:main Oct 21, 2022
@BewareMyPower BewareMyPower deleted the bewaremypower/fix-flaky-shutdown-destructor branch October 21, 2022 13:47
BewareMyPower added a commit that referenced this pull request Nov 1, 2022
Fixes #61

### Motivation

`testDestructor` is flaky because the destructor might not be called
immediately after the `shared_ptr` object goes out of the scope. It's
similar like the flaky `testReferenceCount` before in
apache/pulsar#17645.

### Modifications

Add back `WaitUtils.h`, which was removed in #55, add use `waitUntil` to
wait until the assertion.

### Verifications

Run the reproduce script in #61. Even if the loop count was increased to
100, it still never failed.

(cherry picked from commit 7bb6402)
@RobertIndie RobertIndie added this to the 3.1.0 milestone Nov 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flaky tests: ShutdownTest.testDestructor
3 participants