mirror of https://github.com/docker/docs.git
add import integration test
Signed-off-by: Xian Chaobo <xianchaobo@huawei.com>
This commit is contained in:
parent
1f20358b5d
commit
f63bafc7c5
|
@ -7,7 +7,37 @@ function teardown() {
|
|||
stop_docker
|
||||
}
|
||||
|
||||
# FIXME
|
||||
@test "docker import" {
|
||||
skip
|
||||
start_docker_with_busybox 2
|
||||
swarm_manage
|
||||
# run a container to export
|
||||
docker_swarm run -d --name test_container busybox sleep 500
|
||||
|
||||
temp_file_name=$(mktemp)
|
||||
# make sure container exists
|
||||
run docker_swarm ps -l
|
||||
[ "${#lines[@]}" -eq 2 ]
|
||||
[[ "${lines[1]}" == *"test_container"* ]]
|
||||
|
||||
# export, container->tar
|
||||
docker_swarm export test_container > $temp_file_name
|
||||
|
||||
# verify: exported file exists, not empty and is tar file
|
||||
[ -s $temp_file_name ]
|
||||
run file $temp_file_name
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" == *"tar archive"* ]]
|
||||
|
||||
# import
|
||||
docker_swarm import - testbusybox < $temp_file_name
|
||||
|
||||
# verify on the nodes
|
||||
for host in ${HOSTS[@]}; do
|
||||
run docker -H $host images
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "${output}" == *"testbusybox"* ]]
|
||||
done
|
||||
|
||||
# after ok, delete exported tar file
|
||||
rm -f $temp_file_name
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue