Skip to content

Commit b05b1bb

Browse files
committed
Small test fixes
1 parent 5139cd8 commit b05b1bb

File tree

2 files changed

+7
-22
lines changed

2 files changed

+7
-22
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,19 +148,18 @@ public void createContainerWithVolumesFrom() throws DockerException {
148148
String container1Name = UUID.randomUUID().toString();
149149
CreateVolumeResponse volume1Info = dockerRule.getClient().createVolumeCmd().exec();
150150
CreateVolumeResponse volume2Info = dockerRule.getClient().createVolumeCmd().exec();
151-
String mountpoint1 = volume1Info.getMountpoint();
152-
String mountpoint2 = volume2Info.getMountpoint();
153-
Volume volume1 = new Volume(mountpoint1);
154-
Volume volume2 = new Volume(mountpoint2);
155151

156-
Bind bind1 = new Bind("/src/webapp1", volume1);
157-
Bind bind2 = new Bind("/src/webapp2", volume2);
152+
Volume volume1 = new Volume("/src/webapp1");
153+
Volume volume2 = new Volume("/src/webapp2");
154+
Bind bind1 = new Bind(volume1Info.getName(), volume1);
155+
Bind bind2 = new Bind(volume2Info.getName(), volume2);
158156

159157
// create a running container with bind mounts
160158
CreateContainerResponse container1 = dockerRule.getClient().createContainerCmd(DEFAULT_IMAGE)
161159
.withCmd("sleep", "9999")
162160
.withName(container1Name)
163-
.withBinds(bind1, bind2).exec();
161+
.withBinds(bind1, bind2)
162+
.exec();
164163

165164
LOG.info("Created container1 {}", container1.toString());
166165

@@ -185,6 +184,7 @@ public void createContainerWithVolumesFrom() throws DockerException {
185184
// No volumes are created, the information is just stored in .HostConfig.VolumesFrom
186185
assertThat(inspectContainerResponse2.getHostConfig().getVolumesFrom(),
187186
hasItemInArray(new VolumesFrom(container1Name)));
187+
assertThat(inspectContainerResponse1, mountedVolumes(containsInAnyOrder(volume1, volume2)));
188188

189189
// To ensure that the information stored in VolumesFrom really is considered
190190
// when starting the container, we start it and verify that it has the same

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

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import com.github.dockerjava.api.model.Info;
1111
import com.github.dockerjava.api.model.PullResponseItem;
1212
import com.github.dockerjava.core.RemoteApiVersion;
13-
import com.github.dockerjava.core.command.PullImageCmdImpl;
1413
import com.github.dockerjava.core.command.PullImageResultCallback;
1514
import com.github.dockerjava.utils.RegistryUtils;
1615
import org.junit.Rule;
@@ -26,7 +25,6 @@
2625
import static org.hamcrest.MatcherAssert.assertThat;
2726
import static org.hamcrest.Matchers.lessThanOrEqualTo;
2827
import static org.hamcrest.Matchers.notNullValue;
29-
import static org.junit.Assert.assertEquals;
3028

3129
public class PullImageCmdIT extends CmdIT {
3230
private static final Logger LOG = LoggerFactory.getLogger(PullImageCmdIT.class);
@@ -40,19 +38,6 @@ public Void exec(PullImageCmd command, ResultCallback<PullResponseItem> resultCa
4038
};
4139
};
4240

43-
@Test
44-
public void nullAuthConfig() throws Exception {
45-
PullImageCmdImpl pullImageCmd = new PullImageCmdImpl(NOP_EXEC, null, "");
46-
try {
47-
pullImageCmd.withAuthConfig(null);
48-
throw new AssertionError();
49-
} catch (Exception e) {
50-
assertEquals(e.getMessage(), "authConfig was not specified");
51-
} finally {
52-
pullImageCmd.close();
53-
}
54-
}
55-
5641
@Test
5742
public void testPullImage() throws Exception {
5843
Info info = dockerRule.getClient().infoCmd().exec();

0 commit comments

Comments
 (0)