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

Fixed non-idempotent unit tests in AsyncHBaseTest and HBaseClient1Test #1705

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

Conversation

kaiyaok2
Copy link

@kaiyaok2 kaiyaok2 commented Apr 26, 2024

Motivation:

Tests in the AsyncHBaseTest and HBaseClient1Test are not idempotent and fail in repeated runs, because they pollute a state reused by themselves. Take AsyncHBaseTest as an example - the tests used the shared AsyncHBaseClient instance client to perform operations including read() and insert(). However, client is not cleaned up after the tests, so the repeated runs fail. Fixing non-idempotent tests can help proactively avoid state pollution that results in test order dependency (which could then hurt regression testing under test selection / prioritization / parallelization).

The list of non-idempotent tests are:

  • AsyncHBaseTest#testScan
  • AsyncHBaseTest#testRead
  • AsyncHBaseTest#testReadMissingRow
  • AsyncHBaseTest#testUpdate
  • HBaseClient1Test#testScan
  • HBaseClient1Test#testRead
  • HBaseClient1Test#testReadMissingRow
  • HBaseClient1Test#testUpdate
  • HBaseClient2Test#testScan
  • HBaseClient2Test#testRead
  • HBaseClient2Test#testReadMissingRow
  • HBaseClient2Test#testUpdate

Reproduce

Reproduce:

Using the NIOInspector plugin that supports rerunning JUnit tests in the same environment. Use HBaseClient1Test as an example:

cd hbase1
mvn edu.illinois:NIOInspector:rerun -Dtest=site.ycsb.db.hbase1.HBaseClient1Test

Error messages for the failed tests in the second run:

  • testScan():
java.lang.AssertionError: expected:<5> but was:<0>
  • testReadMissingRow():
java.lang.AssertionError: expected:<Status [name=NOT_FOUND, description=The requested record was not found.]> but was:<Status [name=ERROR, description=The operation failed.]>
  • testRead():
java.lang.AssertionError: expected:<Status [name=OK, description=The operation completed successfully.]> but was:<Status [name=ERROR, description=The operation failed.]>
  • testUpdate():
java.lang.AssertionError: expected:<Status [name=OK, description=The operation completed successfully.]> but was:<Status [name=ERROR, description=The operation failed.]>

Proposed Fix

Clean up client in the tear down function.

@kaiyaok2 kaiyaok2 changed the title Fixed non-idempotent unit tests Fixed non-idempotent unit tests in AsyncHBaseTest Apr 26, 2024
@kaiyaok2 kaiyaok2 changed the title Fixed non-idempotent unit tests in AsyncHBaseTest Fixed non-idempotent unit tests in AsyncHBaseTest and HBaseClient1Test May 26, 2024
@kaiyaok2
Copy link
Author

@busbey @joshelser Please review

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