[CELEBORN-1056][FOLLOWUP] Support testing of dynamic configuration management cli

### What changes were proposed in this pull request?

Support testing of dynamic configuration management cli.

### Why are the changes needed?

The tests of dynamic configuration management cli are disabled since dynamic conf is not enabled in unit tests, which should support testing dynamic configuration management cli.

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

`TestCelebornCliCommands`.

Closes #3340 from SteNicholas/CELEBORN-1056.

Authored-by: SteNicholas <programgeek@163.com>
Signed-off-by: Wang, Fei <fwang12@ebay.com>
This commit is contained in:
SteNicholas 2025-06-22 21:25:09 -07:00 committed by Wang, Fei
parent 6a097944cf
commit dac0f56e94
4 changed files with 20 additions and 8 deletions

View File

@ -77,6 +77,11 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>

View File

@ -45,6 +45,12 @@ class TestCelebornCliCommands extends CelebornFunSuite with MiniClusterFeature {
classOf[UserDefinePasswordAuthenticationProviderImpl].getName)
.set(CelebornConf.MASTER_HTTP_AUTH_ADMINISTERS, Seq(CELEBORN_ADMINISTER))
.set(CelebornConf.WORKER_HTTP_AUTH_ADMINISTERS, Seq(CELEBORN_ADMINISTER))
.set(CelebornConf.DYNAMIC_CONFIG_STORE_BACKEND, "DB")
.set(
CelebornConf.DYNAMIC_CONFIG_STORE_DB_HIKARI_JDBC_URL,
"jdbc:h2:mem:test;MODE=MYSQL;INIT=RUNSCRIPT FROM 'classpath:celeborn-0.6.0-h2.sql';DB_CLOSE_DELAY=-1;")
.set(CelebornConf.DYNAMIC_CONFIG_STORE_DB_HIKARI_DRIVER_CLASS_NAME, "org.h2.Driver")
.set(CelebornConf.DYNAMIC_CONFIG_STORE_DB_HIKARI_MAXIMUM_POOL_SIZE, 1)
private val BASIC_AUTH_HEADER = HttpAuthSchemes.BASIC + " " + new String(
Base64.getEncoder.encode(
@ -143,13 +149,11 @@ class TestCelebornCliCommands extends CelebornFunSuite with MiniClusterFeature {
}
test("worker --show-dynamic-conf") {
cancel("This test is temporarily disabled since dynamic conf is not enabled in unit tests.")
val args = prepareWorkerArgs() :+ "--show-dynamic-conf"
captureOutputAndValidateResponse(args, "")
captureOutputAndValidateResponse(args, "DynamicConfigResponse")
}
test("worker --upsert-dynamic-conf") {
cancel("This test is temporarily disabled since dynamic conf is not enabled in unit tests.")
val args = prepareWorkerArgs() ++ Array(
"--upsert-dynamic-conf",
"--config-level",
@ -160,7 +164,6 @@ class TestCelebornCliCommands extends CelebornFunSuite with MiniClusterFeature {
}
test("worker --delete-dynamic-conf") {
cancel("This test is temporarily disabled since dynamic conf is not enabled in unit tests.")
val args = prepareWorkerArgs() ++ Array(
"--delete-dynamic-conf",
"--config-level",
@ -247,13 +250,11 @@ class TestCelebornCliCommands extends CelebornFunSuite with MiniClusterFeature {
}
test("master --show-dynamic-conf") {
cancel("This test is temporarily disabled since dynamic conf is not enabled in unit tests.")
val args = prepareMasterArgs() :+ "--show-dynamic-conf"
captureOutputAndValidateResponse(args, "")
captureOutputAndValidateResponse(args, "DynamicConfigResponse")
}
test("master --upsert-dynamic-conf") {
cancel("This test is temporarily disabled since dynamic conf is not enabled in unit tests.")
val args = prepareMasterArgs() ++ Array(
"--upsert-dynamic-conf",
"--config-level",
@ -264,7 +265,6 @@ class TestCelebornCliCommands extends CelebornFunSuite with MiniClusterFeature {
}
test("master --delete-dynamic-conf") {
cancel("This test is temporarily disabled since dynamic conf is not enabled in unit tests.")
val args = prepareMasterArgs() ++ Array(
"--delete-dynamic-conf",
"--config-level",

View File

@ -196,6 +196,11 @@
<artifactId>log4j-core</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<!-- Test dependencies -->
<dependency>
<groupId>org.mockito</groupId>

View File

@ -22,6 +22,7 @@ import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import org.apache.commons.lang3.StringUtils;
public class JsonUtils {
@ -30,6 +31,7 @@ public class JsonUtils {
static {
MAPPER.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
MAPPER.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY);
MAPPER.registerModule(new JavaTimeModule());
}
public static String toJson(Object obj) {