Skip to content

Conversation

brfrn169
Copy link
Collaborator

@brfrn169 brfrn169 commented Jun 2, 2025

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-abstraction feature branch.

Related issues and/or PRs

Changes made

  • Added more integration tests for the Scanner API.

Checklist

The following is a best-effort checklist. If any items in this checklist are not applicable to this PR or are dependent on other, unmerged PRs, please still mark the checkboxes after you have read and understood each item.

  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation to reflect the changes.
  • I have considered whether similar issues could occur in other products, components, or modules if this PR is for bug fixes.
  • Any remaining open issues linked to this PR are documented and up-to-date (Jira, GitHub, etc.).
  • Tests (unit, integration, etc.) have been added for the changes.
  • My changes generate no new warnings.
  • Any dependent changes in other PRs have been merged and published.

Additional notes (optional)

N/A

Release notes

N/A

@brfrn169 brfrn169 self-assigned this Jun 2, 2025
Copy link
Collaborator Author

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.

@brfrn169 brfrn169 requested a review from Copilot June 2, 2025 10:45
Copy link
Contributor

@Copilot Copilot AI left a 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 {

Copy link
Contributor

@Copilot Copilot AI left a 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 @Test methods into @ParameterizedTest with @EnumSource(ScanType.class)
  • Added scanOrGetScanner(...) utility methods and ScanType enums in test bases
  • Updated package for ConsensusCommitTestUtils and 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 scanOrGetScanner declares throws CrudException, but many of the test methods that call it only declare throws TransactionException, leading to an unhandled checked exception. Consider changing the helper to throw TransactionException or updating the test signatures to include CrudException.
protected List<Result> scanOrGetScanner(

integration-test/src/main/java/com/scalar/db/transaction/singlecrudoperation/SingleCrudOperationTransactionIntegrationTestBase.java:269

  • The @Override annotation on these newly parameterized methods no longer matches any superclass signature. Please remove @Override or restore the original method signature to avoid compilation errors.
@Override

}
}

public enum ScanType {
Copy link
Preview

Copilot AI Jun 2, 2025

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.

Copilot uses AI. Check for mistakes.

Copy link
Contributor

@komamitsu komamitsu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 👍

Copy link
Contributor

@Torch3333 Torch3333 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

Copy link
Contributor

@feeblefakie feeblefakie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you!

@feeblefakie feeblefakie merged commit 9ad1219 into add-scanner-api-to-transaction-abstraction Jun 3, 2025
56 checks passed
@feeblefakie feeblefakie deleted the add-more-integration-tests-for-scanner-api branch June 3, 2025 08:15
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.

4 participants