Skip to content

Commit

Permalink
Fix flaky ServerStatusManagerIntegrationTest (#948)
Browse files Browse the repository at this point in the history
Motivation:

`ServerStatusManagerIntegrationTest` reuses the acquired ports to restart the running cluster. I observed that the ports were not released after `cluster.stop()`.

![image](https://github.com/line/centraldogma/assets/1866157/e0bd2f45-61c6-41c2-8d55-59f654ccc379)

Modifications:

- Sleep 3 seconds after a cluster stop to give enough time to release the ports.

Result:

Fixes CI failures.
  • Loading branch information
ikhoon authored Apr 23, 2024
1 parent 6501a59 commit 9550282
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
import com.linecorp.centraldogma.server.internal.api.UpdateServerStatusRequest.Scope;
import com.linecorp.centraldogma.testing.internal.CentralDogmaReplicationExtension;
import com.linecorp.centraldogma.testing.internal.CentralDogmaRuleDelegate;
import com.linecorp.centraldogma.testing.internal.FlakyTest;

@FlakyTest
class ServerStatusManagerIntegrationTest {
@RegisterExtension
final CentralDogmaReplicationExtension cluster = new CentralDogmaReplicationExtension(3) {
Expand Down Expand Up @@ -85,6 +87,8 @@ void preserveStatusAfterRestarting() throws Exception {
assertThatThrownBy(() -> getServerStatus(client))
.isInstanceOf(UnprocessedRequestException.class)
.hasCauseInstanceOf(ConnectException.class);
// Wait for the ports acquired to be released.
Thread.sleep(5000);

// Restart the cluster with the same configuration.
cluster.start();
Expand All @@ -109,6 +113,8 @@ void preserveStatusAfterRestarting() throws Exception {
assertThatThrownBy(() -> getServerStatus(client))
.isInstanceOf(UnprocessedRequestException.class)
.hasCauseInstanceOf(ConnectException.class);
// Wait for the ports acquired to be released.
Thread.sleep(5000);

cluster.start();
serverStatus = getServerStatus(client);
Expand Down

0 comments on commit 9550282

Please sign in to comment.