-
Notifications
You must be signed in to change notification settings - Fork 40
Backport to branch(3.15) : Add JDBC database permission test (Part 2) #2941
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,23 @@ | ||
| package com.scalar.db.storage.jdbc; | ||
|
|
||
| import static com.scalar.db.storage.jdbc.JdbcPermissionTestUtils.DDL_WAIT_SECONDS; | ||
|
|
||
| import com.google.common.util.concurrent.Uninterruptibles; | ||
| import com.scalar.db.api.DistributedStoragePermissionIntegrationTestBase; | ||
| import com.scalar.db.config.DatabaseConfig; | ||
| import com.scalar.db.util.AdminTestUtils; | ||
| import com.scalar.db.util.PermissionTestUtils; | ||
| import java.util.Properties; | ||
| import java.util.concurrent.TimeUnit; | ||
|
|
||
| public class JdbcPermissionIntegrationTest extends DistributedStoragePermissionIntegrationTestBase { | ||
| private RdbEngineStrategy rdbEngine; | ||
|
|
||
| @Override | ||
| protected Properties getProperties(String testName) { | ||
| return JdbcEnv.getProperties(testName); | ||
| Properties properties = JdbcEnv.getProperties(testName); | ||
| rdbEngine = RdbEngineFactory.create(new JdbcConfig(new DatabaseConfig(properties))); | ||
| return properties; | ||
|
Comment on lines
17
to
+20
Contributor
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. The Properties properties = JdbcEnv.getProperties(testName);
if (rdbEngine == null) {
rdbEngine = RdbEngineFactory.create(new JdbcConfig(new DatabaseConfig(properties)));
}
return properties; |
||
| } | ||
|
|
||
| @Override | ||
|
|
@@ -25,4 +34,12 @@ protected PermissionTestUtils getPermissionTestUtils(String testName) { | |
| protected AdminTestUtils getAdminTestUtils(String testName) { | ||
| return new JdbcAdminTestUtils(getProperties(testName)); | ||
| } | ||
|
|
||
| @Override | ||
| protected void waitForDdlCompletion() { | ||
| if (JdbcTestUtils.isYugabyte(rdbEngine)) { | ||
| // This is needed to avoid schema or catalog version mismatch database errors. | ||
| Uninterruptibles.sleepUninterruptibly(DDL_WAIT_SECONDS, TimeUnit.SECONDS); | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,7 +38,7 @@ public abstract class DistributedStorageAdminPermissionIntegrationTestBase { | |
| TableMetadata.newBuilder() | ||
| .addColumn(COL_NAME1, DataType.INT) | ||
| .addColumn(COL_NAME2, DataType.TEXT) | ||
| .addColumn(COL_NAME3, DataType.TEXT) | ||
| .addColumn(COL_NAME3, DataType.INT) | ||
|
Contributor
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. |
||
| .addColumn(COL_NAME4, DataType.INT) | ||
| .addPartitionKey(COL_NAME1) | ||
| .addClusteringKey(COL_NAME2, Scan.Ordering.Order.ASC) | ||
|
|
||
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.
The
rdbEnginefield is re-initialized every timegetProperties()is called. This method can be invoked multiple times during the test setup, leading to unnecessary object creation. Consider initializingrdbEngineonly once using a null check.