Skip to content

Commit 2f35bed

Browse files
committed
Condition test
1 parent c4e2084 commit 2f35bed

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

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

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

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

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

0 commit comments

Comments
 (0)