From 95ef7d35f0f062603d5e5e87ba78e16e7de72a55 Mon Sep 17 00:00:00 2001 From: Tobias Gesellchen Date: Mon, 15 Nov 2021 22:13:55 +0100 Subject: [PATCH] Trying to stabilize the containerLogsWithTty test --- .../remote/api/client/ContainerApiIntegrationTest.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/api-client/src/test/java/de/gesellix/docker/remote/api/client/ContainerApiIntegrationTest.java b/api-client/src/test/java/de/gesellix/docker/remote/api/client/ContainerApiIntegrationTest.java index cbb86abc..c11e9944 100644 --- a/api-client/src/test/java/de/gesellix/docker/remote/api/client/ContainerApiIntegrationTest.java +++ b/api-client/src/test/java/de/gesellix/docker/remote/api/client/ContainerApiIntegrationTest.java @@ -318,7 +318,7 @@ public void run() { } @Test - public void containerLogsWithTty() { + public void containerLogsWithTty() throws InterruptedException { imageApi.imageCreate(testImage.getImageName(), null, null, testImage.getImageTag(), null, null, null, null, null); ContainerCreateRequest containerCreateRequest = new ContainerCreateRequest( @@ -342,8 +342,9 @@ public void containerLogsWithTty() { ); containerApi.containerCreate(containerCreateRequest, "container-logs-with-tty-test"); containerApi.containerStart("container-logs-with-tty-test", null); + Thread.sleep(500); - Duration timeout = Duration.of(5, SECONDS); + Duration timeout = Duration.of(10, SECONDS); LogFrameStreamCallback callback = new LogFrameStreamCallback(); new Thread(() -> containerApi.containerLogs( @@ -366,7 +367,9 @@ public void run() { catch (InterruptedException e) { e.printStackTrace(); } - assertSame(callback.frames.stream().findAny().get().getStreamType(), Frame.StreamType.RAW); + Optional anyFrame = callback.frames.stream().findAny(); + assertTrue(anyFrame.isPresent()); + assertSame(anyFrame.get().getStreamType(), Frame.StreamType.RAW); removeContainer(engineApiClient, "container-logs-with-tty-test"); }