Skip to content

Commit fff7cb0

Browse files
committed
Wait longer to reduce flakiness of TestNodeStateManager
1 parent 62a6428 commit fff7cb0

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

core/trino-main/src/test/java/io/trino/server/TestNodeStateManager.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060

6161
class TestNodeStateManager
6262
{
63-
public static final int GRACE_PERIOD_MILLIS = 200;
63+
public static final int GRACE_PERIOD_MILLIS = 1000;
6464
private FakeScheduledExecutorService executor;
6565
private NodeStateManager nodeStateManager;
6666
private TestingTicker ticker;
@@ -105,8 +105,8 @@ void testTransitionToShuttingDown()
105105
nodeStateManager.transitionState(NodeState.SHUTTING_DOWN);
106106
assertThat(nodeStateManager.getServerState()).isEqualTo(NodeState.SHUTTING_DOWN);
107107

108-
// here wait for at least 2 grace periods, and add some slack to reduce test flakyness
109-
await().atMost(4 * GRACE_PERIOD_MILLIS + 100, MILLISECONDS).until(() -> shutdownAction.isShuttingDown());
108+
// here wait for at least 4 grace periods, and add some slack to reduce test flakyness
109+
await().atMost(4 * GRACE_PERIOD_MILLIS + 1000, MILLISECONDS).until(() -> shutdownAction.isShuttingDown());
110110
}
111111

112112
@Test
@@ -117,7 +117,7 @@ void testCannotReactivateShuttingDown()
117117
nodeStateManager.transitionState(NodeState.SHUTTING_DOWN);
118118
assertThat(nodeStateManager.getServerState()).isEqualTo(NodeState.SHUTTING_DOWN);
119119

120-
// here wait for at least 2 grace periods, and add some slack to reduce test flakyness
120+
// here wait for at least 4 grace periods, and add some slack to reduce test flakyness
121121
await().atMost(4 * GRACE_PERIOD_MILLIS, MILLISECONDS).until(() -> shutdownAction.isShuttingDown());
122122

123123
assertThatThrownBy(() -> nodeStateManager.transitionState(ACTIVE))
@@ -144,9 +144,8 @@ void testImmediateTransitionToShuttingDownWhenDrained()
144144
nodeStateManager.transitionState(NodeState.SHUTTING_DOWN);
145145
assertThat(nodeStateManager.getServerState()).isEqualTo(NodeState.SHUTTING_DOWN);
146146

147-
// here only wait for minimal amount of time, as shutdown should be immediate
148147
await().pollInterval(1, MILLISECONDS)
149-
.atMost(100, MILLISECONDS).until(() -> shutdownAction.isShuttingDown());
148+
.atMost(1, SECONDS).until(() -> shutdownAction.isShuttingDown());
150149
}
151150

152151
@Test

0 commit comments

Comments
 (0)