X Tutup
Skip to content

Commit e149bee

Browse files
committed
Condition test
1 parent 5400925 commit e149bee

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,19 @@ public void inspectExecNetworkSettings() throws IOException {
120120
assertThat(exec.getId(), not(isEmptyString()));
121121

122122
InspectExecResponse inspectExecResponse = dockerClient.inspectExecCmd(exec.getId()).exec();
123-
assertThat(inspectExecResponse.getExitCode(), is(nullValue()));
123+
124+
if (apiVersion.isGreaterOrEqual(RemoteApiVersion.VERSION_1_22)) {
125+
assertThat(inspectExecResponse.getExitCode(), is(nullValue()));
126+
assertThat(inspectExecResponse.getCanRemove(), is(false));
127+
assertThat(inspectExecResponse.getContainerID(), is(container.getId()));
128+
} else {
129+
assertThat(inspectExecResponse.getExitCode(), is(0));
130+
assertNotNull(inspectExecResponse.getContainer().getNetworkSettings().getNetworks().get("bridge"));
131+
}
132+
124133
assertThat(inspectExecResponse.isOpenStdin(), is(false));
125134
assertThat(inspectExecResponse.isOpenStdout(), is(true));
126135
assertThat(inspectExecResponse.isRunning(), is(false));
127-
assertThat(inspectExecResponse.getCanRemove(), is(false));
128-
assertThat(inspectExecResponse.getContainerID(), is(container.getId()));
129136

130137
final InspectExecResponse.Container inspectContainer = inspectExecResponse.getContainer();
131138
if (apiVersion.isGreaterOrEqual(VERSION_1_22)) {

0 commit comments

Comments
 (0)
X Tutup