Skip to content

Commit 95ef7d3

Browse files
committed
Trying to stabilize the containerLogsWithTty test
1 parent 0fb6b55 commit 95ef7d3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

api-client/src/test/java/de/gesellix/docker/remote/api/client/ContainerApiIntegrationTest.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ public void run() {
318318
}
319319

320320
@Test
321-
public void containerLogsWithTty() {
321+
public void containerLogsWithTty() throws InterruptedException {
322322
imageApi.imageCreate(testImage.getImageName(), null, null, testImage.getImageTag(), null, null, null, null, null);
323323

324324
ContainerCreateRequest containerCreateRequest = new ContainerCreateRequest(
@@ -342,8 +342,9 @@ public void containerLogsWithTty() {
342342
);
343343
containerApi.containerCreate(containerCreateRequest, "container-logs-with-tty-test");
344344
containerApi.containerStart("container-logs-with-tty-test", null);
345+
Thread.sleep(500);
345346

346-
Duration timeout = Duration.of(5, SECONDS);
347+
Duration timeout = Duration.of(10, SECONDS);
347348
LogFrameStreamCallback callback = new LogFrameStreamCallback();
348349

349350
new Thread(() -> containerApi.containerLogs(
@@ -366,7 +367,9 @@ public void run() {
366367
catch (InterruptedException e) {
367368
e.printStackTrace();
368369
}
369-
assertSame(callback.frames.stream().findAny().get().getStreamType(), Frame.StreamType.RAW);
370+
Optional<Frame> anyFrame = callback.frames.stream().findAny();
371+
assertTrue(anyFrame.isPresent());
372+
assertSame(anyFrame.get().getStreamType(), Frame.StreamType.RAW);
370373

371374
removeContainer(engineApiClient, "container-logs-with-tty-test");
372375
}

0 commit comments

Comments
 (0)