-
Notifications
You must be signed in to change notification settings - Fork 40
Add JDBC database permission test #2896
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 significantly enhances the testing suite by introducing dedicated permission integration tests for ScalarDB's JDBC adapter. The primary goal is to ensure that all DistributedStorage and DistributedStorageAdmin operations function correctly with the least necessary database permissions across key JDBC databases, thereby improving the security posture and operational clarity for users.
Highlights
- New Permission Integration Tests: I've added comprehensive integration tests to verify the minimum required permissions for all
DistributedStorageoperations within the JDBC adapter. These tests cover MySQL, PostgreSQL, Oracle, and SQL Server databases. - Admin Permission Tests: New integration tests have been introduced to specifically validate the permissions needed for
DistributedStorageAdminoperations across the same set of major JDBC databases (MySQL, PostgreSQL, Oracle, SQL Server). - Build System Integration: The Gradle build file (
core/build.gradle) has been updated to include a newsourceSetand a dedicated task,integrationTestJdbcPermission, for running these new permission tests. This ensures they can be executed independently and are properly managed within the build process. - Database User Management Utilities: A new utility class,
JdbcPermissionTestUtils.java, has been added. This class provides the necessary functionality to programmatically create and drop test users, and grant specific permissions required for testing across different RDBMS (MySQL, Oracle, PostgreSQL, SQL Server, and DB2). - Enhanced Environment Configuration: The
JdbcEnv.javafile was modified to support the configuration of 'normal user' credentials. This allows the permission tests to simulate scenarios where operations are performed by users with restricted privileges, ensuring that ScalarDB functions correctly under various permission settings.
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.
Code Review
This pull request introduces permission tests for JDBC databases. The changes include new integration tests and updates to the build configuration. There's a suggestion to refactor JdbcPermissionTestUtils.java to improve code maintainability by reducing duplication using the Strategy pattern.
core/src/integration-test/java/com/scalar/db/storage/jdbc/JdbcPermissionTestUtils.java
Show resolved
Hide resolved
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 introduces comprehensive permission testing for JDBC databases within ScalarDB, specifically covering MySQL, PostgreSQL, Oracle, and SQL Server. The implementation adds integration tests to verify that all DistributedStorage and DistributedStorageAdmin operations work correctly with the minimum required database permissions.
- Adds JDBC permission test utilities and integration test classes for both DistributedStorage and DistributedStorageAdmin operations
- Enhances the JdbcEnv configuration to support normal (non-admin) user credentials
- Configures comprehensive CI/CD pipeline testing across multiple database versions and types
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
JdbcPermissionTestUtils.java |
Core utility class implementing database-specific user management and permission granting for MySQL, PostgreSQL, Oracle, and SQL Server |
JdbcPermissionIntegrationTest.java |
Integration test class extending base distributed storage permission tests |
JdbcAdminPermissionIntegrationTest.java |
Integration test class extending base distributed storage admin permission tests |
JdbcEnv.java |
Enhanced environment configuration with support for normal user credentials |
core/build.gradle |
Build configuration for new JDBC permission test source set and Gradle task |
.github/workflows/permission-check.yaml |
Extensive CI/CD workflow covering 15+ database version combinations |
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
Outdated
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
core/src/integration-test/java/com/scalar/db/storage/jdbc/JdbcPermissionTestUtils.java
Show resolved
Hide resolved
3ff259e to
17eaaca
Compare
|
I've confirmed that the permission tests added woks as expected in: |
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!
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!
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!
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!
|
@KodaiD Could you please resolve the conflicts? |
Description
This PR adds a permission test for major JDBC databases, specifically MySQL, PostgreSQL, Oracle, and SQL Server under ScalarDB. To check what permissions are required for all ScalarDB operations, all DistributedStorage and DistributedStorageAdmin methods are tested. This is a third step of the permission tests project. Permission tests for other JDBC backends will be added in the future.
Related issues and/or PRs
Changes made
Checklist
Additional notes (optional)
N/A
Release notes
N/A