-
Notifications
You must be signed in to change notification settings - Fork 40
Add Cassandra permission test #2822
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.
Pull Request Overview
This PR introduces permission tests for Cassandra under ScalarDB by adding integration tests for both DistributedStorage and DistributedStorageAdmin, as well as updating the Gradle build and GitHub Actions workflow to run these tests.
- New integration tests for permission checks on storage and admin APIs
- Implementation of Cassandra-specific PermissionTestUtils and environment configuration
- Separate Gradle source set and workflow steps for Cassandra permission tests
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| integration-test/src/main/java/com/scalar/db/util/PermissionTestUtils.java | Added interface with methods for user management and permission granting |
| integration-test/src/main/java/com/scalar/db/api/DistributedStoragePermissionIntegrationTestBase.java | Introduced tests for storage methods using granted permissions |
| integration-test/src/main/java/com/scalar/db/api/DistributedStorageAdminPermissionIntegrationTestBase.java | Added tests for admin operations with sufficient permissions |
| core/src/integration-test/java/com/scalar/db/storage/cassandra/CassandraPermissionTestUtils.java | Implemented Cassandra-specific permission management logic |
| core/src/integration-test/java/com/scalar/db/storage/cassandra/CassandraPermissionIntegrationTest.java | Extended base storage permission tests for Cassandra |
| core/src/integration-test/java/com/scalar/db/storage/cassandra/CassandraEnv.java | Updated to include normal user properties for Cassandra |
| core/src/integration-test/java/com/scalar/db/storage/cassandra/CassandraAdminPermissionIntegrationTest.java | Extended admin permission tests for Cassandra with retry waits |
| core/build.gradle | Configured new integration test source set and dependencies for Cassandra permission tests |
| .github/workflows/permission-check.yaml | Added workflow jobs to run Cassandra permission tests for different Cassandra versions |
...ation-test/java/com/scalar/db/storage/cassandra/CassandraAdminPermissionIntegrationTest.java
Outdated
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.
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 introduces a comprehensive set of permission integration tests for the Cassandra backend in ScalarDB. The primary goal is to verify that all DistributedStorage and DistributedStorageAdmin operations function correctly when executed by a user with the necessary permissions, ensuring the system's security and operational integrity. This is the initial phase of a broader project to implement permission tests across all ScalarDB backends.
Highlights
- New Permission Test Framework: I've introduced a new set of abstract base classes (
DistributedStoragePermissionIntegrationTestBaseandDistributedStorageAdminPermissionIntegrationTestBase) to standardize permission testing forDistributedStorageandDistributedStorageAdminoperations across different backends. - Cassandra-Specific Permission Tests: I've implemented concrete permission integration tests for the Cassandra adapter (
CassandraPermissionIntegrationTestandCassandraAdminPermissionIntegrationTest), covering a wide range of operations likeget,scan,put,delete,mutate, and various admin functions (create/drop namespace/table, repair, etc.). - Cassandra User Management Utilities: I've added
CassandraPermissionTestUtilsto programmatically create, drop, and grant necessary permissions to a 'normal' test user within Cassandra, facilitating isolated and realistic permission testing. - Gradle Build Configuration: I've updated the
build.gradlefile to define a new dedicated source set and Gradle task (integrationTestCassandraPermission) for these new permission tests, allowing them to be run independently from other integration tests.
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 is currently in preview and 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 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 new integration tests for Cassandra permissions, covering both DistributedStorage and DistributedStorageAdmin operations. The changes include adding new Gradle configurations and tasks to support these tests, along with new test utility classes. The overall structure of the new tests aligns with existing integration test patterns. However, there are several areas for improvement related to maintainability and correctness, such as reducing code duplication, refining exception handling to be more specific, and addressing potential security risks (even in test code) by avoiding String.format for SQL queries.
.../src/integration-test/java/com/scalar/db/storage/cassandra/CassandraPermissionTestUtils.java
Show resolved
Hide resolved
.../src/integration-test/java/com/scalar/db/storage/cassandra/CassandraPermissionTestUtils.java
Show resolved
Hide resolved
.../src/integration-test/java/com/scalar/db/storage/cassandra/CassandraPermissionTestUtils.java
Show resolved
Hide resolved
...ation-test/java/com/scalar/db/storage/cassandra/CassandraAdminPermissionIntegrationTest.java
Show resolved
Hide resolved
...ation-test/java/com/scalar/db/storage/cassandra/CassandraAdminPermissionIntegrationTest.java
Show resolved
Hide resolved
...ation-test/java/com/scalar/db/storage/cassandra/CassandraAdminPermissionIntegrationTest.java
Outdated
Show resolved
Hide resolved
...ation-test/java/com/scalar/db/storage/cassandra/CassandraAdminPermissionIntegrationTest.java
Show resolved
Hide resolved
...ation-test/java/com/scalar/db/storage/cassandra/CassandraAdminPermissionIntegrationTest.java
Show resolved
Hide resolved
...st/src/main/java/com/scalar/db/api/DistributedStorageAdminPermissionIntegrationTestBase.java
Show resolved
Hide resolved
...on-test/src/main/java/com/scalar/db/api/DistributedStoragePermissionIntegrationTestBase.java
Show resolved
Hide resolved
...ation-test/java/com/scalar/db/storage/cassandra/CassandraAdminPermissionIntegrationTest.java
Show resolved
Hide resolved
...on-test/src/main/java/com/scalar/db/api/DistributedStoragePermissionIntegrationTestBase.java
Show resolved
Hide resolved
...st/src/main/java/com/scalar/db/api/DistributedStorageAdminPermissionIntegrationTestBase.java
Show resolved
Hide resolved
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.
Overall, LGTM. Left a few comments. PTAL!
...on-test/src/main/java/com/scalar/db/api/DistributedStoragePermissionIntegrationTestBase.java
Show resolved
Hide resolved
...on-test/src/main/java/com/scalar/db/api/DistributedStoragePermissionIntegrationTestBase.java
Show resolved
Hide resolved
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!
.../src/integration-test/java/com/scalar/db/storage/cassandra/CassandraPermissionTestUtils.java
Show resolved
Hide resolved
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!
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!
Description
This PR adds a permission test for Cassandra under ScalarDB. To check what permissions are required for all ScalarDB operations, all
DistributedStorageandDistributedStorageAdminmethods are tested. This is a first step of the permission tests project. Permission tests for other backends will be added in the future.Related issues and/or PRs
N/A
Changes made
DistributedStoragein Cassandra adapter.DistributedStorageAdminin Cassandra adapter.Checklist
Additional notes (optional)
N/A
Release notes
N/A