Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail test when Connect doesn't start in time and increse the wait time #9773

Merged
merged 1 commit into from
Mar 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;

import static java.lang.String.format;

public class ConnectCluster {
private int numNodes;
private String brokerList;
Expand Down Expand Up @@ -61,7 +63,7 @@ public void startup() throws InterruptedException {
try {
ConnectDistributed connectDistributed = new ConnectDistributed();
Connect connect = connectDistributed.startConnect(workerProps);
waitConnectRunning(connect);
waitForAllServicesToStart(connect, 120);
connectInstances.add(connect);
connectPorts.add(port);
l.countDown();
Expand All @@ -83,17 +85,16 @@ public void startup() throws InterruptedException {
}
}

private static void waitConnectRunning(Connect connect) {
int counter = 30;
while (!connect.isRunning() && counter-- > 0) {
private static void waitForAllServicesToStart(Connect connect, int seconds) {
while (!connect.isRunning() && seconds-- > 0) {
try {
TimeUnit.MILLISECONDS.sleep(100);
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
throw new RuntimeException(e);
throw new ConnectException(e);
}
}
if (!connect.isRunning()) {
throw new RuntimeException("Connect failed to start after 3 seconds.");
throw new ConnectException(format("Connect failed to start."));
}
}

Expand Down
Loading