Skip to content

Commit 21dc16d

Browse files
committed
Removed unreliable test that would test interrupted server shutdown
1 parent 0f9d0f6 commit 21dc16d

File tree

1 file changed

+0
-32
lines changed

1 file changed

+0
-32
lines changed

grpc-server-spring-boot-autoconfigure/src/test/java/net/devh/boot/grpc/server/serverfactory/GrpcServerLifecycleTest.java

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import static org.junit.jupiter.api.Assertions.assertTimeout;
2626
import static org.junit.jupiter.api.Assertions.assertTimeoutPreemptively;
2727
import static org.junit.jupiter.api.Assertions.assertTrue;
28-
import static org.junit.jupiter.api.Assertions.fail;
2928
import static org.mockito.Mockito.mock;
3029
import static org.mockito.Mockito.reset;
3130
import static org.mockito.Mockito.when;
@@ -37,7 +36,6 @@
3736
import org.junit.jupiter.api.BeforeEach;
3837
import org.junit.jupiter.api.Test;
3938
import org.junit.jupiter.api.function.Executable;
40-
import org.opentest4j.AssertionFailedError;
4139

4240
import io.grpc.Server;
4341

@@ -128,36 +126,6 @@ void testAwaitShutdown() {
128126

129127
}
130128

131-
@Test
132-
void testInterruptShutdown() {
133-
134-
// The server takes 60s seconds to shutdown
135-
final TestServer server = new TestServer(60000);
136-
when(this.factory.createServer()).thenReturn(server);
137-
138-
// And we give it infinite time to shutdown
139-
final GrpcServerLifecycle lifecycle = new GrpcServerLifecycle(this.factory, ofSeconds(-1));
140-
141-
lifecycle.start();
142-
143-
assertFalse(server.isShutdown());
144-
assertFalse(server.isTerminated());
145-
146-
try {
147-
// But we are in a hurry, so we interrupt it after 2s
148-
assertTimeoutPreemptively(ofMillis(2000), (Executable) lifecycle::stop);
149-
fail("Did not wait for shutdown to complete");
150-
} catch (final AssertionFailedError e) {
151-
// We failed due to the timeout/interrupt
152-
assertThat(e).getCause().matches(t -> "ExecutionTimeoutException".equals(t.getClass().getSimpleName()));
153-
}
154-
155-
// But the server is still properly terminated
156-
assertTrue(server.isShutdown());
157-
assertTrue(server.isTerminated());
158-
159-
}
160-
161129
public class TestServer extends Server {
162130

163131
private final long shutdownDelayMillis;

0 commit comments

Comments
 (0)