From 3c4a18776892edb331acb3eddbd74fc926a93cd7 Mon Sep 17 00:00:00 2001 From: tison Date: Sat, 28 Oct 2023 11:51:14 +0800 Subject: [PATCH] feat(bindings/java): use random root for behavior tests (#3408) --- .../apache/opendal/test/behavior/BehaviorExtension.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bindings/java/src/test/java/org/apache/opendal/test/behavior/BehaviorExtension.java b/bindings/java/src/test/java/org/apache/opendal/test/behavior/BehaviorExtension.java index 465fda7b208e..c27fe583cfbb 100644 --- a/bindings/java/src/test/java/org/apache/opendal/test/behavior/BehaviorExtension.java +++ b/bindings/java/src/test/java/org/apache/opendal/test/behavior/BehaviorExtension.java @@ -25,6 +25,7 @@ import java.io.StringWriter; import java.util.HashMap; import java.util.Map; +import java.util.UUID; import lombok.extern.slf4j.Slf4j; import org.apache.opendal.BlockingOperator; import org.apache.opendal.Operator; @@ -53,6 +54,13 @@ public void beforeAll(ExtensionContext context) { config.put(key.substring(prefix.length()), entry.getValue()); } } + + // Use random root unless OPENDAL_DISABLE_RANDOM_ROOT is set to true. + if (!Boolean.parseBoolean(dotenv.get("OPENDAL_DISABLE_RANDOM_ROOT"))) { + final String root = config.getOrDefault("root", "/") + UUID.randomUUID() + "/"; + config.put("root", root); + } + this.operator = Operator.of(scheme, config); this.blockingOperator = BlockingOperator.of(scheme, config);