Skip to content

Commit 226edb8

Browse files
committed
modify test
1 parent ca027a1 commit 226edb8

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

fluss-server/src/test/java/org/apache/fluss/server/coordinator/CoordinatorServerTest.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@
2626
import org.junit.jupiter.api.AfterEach;
2727
import org.junit.jupiter.api.BeforeEach;
2828

29+
import java.time.Duration;
2930
import java.util.Optional;
3031

32+
import static org.apache.fluss.testutils.common.CommonTestUtils.waitUntil;
3133
import static org.assertj.core.api.Assertions.assertThat;
3234

3335
/** Test for {@link CoordinatorServer} . */
@@ -38,6 +40,7 @@ class CoordinatorServerTest extends ServerTestBase {
3840
@BeforeEach
3941
void beforeEach() throws Exception {
4042
coordinatorServer = startCoordinatorServer(createConfiguration());
43+
waitUtilCoordinatorServerElected();
4144
}
4245

4346
@AfterEach
@@ -71,4 +74,13 @@ protected void checkAfterStartServer() throws Exception {
7174
optCoordinatorAddr.get().getEndpoints(),
7275
coordinatorServer.getRpcServer().getBindEndpoints());
7376
}
77+
78+
public void waitUtilCoordinatorServerElected() {
79+
waitUntil(
80+
() -> {
81+
return zookeeperClient.getCoordinatorLeaderAddress().isPresent();
82+
},
83+
Duration.ofSeconds(10),
84+
String.format("Fail to wait coordinator server reelected"));
85+
}
7486
}

0 commit comments

Comments
 (0)