This is an automated email from the ASF dual-hosted git repository.
yuqi4733 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git
The following commit(s) were added to refs/heads/main by this push:
new 7c8fc04f1 [#4065] improvement(test): Fix the path of integration log
is wrong. (#4029)
7c8fc04f1 is described below
commit 7c8fc04f19bce1ccd3460918be14739774be81e5
Author: Qi Yu <[email protected]>
AuthorDate: Tue Jul 9 17:54:14 2024 +0800
[#4065] improvement(test): Fix the path of integration log is wrong. (#4029)
### What changes were proposed in this pull request?
- Fix the path of the integration test is not as expected.
- Remove directory data that lies in root project.
### Why are the changes needed?
The path is not right.
Fixed: #4065
### Does this PR introduce _any_ user-facing change?
N/A
### How was this patch tested?
Test locally.
**Before**
<img width="790" alt="image"
src="https://github.com/datastrato/gravitino/assets/15794564/7d4392b6-cc19-4b75-8b81-10b5d5fe9958">
**After**

---
build.gradle.kts | 4 ++--
.../catalog-hadoop/src/test/resources/log4j2.properties | 2 +-
.../catalog-hive/src/test/resources/log4j2.properties | 2 +-
.../src/test/resources/log4j2.properties | 2 +-
.../src/test/resources/log4j2.properties | 2 +-
.../src/test/resources/log4j2.properties | 2 +-
.../catalog-kafka/src/test/resources/log4j2.properties | 2 +-
.../src/test/resources/log4j2.properties | 2 +-
.../src/test/resources/log4j2.properties | 2 +-
integration-test/src/test/resources/log4j2.properties | 2 +-
.../gravitino/server/TestGravitinoServer.java | 17 +++++++++++++++++
11 files changed, 28 insertions(+), 11 deletions(-)
diff --git a/build.gradle.kts b/build.gradle.kts
index a29b0405d..e8d2b477e 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -182,8 +182,8 @@ allprojects {
param.environment("jdbcBackend", jdbcDatabase)
val testMode = project.properties["testMode"] as? String ?: "embedded"
- param.systemProperty("gravitino.log.path", project.buildDir.path +
"/${project.name}-integration-test.log")
- project.delete(project.buildDir.path +
"/${project.name}-integration-test.log")
+ param.systemProperty("gravitino.log.path",
"build/${project.name}-integration-test.log")
+ project.delete("build/${project.name}-integration-test.log")
if (testMode == "deploy") {
param.environment("GRAVITINO_HOME", project.rootDir.path +
"/distribution/package")
param.systemProperty("testMode", "deploy")
diff --git a/catalogs/catalog-hadoop/src/test/resources/log4j2.properties
b/catalogs/catalog-hadoop/src/test/resources/log4j2.properties
index 52f183579..c71b642a9 100644
--- a/catalogs/catalog-hadoop/src/test/resources/log4j2.properties
+++ b/catalogs/catalog-hadoop/src/test/resources/log4j2.properties
@@ -30,7 +30,7 @@ appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p [%t] %c{1}:%L -
%m%n
# Log files location
-property.logPath =
${sys:gravitino.log.path:-catalog-hadoop/build/integration-test.log}
+property.logPath =
${sys:gravitino.log.path:-build/catalog-hadoop-integration-test.log}
# File appender configuration
appender.file.type = File
diff --git a/catalogs/catalog-hive/src/test/resources/log4j2.properties
b/catalogs/catalog-hive/src/test/resources/log4j2.properties
index 112762fe3..e6c8916fb 100644
--- a/catalogs/catalog-hive/src/test/resources/log4j2.properties
+++ b/catalogs/catalog-hive/src/test/resources/log4j2.properties
@@ -30,7 +30,7 @@ appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p [%t] %c{1}:%L -
%m%n
# Log files location
-property.logPath =
${sys:gravitino.log.path:-catalog-hive/build/hive-integration-test.log}
+property.logPath =
${sys:gravitino.log.path:-build/catalog-hive-integration-test.log}
# File appender configuration
appender.file.type = File
diff --git a/catalogs/catalog-jdbc-doris/src/test/resources/log4j2.properties
b/catalogs/catalog-jdbc-doris/src/test/resources/log4j2.properties
index 0ecbcf1f1..32f7f1e28 100644
--- a/catalogs/catalog-jdbc-doris/src/test/resources/log4j2.properties
+++ b/catalogs/catalog-jdbc-doris/src/test/resources/log4j2.properties
@@ -30,7 +30,7 @@ appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p [%t] %c{1}:%L -
%m%n
# Log files location
-property.logPath =
${sys:gravitino.log.path:-catalog-jdbc-doris/build/doris-integration-test.log}
+property.logPath =
${sys:gravitino.log.path:-build/catalog-jdbc-doris-integration-test.log}
# File appender configuration
appender.file.type = File
diff --git a/catalogs/catalog-jdbc-mysql/src/test/resources/log4j2.properties
b/catalogs/catalog-jdbc-mysql/src/test/resources/log4j2.properties
index a6dfcb14e..23815b3ae 100644
--- a/catalogs/catalog-jdbc-mysql/src/test/resources/log4j2.properties
+++ b/catalogs/catalog-jdbc-mysql/src/test/resources/log4j2.properties
@@ -30,7 +30,7 @@ appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p [%t] %c{1}:%L -
%m%n
# Log files location
-property.logPath =
${sys:gravitino.log.path:-catalog-jdbc-mysql/build/mysql-integration-test.log}
+property.logPath =
${sys:gravitino.log.path:-build/catalog-jdbc-mysql-integration-test.log}
# File appender configuration
appender.file.type = File
diff --git
a/catalogs/catalog-jdbc-postgresql/src/test/resources/log4j2.properties
b/catalogs/catalog-jdbc-postgresql/src/test/resources/log4j2.properties
index e4c1f765b..59108d3dc 100644
--- a/catalogs/catalog-jdbc-postgresql/src/test/resources/log4j2.properties
+++ b/catalogs/catalog-jdbc-postgresql/src/test/resources/log4j2.properties
@@ -30,7 +30,7 @@ appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p [%t] %c{1}:%L -
%m%n
# Log files location
-property.logPath =
${sys:gravitino.log.path:-catalog-jdbc-postgresql/build/postgresql-integration-test.log}
+property.logPath =
${sys:gravitino.log.path:-build/catalog-jdbc-postgresql-integration-test.log}
# File appender configuration
appender.file.type = File
diff --git a/catalogs/catalog-kafka/src/test/resources/log4j2.properties
b/catalogs/catalog-kafka/src/test/resources/log4j2.properties
index a565d0787..7c45bdf0f 100644
--- a/catalogs/catalog-kafka/src/test/resources/log4j2.properties
+++ b/catalogs/catalog-kafka/src/test/resources/log4j2.properties
@@ -30,7 +30,7 @@ appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p [%t] %c{1}:%L -
%m%n
# Log files location
-property.logPath =
${sys:gravitino.log.path:-catalog-messaging-kafka/build/kafka-integration-test.log}
+property.logPath =
${sys:gravitino.log.path:-build/catalog-kafka-integration-test.log}
# File appender configuration
appender.file.type = File
diff --git
a/catalogs/catalog-lakehouse-iceberg/src/test/resources/log4j2.properties
b/catalogs/catalog-lakehouse-iceberg/src/test/resources/log4j2.properties
index 66ed1f477..7af5db37b 100644
--- a/catalogs/catalog-lakehouse-iceberg/src/test/resources/log4j2.properties
+++ b/catalogs/catalog-lakehouse-iceberg/src/test/resources/log4j2.properties
@@ -30,7 +30,7 @@ appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p [%t] %c{1}:%L -
%m%n
# Log files location
-property.logPath =
${sys:gravitino.log.path:-catalog-lakehouse-iceberg/build/iceberg-integration-test.log}
+property.logPath =
${sys:gravitino.log.path:-build/catalog-lakehouse-iceberg-integration-test.log}
# File appender configuration
appender.file.type = File
diff --git
a/catalogs/catalog-lakehouse-paimon/src/test/resources/log4j2.properties
b/catalogs/catalog-lakehouse-paimon/src/test/resources/log4j2.properties
index e9f59bdeb..f7ffe6df8 100644
--- a/catalogs/catalog-lakehouse-paimon/src/test/resources/log4j2.properties
+++ b/catalogs/catalog-lakehouse-paimon/src/test/resources/log4j2.properties
@@ -30,7 +30,7 @@ appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
# Log files location
-property.logPath =
${sys:gravitino.log.path:-catalog-lakehouse-paimon/build/paimon-integration-test.log}
+property.logPath =
${sys:gravitino.log.path:-build/catalog-lakehouse-paimon-integration-test.log}
# File appender configuration
appender.file.type = File
diff --git a/integration-test/src/test/resources/log4j2.properties
b/integration-test/src/test/resources/log4j2.properties
index 44bf352e2..b7e3cb8ef 100644
--- a/integration-test/src/test/resources/log4j2.properties
+++ b/integration-test/src/test/resources/log4j2.properties
@@ -30,7 +30,7 @@ appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p [%t] %c{1}:%L -
%m%n
# Log files location
-property.logPath =
${sys:gravitino.log.path:-integration-test/build/integration-test.log}
+property.logPath = ${sys:gravitino.log.path:-build/integration-test.log}
# File appender configuration
appender.file.type = File
diff --git
a/server/src/test/java/com/datastrato/gravitino/server/TestGravitinoServer.java
b/server/src/test/java/com/datastrato/gravitino/server/TestGravitinoServer.java
index 4d830f066..e54909aa4 100644
---
a/server/src/test/java/com/datastrato/gravitino/server/TestGravitinoServer.java
+++
b/server/src/test/java/com/datastrato/gravitino/server/TestGravitinoServer.java
@@ -19,6 +19,7 @@
package com.datastrato.gravitino.server;
import static com.datastrato.gravitino.Configs.ENTITY_KV_ROCKSDB_BACKEND_PATH;
+import static
com.datastrato.gravitino.Configs.ENTITY_RELATIONAL_JDBC_BACKEND_PATH;
import static org.junit.jupiter.api.Assertions.assertThrows;
import com.datastrato.gravitino.auxiliary.AuxiliaryServiceManager;
@@ -26,8 +27,11 @@ import com.datastrato.gravitino.rest.RESTUtils;
import com.datastrato.gravitino.server.web.JettyServerConfig;
import com.google.common.collect.ImmutableMap;
import java.io.IOException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
import java.util.UUID;
import org.apache.commons.io.FileUtils;
+import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
@@ -75,6 +79,19 @@ public class TestGravitinoServer {
gravitinoServer = new GravitinoServer(spyServerConfig);
}
+ @AfterAll
+ public void clear() {
+ String path = spyServerConfig.get(ENTITY_RELATIONAL_JDBC_BACKEND_PATH);
+ if (path != null) {
+ Path p = Paths.get(path).getParent();
+ try {
+ FileUtils.deleteDirectory(p.toFile());
+ } catch (IOException e) {
+ // Ignore
+ }
+ }
+ }
+
@AfterEach
public void tearDown() {
if (gravitinoServer != null) {