-
Notifications
You must be signed in to change notification settings - Fork 40
Add permission list management #2819
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
Closed
Closed
Changes from 8 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
60b00ac
Add integration test for permission list
KodaiD 88235e0
Merge branch 'master' into permission-list
KodaiD 22842fa
Add test config
KodaiD 45385d6
Add close() to scan call
KodaiD 61dd00f
Fix DynamoEnv to provide a single getProperties method
KodaiD b89e66a
Create user and grant permissions in tests
KodaiD c4b7ff4
Divide the integration test into parts per storage
KodaiD f49de8f
Add GitHub Actions workflow
KodaiD 52db096
Update grant method in Dynamo
KodaiD 2d7cad5
Reformat
KodaiD 3daa2b6
Merge branch 'master' into permission-list
KodaiD 4b8afae
Exclude permission test files from the existing test settings
KodaiD 12f6928
Update tests
KodaiD f42a6fe
Remove the unnecessary dependency
KodaiD 2cf06d5
Remove the unnecessary synchronization method
KodaiD 401730b
Add pull_request trigger to test workflow
KodaiD fe9d220
Fix to use conditional usrer-related queries
KodaiD 7b4961b
Fix to use custom yaml file for Cassandra to enable auth
KodaiD 1922d9c
Fix to sleep fixed time
KodaiD 0688b38
Fix to use bitnami/cassandra image
KodaiD File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,199 @@ | ||
| name: Test Permissions | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
|
Comment on lines
+3
to
+4
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently, the job is assumed to be run manually, for example, when a new release is made. |
||
|
|
||
| env: | ||
| TERM: dumb | ||
| JAVA_VERSION: '8' | ||
| JAVA_VENDOR: 'temurin' | ||
|
|
||
| jobs: | ||
| integration-test-permission-cassandra-3-0: | ||
| name: Cassandra 3.0 Permission Integration Test | ||
| runs-on: ubuntu-latest | ||
|
|
||
| services: | ||
| cassandra: | ||
| image: cassandra:3.0 | ||
| env: | ||
| MAX_HEAP_SIZE: 2048m | ||
| HEAP_NEWSIZE: 512m | ||
| ports: | ||
| - 9042:9042 | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up JDK ${{ env.JAVA_VERSION }} (${{ env.JAVA_VENDOR }}) | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: ${{ env.JAVA_VERSION }} | ||
| distribution: ${{ env.JAVA_VENDOR }} | ||
|
|
||
| - name: Setup Gradle | ||
| uses: gradle/actions/setup-gradle@v4 | ||
|
|
||
| - name: Execute Gradle 'integrationTestCassandraPermission' task | ||
| run: ./gradlew integrationTestCassandraPermission | ||
|
|
||
| - name: Upload Gradle test reports | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: cassandra_3.0_permission_integration_test_reports | ||
| path: core/build/reports/tests/integrationTestCassandraPermission | ||
|
|
||
| integration-test-permission-cassandra-3-11: | ||
| name: Cassandra 3.11 Permission Integration Test | ||
| runs-on: ubuntu-latest | ||
|
|
||
| services: | ||
| cassandra: | ||
| image: cassandra:3.11 | ||
| env: | ||
| MAX_HEAP_SIZE: 2048m | ||
| HEAP_NEWSIZE: 512m | ||
| ports: | ||
| - 9042:9042 | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up JDK ${{ env.JAVA_VERSION }} (${{ env.JAVA_VENDOR }}) | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: ${{ env.JAVA_VERSION }} | ||
| distribution: ${{ env.JAVA_VENDOR }} | ||
|
|
||
| - name: Setup Gradle | ||
| uses: gradle/actions/setup-gradle@v4 | ||
|
|
||
| - name: Execute Gradle 'integrationTestCassandraPermission' task | ||
| run: ./gradlew integrationTestCassandraPermission | ||
|
|
||
| - name: Upload Gradle test reports | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: cassandra_3.11_permission_integration_test_reports | ||
| path: core/build/reports/tests/integrationTestCassandraPermission | ||
|
|
||
| integration-test-permission-dynamo: | ||
| name: DynamoDB Permission Integration Test | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up JDK ${{ env.JAVA_VERSION }} (${{ env.JAVA_VENDOR }}) | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: ${{ env.JAVA_VERSION }} | ||
| distribution: ${{ env.JAVA_VENDOR }} | ||
|
|
||
| - name: Setup Gradle | ||
| uses: gradle/actions/setup-gradle@v4 | ||
|
|
||
| - name: Execute Gradle 'integrationTestDynamoPermission' task | ||
| run: ./gradlew integrationTestDynamoPermission | ||
| env: | ||
| DYNAMO_ACCESS_KEY_ID: ${{ secrets.DYNAMO_ACCESS_KEY }} | ||
| DYNAMO_SECRET_ACCESS_KEY: ${{ secrets.DYNAMO_SECRET_ACCESS_KEY }} | ||
|
|
||
| - name: Upload Gradle test reports | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: dynamo_permission_integration_test_reports | ||
| path: core/build/reports/tests/integrationTestDynamoPermission | ||
|
|
||
| integration-test-permission-jdbc-mysql-5-7: | ||
| name: MySQL 5.7 Permission Integration Test | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Run MySQL 5.7 | ||
| run: | | ||
| docker run -e MYSQL_ROOT_PASSWORD=mysql -p 3306:3306 -d mysql:5.7 --character-set-server=utf8mb4 --collation-server=utf8mb4_bin | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up JDK ${{ env.JAVA_VERSION }} (${{ env.JAVA_VENDOR }}) | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: ${{ env.JAVA_VERSION }} | ||
| distribution: ${{ env.JAVA_VENDOR }} | ||
|
|
||
| - name: Setup Gradle | ||
| uses: gradle/actions/setup-gradle@v4 | ||
|
|
||
| - name: Execute Gradle 'integrationTestJdbcPermission' task | ||
| run: ./gradlew integrationTestJdbcPermission | ||
|
|
||
| - name: Upload Gradle test reports | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: mysql_5.7_permission_integration_test_reports | ||
| path: core/build/reports/tests/integrationTestJdbcPermission | ||
|
|
||
| integration-test-permission-jdbc-mysql-8-0: | ||
| name: MySQL 8.0 Permission Integration Test | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Run MySQL 8.0 | ||
| run: | | ||
| docker run -e MYSQL_ROOT_PASSWORD=mysql -p 3306:3306 -d mysql:8.0 --character-set-server=utf8mb4 --collation-server=utf8mb4_bin | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up JDK ${{ env.JAVA_VERSION }} (${{ env.JAVA_VENDOR }}) | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: ${{ env.JAVA_VERSION }} | ||
| distribution: ${{ env.JAVA_VENDOR }} | ||
|
|
||
| - name: Setup Gradle | ||
| uses: gradle/actions/setup-gradle@v4 | ||
|
|
||
| - name: Execute Gradle 'integrationTestJdbcPermission' task | ||
| run: ./gradlew integrationTestJdbcPermission | ||
|
|
||
| - name: Upload Gradle test reports | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: mysql_8.0_permission_integration_test_reports | ||
| path: core/build/reports/tests/integrationTestJdbcPermission | ||
|
|
||
| integration-test-permission-jdbc-mysql-8-4: | ||
| name: MySQL 8.4 Permission Integration Test | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Run MySQL 8.4 | ||
| run: | | ||
| docker run -e MYSQL_ROOT_PASSWORD=mysql -p 3306:3306 -d mysql:8.4 --character-set-server=utf8mb4 --collation-server=utf8mb4_bin | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up JDK ${{ env.JAVA_VERSION }} (${{ env.JAVA_VENDOR }}) | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: ${{ env.JAVA_VERSION }} | ||
| distribution: ${{ env.JAVA_VENDOR }} | ||
|
|
||
| - name: Setup Gradle | ||
| uses: gradle/actions/setup-gradle@v4 | ||
|
|
||
| - name: Execute Gradle 'integrationTestJdbcPermission' task | ||
| run: ./gradlew integrationTestJdbcPermission | ||
|
|
||
| - name: Upload Gradle test reports | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: mysql_8.4_permission_integration_test_reports | ||
| path: core/build/reports/tests/integrationTestJdbcPermission | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
...on-test/java/com/scalar/db/storage/cassandra/CassandraAdminPermissionIntegrationTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| package com.scalar.db.storage.cassandra; | ||
|
|
||
| import com.scalar.db.api.DistributedStorageAdminPermissionIntegrationTestBase; | ||
| import com.scalar.db.util.AdminTestUtils; | ||
| import com.scalar.db.util.PermissionTestUtils; | ||
| import java.util.Collections; | ||
| import java.util.Map; | ||
| import java.util.Properties; | ||
| import org.junit.jupiter.api.Disabled; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| public class CassandraAdminPermissionIntegrationTest | ||
| extends DistributedStorageAdminPermissionIntegrationTestBase { | ||
| @Override | ||
| protected Properties getProperties(String testName) { | ||
| return CassandraEnv.getProperties(testName); | ||
| } | ||
|
|
||
| @Override | ||
| protected Properties getPropertiesForNormalUser(String testName) { | ||
| return CassandraEnv.getPropertiesForNormalUser(testName); | ||
| } | ||
|
|
||
| @Override | ||
| protected Map<String, String> getCreationOptions() { | ||
| return Collections.singletonMap(CassandraAdmin.REPLICATION_FACTOR, "1"); | ||
| } | ||
|
|
||
| @Override | ||
| protected AdminTestUtils getAdminTestUtils(String testName) { | ||
| return new CassandraAdminTestUtils(getProperties(testName)); | ||
| } | ||
|
|
||
| @Override | ||
| protected PermissionTestUtils getPermissionTestUtils(String testName) { | ||
| return new CassandraPermissionTestUtils(getProperties(testName)); | ||
| } | ||
|
|
||
| @Test | ||
| @Override | ||
| @Disabled("Import-related functionality is not supported in Cassandra") | ||
| public void getImportTableMetadata_WithSufficientPermission_ShouldSucceed() {} | ||
|
|
||
| @Test | ||
| @Override | ||
| @Disabled("Import-related functionality is not supported in Cassandra") | ||
| public void addRawColumnToTable_WithSufficientPermission_ShouldSucceed() {} | ||
|
|
||
| @Test | ||
| @Override | ||
| @Disabled("Import-related functionality is not supported in Cassandra") | ||
| public void importTable_WithSufficientPermission_ShouldSucceed() {} | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
For JDBC databases, only MySQL is tested for now.