Skip to content

Conversation

@KodaiD
Copy link
Contributor

@KodaiD KodaiD commented Jul 22, 2025

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

  • Added a new integration test for the implementations of DistributedStorage in JDBC adapter with MySQL, PostgreSQL, Oracle, and SQL Server engines.
  • Added a new integration test for the implementations of DistributedStorageAdmin in JDBC adapter with MySQL, PostgreSQL, Oracle, and SQL Server engines.
  • Updated a GitHub Action workflow to run the JDBC database permission tests.

Checklist

  • 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

@KodaiD KodaiD self-assigned this Jul 22, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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 DistributedStorage operations 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 DistributedStorageAdmin operations 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 new sourceSet and 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.java file 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

  1. 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.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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.

@KodaiD KodaiD requested a review from Copilot July 22, 2025 02:34
Copy link
Contributor

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 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

@KodaiD KodaiD force-pushed the jdbc-permission-test branch from 3ff259e to 17eaaca Compare July 23, 2025 00:47
@KodaiD KodaiD marked this pull request as ready for review July 23, 2025 00:58
@KodaiD KodaiD requested review from a team, Torch3333, brfrn169, feeblefakie and komamitsu and removed request for a team July 23, 2025 00:59
@KodaiD
Copy link
Contributor Author

KodaiD commented Jul 23, 2025

I've confirmed that the permission tests added woks as expected in:
https://github.com/scalar-labs/scalardb/actions/runs/16458783847

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, thank you!

Copy link
Collaborator

@brfrn169 brfrn169 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

@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!

@brfrn169
Copy link
Collaborator

@KodaiD Could you please resolve the conflicts?

@KodaiD KodaiD merged commit d1fc213 into master Jul 28, 2025
56 checks passed
@KodaiD KodaiD deleted the jdbc-permission-test branch July 28, 2025 05:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants