forked from docker-java/docker-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSaveImagesCmdIT.java
More file actions
52 lines (42 loc) · 1.58 KB
/
Copy pathSaveImagesCmdIT.java
File metadata and controls
52 lines (42 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package com.github.dockerjava.cmd;
import org.apache.commons.io.IOUtils;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.InputStream;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.not;
public class SaveImagesCmdIT extends CmdIT {
public static final Logger LOG = LoggerFactory.getLogger(SaveImagesCmdIT.class);
@Test
public void saveNoImages() throws Exception {
try (
InputStream inputStream = dockerRule.getClient().saveImagesCmd().exec();
InputStream image = IOUtils.toBufferedInputStream(inputStream)
){
assertThat(image.read(), not(-1));
}
}
@Test
public void saveImagesWithNameAndTag() throws Exception {
try (
InputStream inputStream = dockerRule.getClient().saveImagesCmd().withImage("busybox", "latest").exec();
InputStream image = IOUtils.toBufferedInputStream(inputStream)
) {
assertThat(image.read(), not(-1));
}
}
@Test
public void saveMultipleImages() throws Exception {
try (
InputStream inputStream = dockerRule.getClient().saveImagesCmd()
// Not a real life use-case but "busybox" is the only one I dare to assume is really there.
.withImage("busybox", "latest")
.withImage("busybox", "latest")
.exec();
InputStream image = IOUtils.toBufferedInputStream(inputStream)
) {
assertThat(image.read(), not(-1));
}
}
}