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

Create a new TaskMonitor each time to avoid flaky tests. #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

LALAYANG
Copy link
Owner

@LALAYANG LALAYANG commented Aug 19, 2021

What is the purpose of this PR

  • This PR cleans the state polluted by org.apache.hadoop.hbase.monitoring.TestTaskMonitor.testDoNotPurgeRPCTask.

  • It may be better to clean state pollutions so that some other tests won't fail in the future due to the shared state pollution.

Reproduce the test failure

  • Run the test twice in the same JVM.

Expected result:

  • The tests should run successfully when multiple tests that use this state are run in the same JVM.

Actual result:

  • We get the failure:
    [ERROR] Failures: [ERROR] testDoNotPurgeRPCTask:144 RPC Tasks have been purged! expected:<10> but was:<20>

Why the test fails

  • Each time this test runs,10 RPCtasks are created and added to the ArrayList rpcTasks, but rpcTasks is not completely purged when the test ends. So next time the test starts, the remaining RPC tasks lead to an assertion failure.

Fix

Create a new TaskMonitor each time to avoid pollution similar to the other tests (e.g., testTaskMonitorBasics, testTasksGetAbortedOnLeak) in TestTaskMonitor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant