Skip to content

Commit fe2c5ee

Browse files
committed
More Test fixes
1 parent cc0b2e0 commit fe2c5ee

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

src/test/java/com/github/dockerjava/cmd/PullImageCmdIT.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ public void testPullImageWithNoAuth() throws Exception {
132132

133133
String imgName = RegistryUtils.createPrivateImage(dockerRule, "pull-image-with-no-auth");
134134

135-
if (isNotSwarm(dockerRule.getClient())) {
135+
if (isNotSwarm(dockerRule.getClient()) && getVersion(dockerRule.getClient())
136+
.isGreater(RemoteApiVersion.VERSION_1_27)) {
136137
exception.expect(InternalServerErrorException.class);
137138
} else {
138139
exception.expect(DockerClientException.class);
@@ -156,7 +157,8 @@ public void testPullImageWithInvalidAuth() throws Exception {
156157

157158
String imgName = RegistryUtils.createPrivateImage(dockerRule, "pull-image-with-invalid-auth");
158159

159-
if (isNotSwarm(dockerRule.getClient())) {
160+
if (isNotSwarm(dockerRule.getClient()) && getVersion(dockerRule.getClient())
161+
.isGreater(RemoteApiVersion.VERSION_1_27)) {
160162
exception.expect(InternalServerErrorException.class);
161163
} else {
162164
exception.expect(DockerClientException.class);

src/test/java/com/github/dockerjava/core/util/CertificateUtilsTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import org.junit.BeforeClass;
66
import org.junit.Test;
77

8+
import java.io.File;
89
import java.io.IOException;
910
import java.nio.file.Files;
1011
import java.nio.file.Paths;
@@ -86,6 +87,6 @@ public void readMultipleCaCerts() throws Exception {
8687
}
8788

8889
private String readFileAsString(String path) throws IOException {
89-
return new String(Files.readAllBytes(Paths.get(baseDir + path)));
90+
return new String(Files.readAllBytes(Paths.get(new File(baseDir + path).getPath())));
9091
}
9192
}

src/test/java/com/github/dockerjava/utils/RegistryUtils.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,12 @@ public static String createPrivateImage(DockerRule dockerRule, String tagName) t
9797
.exec(new PushImageResultCallback())
9898
.awaitCompletion(30, TimeUnit.SECONDS);
9999

100-
Thread.sleep(5000); //ensures that the image is also purged from the swarm cache
101100
dockerRule.getClient().removeImageCmd(imgNameWithTag)
102101
.exec();
103102

103+
//ensures that the image is available
104+
Thread.sleep(5000);
105+
104106
return imgNameWithTag;
105107
}
106108

0 commit comments

Comments
 (0)