Skip to content

Commit 105006c

Browse files
nickkkcccdkasimovskiy
authored andcommitted
Fix after review
Closes #98
1 parent c3d9aca commit 105006c

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/main/java/org/testcontainers/containers/TarantoolCartridgeContainer.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ public class TarantoolCartridgeContainer extends GenericContainer<TarantoolCartr
106106
private static final String ENV_TARANTOOL_DATADIR = "TARANTOOL_DATADIR";
107107
private static final String ENV_TARANTOOL_INSTANCES_FILE = "TARANTOOL_INSTANCES_FILE";
108108
private static final String ENV_TARANTOOL_CLUSTER_COOKIE = "TARANTOOL_CLUSTER_COOKIE";
109+
private static final String healthyCmd = "return require('cartridge').is_healthy()";
109110

110111
private final CartridgeConfigParser instanceFileParser;
111112
private final TarantoolContainerClientHelper clientHelper;
@@ -570,11 +571,12 @@ private void bootstrapVshard() {
570571
@Override
571572
protected void containerIsStarted(InspectContainerResponse containerInfo, boolean reused) {
572573
super.containerIsStarted(containerInfo, reused);
574+
int secondsToWait = 120;
573575

574-
waitUntilRouterIsUp(120);
576+
waitUntilRouterIsUp(secondsToWait);
575577
retryingSetupTopology();
576578
// wait until Roles are configured
577-
waitUntilCartridgeIsHealthy(120);
579+
waitUntilCartridgeIsHealthy(secondsToWait);
578580
bootstrapVshard();
579581

580582
logger().info("Tarantool Cartridge cluster is started");
@@ -584,7 +586,7 @@ protected void containerIsStarted(InspectContainerResponse containerInfo, boolea
584586

585587
private void waitUntilRouterIsUp(int secondsToWait) {
586588
if(!waitUntilTrue(secondsToWait, this::routerIsUp)) {
587-
throw new RuntimeException("Timeout exceeded during router upping stage." +
589+
throw new RuntimeException("Timeout exceeded during router starting stage." +
588590
" See the specific error in logs.");
589591
}
590592
}
@@ -612,11 +614,7 @@ private boolean waitUntilTrue(int secondsToWait, Supplier<Boolean> waitFunc) {
612614
}
613615

614616
private boolean routerIsUp() {
615-
// String healthyCmd = " local cartridge = package.loaded['cartridge']" +
616-
// " return cartridge ~= nil";
617-
String healthyCmd = "return require('cartridge').is_healthy()";
618617
ExecResult result;
619-
620618
try {
621619
result = executeCommand(healthyCmd);
622620
if (result.getExitCode() != 0 && result.getStderr().contains("Connection refused") &&
@@ -637,7 +635,6 @@ private boolean routerIsUp() {
637635
}
638636

639637
private boolean isCartridgeHealthy() {
640-
String healthyCmd = " return require('cartridge').is_healthy()";
641638
ExecResult result;
642639
try {
643640
result = executeCommand(healthyCmd);

0 commit comments

Comments
 (0)