Skip to content

Commit af891e2

Browse files
committed
Fix test for 1.24
1 parent a68cf85 commit af891e2

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

src/main/java/com/github/dockerjava/api/DockerClient.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ public interface DockerClient extends Closeable {
170170
* @return created command
171171
* @see #copyArchiveFromContainerCmd(String, String)
172172
* @deprecated since docker API version 1.20, replaced by {@link #copyArchiveFromContainerCmd(String, String)}
173+
* since 1.24 fails.
173174
*/
174175
@Deprecated
175176
CopyFileFromContainerCmd copyFileFromContainerCmd(@Nonnull String containerId, @Nonnull String resource);

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
package com.github.dockerjava.core.command;
22

3+
import static com.github.dockerjava.utils.TestUtils.getVersion;
34
import static org.hamcrest.MatcherAssert.assertThat;
45
import static org.hamcrest.Matchers.isEmptyOrNullString;
56
import static org.hamcrest.Matchers.not;
67

78
import java.io.InputStream;
89
import java.lang.reflect.Method;
910

11+
import com.github.dockerjava.core.RemoteApiVersion;
12+
import com.github.dockerjava.utils.TestUtils;
1013
import org.testng.ITestResult;
14+
import org.testng.SkipException;
1115
import org.testng.annotations.AfterMethod;
1216
import org.testng.annotations.AfterTest;
1317
import org.testng.annotations.BeforeMethod;
@@ -43,6 +47,10 @@ public void afterMethod(ITestResult result) {
4347

4448
@Test
4549
public void copyFromContainer() throws Exception {
50+
if (getVersion(dockerClient).isGreaterOrEqual(RemoteApiVersion.VERSION_1_24)) {
51+
throw new SkipException("Doesn't work since 1.24");
52+
}
53+
4654
// TODO extract this into a shared method
4755
CreateContainerResponse container = dockerClient.createContainerCmd("busybox")
4856
.withName("docker-java-itest-copyFromContainer").withCmd("touch", "/copyFromContainer").exec();

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
package com.github.dockerjava.netty.exec;
22

3+
import static com.github.dockerjava.utils.TestUtils.getVersion;
34
import static org.hamcrest.MatcherAssert.assertThat;
45
import static org.hamcrest.Matchers.isEmptyOrNullString;
56
import static org.hamcrest.Matchers.not;
67

78
import java.io.InputStream;
89
import java.lang.reflect.Method;
910

11+
import com.github.dockerjava.core.RemoteApiVersion;
1012
import org.testng.ITestResult;
13+
import org.testng.SkipException;
1114
import org.testng.annotations.AfterMethod;
1215
import org.testng.annotations.AfterTest;
1316
import org.testng.annotations.BeforeMethod;
@@ -43,6 +46,10 @@ public void afterMethod(ITestResult result) {
4346

4447
@Test
4548
public void copyFromContainer() throws Exception {
49+
if (getVersion(dockerClient).isGreaterOrEqual(RemoteApiVersion.VERSION_1_24)) {
50+
throw new SkipException("Doesn't work since 1.24");
51+
}
52+
4653
// TODO extract this into a shared method
4754
CreateContainerResponse container = dockerClient.createContainerCmd("busybox")
4855
.withName("docker-java-itest-copyFromContainer").withCmd("touch", "/copyFromContainer").exec();

0 commit comments

Comments
 (0)