World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
Java ai-catalogdata-catalogdatalakefederated-querylakehousemetadatametalakemodel-catalogopendatacatalogskycomputingstratosphere
[#5969] fix(Docker): Failed to create Docker network by concurrent execution ITs (#5970)
Xun9703039d9406
diff --git a/integration-test-common/src/test/java/org/apache/gravitino/integration/test/container/ContainerSuite.java b/integration-test-common/src/test/java/org/apache/gravitino/integration/test/container/ContainerSuite.javaindex 5745cc6d08..d2a5ee6152 100644--- a/integration-test-common/src/test/java/org/apache/gravitino/integration/test/container/ContainerSuite.java+++ b/integration-test-common/src/test/java/org/apache/gravitino/integration/test/container/ContainerSuite.java@@ -86,22 +86,24 @@ public class ContainerSuite implements Closeable {protected static final CloseableGroup closer = CloseableGroup.create();private static void initIfNecessary() {- if (initialized) {- return;- }-- try {- // Check if docker is available and you should never close the global DockerClient!- DockerClient dockerClient = DockerClientFactory.instance().client();- Info info = dockerClient.infoCmd().exec();- LOG.info("Docker info: {}", info);-- if ("true".equalsIgnoreCase(System.getenv("NEED_CREATE_DOCKER_NETWORK"))) {- network = createDockerNetwork();+ if (!initialized) {+ synchronized (ContainerSuite.class) {+ if (!initialized) {+ try {+ // Check if docker is available and you should never close the global DockerClient!+ DockerClient dockerClient = DockerClientFactory.instance().client();+ Info info = dockerClient.infoCmd().exec();+ LOG.info("Docker info: {}", info);++ if ("true".equalsIgnoreCase(System.getenv("NEED_CREATE_DOCKER_NETWORK"))) {+ network = createDockerNetwork();+ }+ initialized = true;+ } catch (Exception e) {+ throw new RuntimeException("Failed to initialize ContainerSuite", e);+ }+ }}- initialized = true;- } catch (Exception e) {- throw new RuntimeException("Failed to initialize ContainerSuite", e);}}