Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -326,67 +326,80 @@ public void testCreateSchema() throws InterruptedException {
}

@Test
void testCreateTable() throws InterruptedException {
@Override
protected void testCreateTable() {
// TODO
}

@Test
void testSelectModifyTableWithMetalakeLevelRole() throws InterruptedException {
@Override
protected void testSelectModifyTableWithMetalakeLevelRole() {
// TODO
}

@Test
void testSelectModifyTableWithTableLevelRole() throws InterruptedException {
@Override
protected void testSelectModifyTableWithTableLevelRole() {
// TODO
}

@Test
void testSelectOnlyTable() throws InterruptedException {
@Override
protected void testSelectOnlyTable() {
// TODO
}

@Test
void testModifyOnlyTable() throws InterruptedException {
@Override
protected void testModifyOnlyTable() {
// TODO
}

@Test
void testCreateAllPrivilegesRole() throws InterruptedException {
@Override
protected void testCreateAllPrivilegesRole() {
// TODO
}

@Test
void testDeleteAndRecreateRole() throws InterruptedException {
@Override
protected void testDeleteAndRecreateRole() {
// TODO
}

@Test
void testDeleteAndRecreateMetadataObject() throws InterruptedException {
@Override
protected void testDeleteAndRecreateMetadataObject() {
// TODO
}

@Test
void testRenameMetadataObject() throws InterruptedException {
@Override
protected void testRenameMetadataObject() {
// TODO
}

@Test
void testRenameMetadataObjectPrivilege() throws InterruptedException {
@Override
protected void testRenameMetadataObjectPrivilege() {
// TODO
}

@Test
void testChangeOwner() throws InterruptedException {
@Override
protected void testChangeOwner() {
// TODO
}

@Test
void testDenyPrivileges() throws InterruptedException {
@Override
protected void testDenyPrivileges() {
// TODO
}

@Test
void testGrantPrivilegesForMetalake() throws InterruptedException {
@Override
protected void testGrantPrivilegesForMetalake() {
// TODO
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ void checkCreateTable() {
}

@Test
void testCreateTable() {
protected void testCreateTable() {
// Choose a catalog
reset();

Expand Down Expand Up @@ -345,7 +345,7 @@ void checkCreateTable() {
}

@Test
void testSelectModifyTableWithMetalakeLevelRole() {
protected void testSelectModifyTableWithMetalakeLevelRole() {
// Choose a catalog
reset();

Expand Down Expand Up @@ -430,7 +430,7 @@ protected abstract static class TestSelectModifyTableChecker {
}

@Test
void testSelectModifyTableWithTableLevelRole() {
protected void testSelectModifyTableWithTableLevelRole() {
// Choose a catalog
reset();

Expand Down Expand Up @@ -496,7 +496,7 @@ void testSelectModifyTableWithTableLevelRole() {
}

@Test
void testSelectOnlyTable() {
protected void testSelectOnlyTable() {
// Choose a catalog
reset();

Expand Down Expand Up @@ -603,7 +603,7 @@ protected abstract static class TestSelectOnlyTableChecker {
}

@Test
void testModifyOnlyTable() {
protected void testModifyOnlyTable() {
// Choose a catalog
reset();

Expand Down Expand Up @@ -686,7 +686,7 @@ protected abstract static class TestModifyOnlyTableChecker {
}

@Test
void testCreateAllPrivilegesRole() {
protected void testCreateAllPrivilegesRole() {
// Choose a catalog
reset();

Expand Down Expand Up @@ -735,7 +735,7 @@ void testCreateAllPrivilegesRole() {
}

@Test
void testDeleteAndRecreateRole() {
protected void testDeleteAndRecreateRole() {
// Choose a catalog
reset();

Expand Down Expand Up @@ -801,7 +801,7 @@ void checkCreateSchema() {
}

@Test
void testDeleteAndRecreateMetadataObject() {
protected void testDeleteAndRecreateMetadataObject() {
// Choose a catalog
reset();

Expand Down Expand Up @@ -872,7 +872,7 @@ void checkRecreateSchema() {
}

@Test
void testRenameMetadataObject() {
protected void testRenameMetadataObject() {
// Choose a catalog
reset();

Expand Down Expand Up @@ -910,7 +910,7 @@ void testRenameMetadataObject() {
}

@Test
void testRenameMetadataObjectPrivilege() {
protected void testRenameMetadataObjectPrivilege() {
// Choose a catalog
reset();

Expand Down Expand Up @@ -959,7 +959,7 @@ void testRenameMetadataObjectPrivilege() {
}

@Test
void testChangeOwner() {
protected void testChangeOwner() {
// Choose a catalog
reset();

Expand Down Expand Up @@ -1183,7 +1183,7 @@ void checkShowSchemasAgain() {
}
}

void testDenyPrivileges() {
protected void testDenyPrivileges() {
// Choose a catalog
reset();

Expand Down Expand Up @@ -1248,7 +1248,7 @@ void testDenyPrivileges() {

// ISSUE-5892 Fix to grant privilege for the metalake
@Test
void testGrantPrivilegesForMetalake() {
protected void testGrantPrivilegesForMetalake() {
// Choose a catalog
reset();

Expand Down
41 changes: 36 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,9 @@ fun excludePackagesForSparkConnector(project: Project) {
}

val commonsBeanutilsVersion: String = libs.versions.commons.beanutils.get()
val checkstyleVersion: String = libs.versions.checkstyle.get()
val junitBom = libs.junit.bom
val junitPlatformLauncher = libs.junit.platform.launcher

subprojects {
// Gravitino Python client project didn't need to apply the java plugin
Expand Down Expand Up @@ -613,6 +616,17 @@ subprojects {
exclude(group = "log4j", module = "log4j")
}

// Checkstyle carries only the import bans Spotless cannot express, such as JUnit 4.
apply(plugin = "checkstyle")
configure<CheckstyleExtension> {
toolVersion = checkstyleVersion
configFile = rootProject.file("config/checkstyle/checkstyle.xml")
maxWarnings = 0
}
// The import bans need no type information; an empty classpath keeps checkstyle from building
// other modules' test jars.
tasks.withType<Checkstyle>().configureEach { classpath = files() }

repositories {
mavenCentral()
mavenLocal()
Expand Down Expand Up @@ -699,13 +713,25 @@ subprojects {
options.release.set(8)
}

// Tests still need Java 17 to compile against dependencies that only publish Java 17 variants.
tasks.named<JavaCompile>("compileTestJava") {
options.release.set(17)
}
// Tests and test fixtures still need Java 17 to compile against dependencies that only
// publish Java 17 variants, such as JUnit 6.
tasks.matching { it.name in setOf("compileTestJava", "compileTestFixturesJava") }
.withType<JavaCompile>()
.configureEach {
options.release.set(17)
}

val targetJvmVersionAttribute = TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE
configurations.matching { it.name in setOf("testCompileClasspath", "testRuntimeClasspath") }
configurations.matching {
it.name in setOf(
"testCompileClasspath",
"testRuntimeClasspath",
"testFixturesCompileClasspath",
"testFixturesRuntimeClasspath",
"testFixturesApiElements",
"testFixturesRuntimeElements"
)
}
.configureEach {
attributes.attribute(targetJvmVersionAttribute, 17)
}
Expand All @@ -732,6 +758,11 @@ subprojects {
apply(plugin = "net.ltgt.errorprone")
dependencies {
errorprone("com.google.errorprone:error_prone_core:2.10.0")
// Align every JUnit artifact (including transitive ones) on one version. JUnit 6 also needs
// the matching launcher on the test runtime classpath, otherwise Gradle falls back to its
// bundled 1.x launcher, which cannot drive a 6.x engine.
testImplementation(platform(junitBom))
testRuntimeOnly(junitPlatformLauncher)
}

tasks.withType<JavaCompile>().configureEach {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Strings;
import org.apache.gravitino.Catalog;
import org.apache.gravitino.CatalogChange;
import org.apache.gravitino.NameIdentifier;
Expand Down Expand Up @@ -562,8 +563,7 @@ void testLoadExpressionIndexDoesNotFabricateColumnIndex() {
String.format("SHOW CREATE TABLE `%s`.`%s`", schemaName, sourceTableName));
String normalizedSourceCreateSql = sourceCreateSql.replace("`", "").replaceAll("\\s+", "");
Assertions.assertTrue(
StringUtils.containsIgnoreCase(
normalizedSourceCreateSql, "INDEXidx_lowerlower(name)TYPEminmax"),
Strings.CI.contains(normalizedSourceCreateSql, "INDEXidx_lowerlower(name)TYPEminmax"),
"Source table should retain its expression index: " + sourceCreateSql);

TableCatalog tableCatalog = catalog.asTableCatalog();
Expand Down Expand Up @@ -595,10 +595,10 @@ void testLoadExpressionIndexDoesNotFabricateColumnIndex() {
String normalizedRecreatedCreateSql =
recreatedCreateSql.replace("`", "").replaceAll("\\s+", "");
Assertions.assertTrue(
StringUtils.containsIgnoreCase(normalizedRecreatedCreateSql, "INDEXidx_namenametypeMINMAX"),
Strings.CI.contains(normalizedRecreatedCreateSql, "INDEXidx_namenametypeMINMAX"),
"Recreated table should retain the simple index: " + recreatedCreateSql);
Assertions.assertFalse(
StringUtils.containsIgnoreCase(normalizedRecreatedCreateSql, "idx_lower"),
Strings.CI.contains(normalizedRecreatedCreateSql, "idx_lower"),
"Recreated table must not contain a fabricated replacement index: " + recreatedCreateSql);
}

Expand Down Expand Up @@ -700,8 +700,7 @@ void testLoadAndCreateWithStartOfDatePartitionTransforms() {
String.format("SHOW CREATE TABLE `%s`.`%s`", schemaName, createdTableName));
String normalizedShowCreateSql = StringUtils.deleteWhitespace(showCreateSql).replace("`", "");
Assertions.assertTrue(
StringUtils.containsIgnoreCase(
normalizedShowCreateSql, "PARTITIONBY" + expectedPartitionKey),
Strings.CI.contains(normalizedShowCreateSql, "PARTITIONBY" + expectedPartitionKey),
"CREATE should emit the ClickHouse partition function: " + showCreateSql);
}
}
Expand Down Expand Up @@ -1096,7 +1095,7 @@ void testLoadLegacyAnnoyIndexMetadata() throws Exception {

Assertions.assertEquals("annoy", nativeType);
Assertions.assertTrue(
StringUtils.startsWithIgnoreCase(nativeTypeFull, "annoy"),
Strings.CI.startsWith(nativeTypeFull, "annoy"),
"Expected ClickHouse to preserve the Annoy type expression, but got: " + nativeTypeFull);
Assertions.assertTrue(nativeGranularity > 0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public void setup() throws Exception {
new ClickHouseColumnDefaultValueConverter(),
Collections.emptyMap());

schemaName = "engine_it_" + RandomStringUtils.randomAlphanumeric(6).toLowerCase();
schemaName = "engine_it_" + RandomStringUtils.insecure().nextAlphanumeric(6).toLowerCase();
databaseOperations.create(schemaName, null, Collections.emptyMap());
}

Expand All @@ -139,7 +139,7 @@ public void cleanup() {

@Test
void testTinyLogEngineCreateLoadAndPersistAfterRestart() throws Exception {
String tableName = "tinylog_" + RandomStringUtils.randomAlphanumeric(6).toLowerCase();
String tableName = "tinylog_" + RandomStringUtils.insecure().nextAlphanumeric(6).toLowerCase();
createSimpleTable(schemaName, tableName, ENGINE.TINYLOG);

JdbcTable before = tableOperations.load(schemaName, tableName);
Expand All @@ -160,7 +160,8 @@ void testTinyLogEngineCreateLoadAndPersistAfterRestart() throws Exception {

@Test
void testStripeLogEngineCreateLoadAndPersistAfterRestart() throws Exception {
String tableName = "stripelog_" + RandomStringUtils.randomAlphanumeric(6).toLowerCase();
String tableName =
"stripelog_" + RandomStringUtils.insecure().nextAlphanumeric(6).toLowerCase();
createSimpleTable(schemaName, tableName, ENGINE.STRIPELOG);

JdbcTable before = tableOperations.load(schemaName, tableName);
Expand All @@ -181,7 +182,7 @@ void testStripeLogEngineCreateLoadAndPersistAfterRestart() throws Exception {

@Test
void testLogEngineCreateLoadAndPersistAfterRestart() throws Exception {
String tableName = "log_" + RandomStringUtils.randomAlphanumeric(6).toLowerCase();
String tableName = "log_" + RandomStringUtils.insecure().nextAlphanumeric(6).toLowerCase();
createSimpleTable(schemaName, tableName, ENGINE.LOG);

JdbcTable before = tableOperations.load(schemaName, tableName);
Expand All @@ -204,7 +205,7 @@ void testLogEngineCreateLoadAndPersistAfterRestart() throws Exception {

@Test
void testMemoryEngineIsVolatileAfterRestart() throws Exception {
String tableName = "memory_" + RandomStringUtils.randomAlphanumeric(6).toLowerCase();
String tableName = "memory_" + RandomStringUtils.insecure().nextAlphanumeric(6).toLowerCase();
createSimpleTable(schemaName, tableName, ENGINE.MEMORY);

JdbcTable before = tableOperations.load(schemaName, tableName);
Expand Down Expand Up @@ -233,7 +234,7 @@ void testMemoryEngineIsVolatileAfterRestart() throws Exception {

@Test
void testNullEngineCreateLoadAndPersistAfterRestart() throws Exception {
String tableName = "null_" + RandomStringUtils.randomAlphanumeric(6).toLowerCase();
String tableName = "null_" + RandomStringUtils.insecure().nextAlphanumeric(6).toLowerCase();
createSimpleTable(schemaName, tableName, ENGINE.NULL);

JdbcTable before = tableOperations.load(schemaName, tableName);
Expand All @@ -251,7 +252,7 @@ void testNullEngineCreateLoadAndPersistAfterRestart() throws Exception {

@Test
void testSetEngineCreateLoadAndPersistAfterRestart() throws Exception {
String tableName = "set_" + RandomStringUtils.randomAlphanumeric(6).toLowerCase();
String tableName = "set_" + RandomStringUtils.insecure().nextAlphanumeric(6).toLowerCase();
createSimpleTable(schemaName, tableName, ENGINE.SET);

JdbcTable before = tableOperations.load(schemaName, tableName);
Expand Down
Loading
Loading