-
Notifications
You must be signed in to change notification settings - Fork 40
Add JDBC database permission test (Part 2) #2923
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
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.
Summary of Changes
Hello @KodaiD, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request marks the completion of the permission testing project for ScalarDB's JDBC adapter. It introduces extensive integration tests to validate the required permissions for all DistributedStorage and DistributedStorageAdmin operations across MariaDB, YugabyteDB, and Db2, ensuring robust security and functionality for these database systems. The changes also include necessary adaptations and refinements to the test infrastructure to support these new tests.
Highlights
- New JDBC Permission Integration Tests: I've added comprehensive integration tests for the JDBC adapter's
DistributedStorageandDistributedStorageAdminmethods. These tests specifically target MariaDB, YugabyteDB, and Db2 to ensure all necessary permissions for ScalarDB operations are properly verified. - YugabyteDB DDL Synchronization: To address potential schema or catalog version mismatch errors in YugabyteDB during DDL operations, I've introduced explicit wait mechanisms (1-second sleeps) after DDL commands in the JDBC permission tests. This helps ensure consistency across test runs.
- Db2 Specific Adaptations: The
JdbcPermissionTestUtilsnow conditionally skips user creation and dropping for Db2, as these operations are not supported via the utility for this database. Additionally, I've added specificGRANT DBADMandGRANT DATAACCESSstatements for Db2 to ensure proper permission assignment. TheRdbEngineDb2implementation has also been updated to correctly handleCREATE INDEXandDROP INDEXSQL with schema inclusion. - Test Base Class Refinements: I've generalized the DDL waiting methods in
DistributedStoragePermissionIntegrationTestBaseandCassandraPermissionIntegrationTestfromwaitForTableCreationtowaitForDdlCompletion. This provides a more generic and applicable mechanism for waiting on DDL operations to complete across different database types.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments or fill out our survey to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
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 comprehensive JDBC database permission tests for MariaDB, YugabyteDB, and Db2 engines as the final step of the permission tests project. The tests verify that all required database permissions are properly configured for ScalarDB operations by testing all DistributedStorage and DistributedStorageAdmin methods.
Key changes include:
- Integration of permission tests for three additional JDBC database engines (MariaDB, YugabyteDB, Db2)
- Enhanced test base classes with DDL completion waiting mechanisms
- Database-specific permission handling and SQL generation improvements
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| DistributedStoragePermissionIntegrationTestBase.java | Renamed method and added DDL wait call after table truncation |
| DistributedStorageAdminPermissionIntegrationTestBase.java | Changed column data type from TEXT to INT |
| RdbEngineDb2.java | Added createIndexSql method and fixed dropIndexSql to include schema |
| JdbcPermissionTestUtils.java | Added Db2-specific permission handling and DDL wait constant |
| JdbcPermissionIntegrationTest.java | Added Yugabyte-specific DDL completion waiting |
| JdbcAdminPermissionIntegrationTest.java | Added comprehensive DDL completion waiting for all operations |
| CassandraPermissionIntegrationTest.java | Updated method name to match base class change |
| permission-check.yaml | Added CI workflows for MariaDB, YugabyteDB, and Db2 permission testing |
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.
Code Review
This pull request extends the JDBC database permission tests to include MariaDB, YugabyteDB, and Db2. The changes involve adding new integration tests, updating the test infrastructure to handle database-specific behaviors (like waits for YugabyteDB and special user management for Db2), and fixing SQL generation for Db2. The overall changes are solid, but I've identified a couple of areas with code duplication that could be refactored to improve maintainability.
...src/integration-test/java/com/scalar/db/storage/jdbc/JdbcAdminPermissionIntegrationTest.java
Outdated
Show resolved
Hide resolved
...src/integration-test/java/com/scalar/db/storage/jdbc/JdbcAdminPermissionIntegrationTest.java
Outdated
Show resolved
Hide resolved
...src/integration-test/java/com/scalar/db/storage/jdbc/JdbcAdminPermissionIntegrationTest.java
Outdated
Show resolved
Hide resolved
...src/integration-test/java/com/scalar/db/storage/jdbc/JdbcAdminPermissionIntegrationTest.java
Outdated
Show resolved
Hide resolved
...src/integration-test/java/com/scalar/db/storage/jdbc/JdbcAdminPermissionIntegrationTest.java
Show resolved
Hide resolved
core/src/integration-test/java/com/scalar/db/storage/jdbc/JdbcPermissionTestUtils.java
Show resolved
Hide resolved
core/src/integration-test/java/com/scalar/db/storage/jdbc/JdbcPermissionTestUtils.java
Show resolved
Hide resolved
af05593 to
f20f767
Compare
...src/integration-test/java/com/scalar/db/storage/jdbc/JdbcAdminPermissionIntegrationTest.java
Show resolved
Hide resolved
core/src/integration-test/java/com/scalar/db/storage/jdbc/JdbcPermissionTestUtils.java
Show resolved
Hide resolved
...st/src/main/java/com/scalar/db/api/DistributedStorageAdminPermissionIntegrationTestBase.java
Show resolved
Hide resolved
Co-authored-by: Mitsunori Komatsu <[email protected]>
brfrn169
left a comment
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!
...st/src/main/java/com/scalar/db/api/DistributedStorageAdminPermissionIntegrationTestBase.java
Show resolved
Hide resolved
komamitsu
left a comment
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!
feeblefakie
left a comment
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!
Torch3333
left a comment
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!
Co-authored-by: Mitsunori Komatsu <[email protected]> Co-authored-by: Toshihiro Suzuki <[email protected]>
Co-authored-by: Mitsunori Komatsu <[email protected]> Co-authored-by: Toshihiro Suzuki <[email protected]>
Co-authored-by: Mitsunori Komatsu <[email protected]> Co-authored-by: Toshihiro Suzuki <[email protected]>
Co-authored-by: Mitsunori Komatsu <[email protected]> Co-authored-by: Toshihiro Suzuki <[email protected]>
Co-authored-by: Mitsunori Komatsu <[email protected]> Co-authored-by: Toshihiro Suzuki <[email protected]>
Description
This PR adds a permission test for MariaDB, YugabyteDB and Db2 under ScalarDB. To check what permissions are required for all ScalarDB operations, all DistributedStorage and DistributedStorageAdmin methods are tested. This is a final step of the permission tests project.
Related issues and/or PRs
The PRs for other permission tests:
Dependent bug-fix PRs:
Changes made
Checklist
Additional notes (optional)
N/A
Release notes
N/A