-
Couldn't load subscription status.
- Fork 40
Add more integration tests for scanner API #2724
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
Add more integration tests for scanner API #2724
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved ConsensusCommitTestUtils to the integration-test module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds integration tests for the Scanner API across multiple transaction types and updates some consensus commit imports to use the new package paths. Key changes include converting many individual tests to parameterized tests for scanner operations, switching from DistributedTransactionManager to TwoPhaseCommitTransactionManager where applicable, and updating consensus commit utility imports in core integration tests.
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| integration-test/src/main/java/com/scalar/db/transaction/singlecrudoperation/SingleCrudOperationTransactionIntegrationTestBase.java | Converted several scan tests to parameterized tests using EnumSource and updated method names. |
| integration-test/src/main/java/com/scalar/db/transaction/consensuscommit/ConsensusCommitTestUtils.java | Updated import to use the new transaction.consensuscommit package. |
| integration-test/src/main/java/com/scalar/db/api/TwoPhaseCommitTransactionIntegrationTestBase.java | Updated scanner-related tests to use a new helper method for both scan and getScanner operations. |
| integration-test/src/main/java/com/scalar/db/api/DistributedTransactionIntegrationTestBase.java | Converted scan tests to parameterized tests and added a helper method for scanner operations. |
| core/* | Updated consensus commit-related imports across multiple storage integration test files. |
Comments suppressed due to low confidence (2)
integration-test/src/main/java/com/scalar/db/transaction/singlecrudoperation/SingleCrudOperationTransactionIntegrationTestBase.java:75
- [nitpick] The new test method name 'scanOrGetScanner_ScanGivenForCommittedRecord_ShouldReturnRecords' is quite lengthy; consider shortening or clarifying it to improve readability while still conveying its purpose.
@ParameterizedTest
integration-test/src/main/java/com/scalar/db/api/DistributedTransactionIntegrationTestBase.java:2801
- [nitpick] Consider adding JavaDoc or inline comments for the 'scanOrGetScanner' method to clearly explain how each ScanType (SCAN, SCANNER_ONE, SCANNER_ALL) affects the method behavior.
protected List<Result> scanOrGetScanner(DistributedTransaction transaction, Scan scan, ScanType scanType) throws CrudException {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR parameterizes existing scan tests to run against both the traditional scan API and the new getScanner variants, introduces a ScanType enum and a scanOrGetScanner helper, and fixes imports for the relocated ConsensusCommitTestUtils.
- Converted dozens of single-case
@Testmethods into@ParameterizedTestwith@EnumSource(ScanType.class) - Added
scanOrGetScanner(...)utility methods andScanTypeenums in test bases - Updated package for
ConsensusCommitTestUtilsand fixed imports in multiple integration-test environments
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| integration-test/.../singlecrudoperation/SingleCrudOperationTransactionIntegrationTestBase.java | Replaced empty @Test stubs with parameterized variants |
| integration-test/.../consensuscommit/ConsensusCommitTestUtils.java | Moved package, appended scanOrGetScanner and ScanType |
| integration-test/.../TwoPhaseCommitTransactionIntegrationTestBase.java | Parameterized scan tests and added helper/enum |
| integration-test/.../DistributedTransactionIntegrationTestBase.java | Parameterized scan tests and added helper/enum |
| core/.../ConsensusCommit*Env.java (several) | Updated imports to new ConsensusCommitTestUtils package |
Comments suppressed due to low confidence (2)
integration-test/src/main/java/com/scalar/db/transaction/consensuscommit/ConsensusCommitTestUtils.java:3121
- The helper method
scanOrGetScannerdeclaresthrows CrudException, but many of the test methods that call it only declarethrows TransactionException, leading to an unhandled checked exception. Consider changing the helper to throwTransactionExceptionor updating the test signatures to includeCrudException.
protected List<Result> scanOrGetScanner(
integration-test/src/main/java/com/scalar/db/transaction/singlecrudoperation/SingleCrudOperationTransactionIntegrationTestBase.java:269
- The
@Overrideannotation on these newly parameterized methods no longer matches any superclass signature. Please remove@Overrideor restore the original method signature to avoid compilation errors.
@Override
| } | ||
| } | ||
|
|
||
| public enum ScanType { |
Copilot
AI
Jun 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The ScanType enum is duplicated across multiple test classes including here and in ConsensusCommitTestUtils. Consider extracting it into a shared utility to reduce duplication and ensure consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you!
9ad1219
into
add-scanner-api-to-transaction-abstraction
Description
This PR adds more integration tests for the Scanner API.
Note that we are working on this feature in the
add-scanner-api-to-transaction-abstractionfeature branch.Related issues and/or PRs
Changes made
Checklist
Additional notes (optional)
N/A
Release notes
N/A