From 57b7450b11769fc711706017db9cf28751ad5ccc Mon Sep 17 00:00:00 2001 From: MaxSiominDev Date: Tue, 30 Jun 2026 17:27:38 +0300 Subject: [PATCH] test(tdg): await data model readiness in TDGClientTest TDGClientTest queried spaces right after cluster.start(), which only waits for the containers to come up. The TDG data model (and therefore the User/person spaces) is applied asynchronously afterwards, so on slower runners the first queries hit a not-yet-created space and failed with "attempt to index ... 'space' (a nil value)". Wait for the model in @BeforeAll by probing both spaces via retryUntilSuccess before the tests run. --- .../client/integration/tdg/TDGClientTest.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tarantool-client/src/test/java/io/tarantool/client/integration/tdg/TDGClientTest.java b/tarantool-client/src/test/java/io/tarantool/client/integration/tdg/TDGClientTest.java index bfe3b2c6..99b98b74 100644 --- a/tarantool-client/src/test/java/io/tarantool/client/integration/tdg/TDGClientTest.java +++ b/tarantool-client/src/test/java/io/tarantool/client/integration/tdg/TDGClientTest.java @@ -16,12 +16,14 @@ import java.util.Objects; import java.util.UUID; import java.util.concurrent.CompletionException; +import java.util.concurrent.TimeUnit; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import org.rnorth.ducttape.unreliables.Unreliables; import org.testcontainers.containers.tdg.cluster.TDGCluster; import org.testcontainers.containers.tdg.cluster.TDGClusterImpl; import org.testcontainers.containers.tdg.configuration.TDGConfigurator; @@ -41,6 +43,8 @@ class TDGClientTest { DockerImageName.parse( System.getenv().getOrDefault("TARANTOOL_REGISTRY", "") + "tdg2:2.11.5-0-geff8adb3"); + private static final int MODEL_READINESS_TIMEOUT_SECONDS = 60; + private static final Path ROOT_CONFIG_PATH; private static final TDGConfigurator configurator; @@ -73,6 +77,18 @@ static void setUp() throws Exception { .withHost(configurator.core().getValue().iprotoMappedAddress().getHostName()) .withPort(configurator.core().getValue().iprotoMappedAddress().getPort()) .build(); + awaitModelReady(); + } + + private static void awaitModelReady() { + Unreliables.retryUntilSuccess( + MODEL_READINESS_TIMEOUT_SECONDS, + TimeUnit.SECONDS, + () -> { + client.space("User").get(1).join(); + client.space("person").get(1).join(); + return null; + }); } @AfterAll