Skip to content

Commit f24fc26

Browse files
author
Łukasz Warchał
committed
Polish tests for WaitContainerCmd
Reduce containers sleep duration to 10 seconds. Remove unnecessary calls to KillContainerCmd.
1 parent a8466ff commit f24fc26

2 files changed

Lines changed: 2 additions & 16 deletions

File tree

src/test/java/com/github/dockerjava/core/command/WaitContainerCmdImplTest.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public void testWaitContainerAbort() throws Exception {
106106
@Test
107107
public void testWaitContainerTimeout() throws Exception {
108108

109-
CreateContainerResponse container = dockerClient.createContainerCmd("busybox").withCmd("sleep", "9999").exec();
109+
CreateContainerResponse container = dockerClient.createContainerCmd("busybox").withCmd("sleep", "10").exec();
110110

111111
LOG.info("Created container: {}", container.toString());
112112
assertThat(container.getId(), not(isEmptyString()));
@@ -121,12 +121,5 @@ public void testWaitContainerTimeout() throws Exception {
121121
} catch(DockerClientException e){
122122
LOG.info(e.getMessage());
123123
}
124-
125-
dockerClient.killContainerCmd(container.getId()).exec();
126-
127-
InspectContainerResponse inspectContainerResponse = dockerClient.inspectContainerCmd(container.getId()).exec();
128-
LOG.info("Container Inspect: {}", inspectContainerResponse.toString());
129-
130-
assertThat(inspectContainerResponse.getState().getRunning(), is(equalTo(false)));
131124
}
132125
}

src/test/java/com/github/dockerjava/netty/exec/WaitContainerCmdExecTest.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public void testWaitContainerAbort() throws Exception {
109109
@Test
110110
public void testWaitContainerTimeout() throws Exception {
111111

112-
CreateContainerResponse container = dockerClient.createContainerCmd("busybox").withCmd("sleep", "9999").exec();
112+
CreateContainerResponse container = dockerClient.createContainerCmd("busybox").withCmd("sleep", "10").exec();
113113

114114
LOG.info("Created container: {}", container.toString());
115115
assertThat(container.getId(), not(isEmptyString()));
@@ -124,12 +124,5 @@ public void testWaitContainerTimeout() throws Exception {
124124
} catch(DockerClientException e){
125125
LOG.info(e.getMessage());
126126
}
127-
128-
dockerClient.killContainerCmd(container.getId()).exec();
129-
130-
InspectContainerResponse inspectContainerResponse = dockerClient.inspectContainerCmd(container.getId()).exec();
131-
LOG.info("Container Inspect: {}", inspectContainerResponse.toString());
132-
133-
assertThat(inspectContainerResponse.getState().getRunning(), is(equalTo(false)));
134127
}
135128
}

0 commit comments

Comments
 (0)