Merge pull request #841 from baude/kpod_pull_name
libkpod/image/copy.go: Add pull by short-name
This commit is contained in:
commit
dbc2b404a3
8 changed files with 274 additions and 67 deletions
|
@ -59,6 +59,9 @@ PIDS_LIMIT=${PIDS_LIMIT:-1024}
|
|||
|
||||
TESTDIR=$(mktemp -d)
|
||||
|
||||
# kpod pull needs a configuration file for shortname pulls
|
||||
export REGISTRIES_CONFIG_PATH="$INTEGRATION_ROOT/registries.conf"
|
||||
|
||||
# Setup default hooks dir
|
||||
HOOKSDIR=$TESTDIR/hooks
|
||||
mkdir ${HOOKSDIR}
|
||||
|
|
|
@ -17,52 +17,6 @@ function teardown() {
|
|||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "kpod pull from docker with tag" {
|
||||
run ${KPOD_BINARY} ${KPOD_OPTIONS} pull debian:6.0.10
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ${KPOD_BINARY} $KPOD_OPTIONS rmi debian:6.0.10
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "kpod pull from docker without tag" {
|
||||
run ${KPOD_BINARY} $KPOD_OPTIONS pull debian
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ${KPOD_BINARY} $KPOD_OPTIONS rmi debian
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "kpod pull from a non-docker registry with tag" {
|
||||
run ${KPOD_BINARY} $KPOD_OPTIONS pull registry.fedoraproject.org/fedora:rawhide
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ${KPOD_BINARY} $KPOD_OPTIONS rmi registry.fedoraproject.org/fedora:rawhide
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "kpod pull from a non-docker registry without tag" {
|
||||
run ${KPOD_BINARY} $KPOD_OPTIONS pull registry.fedoraproject.org/fedora
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ${KPOD_BINARY} $KPOD_OPTIONS rmi registry.fedoraproject.org/fedora
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "kpod pull using digest" {
|
||||
run ${KPOD_BINARY} $KPOD_OPTIONS pull alpine@sha256:1072e499f3f655a032e88542330cf75b02e7bdf673278f701d7ba61629ee3ebe
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ${KPOD_BINARY} $KPOD_OPTIONS rmi alpine:latest
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "kpod pull from a non existent image" {
|
||||
run ${KPOD_BINARY} $KPOD_OPTIONS pull umohnani/get-started
|
||||
echo "$output"
|
||||
[ "$status" -ne 0 ]
|
||||
}
|
||||
|
||||
@test "kpod history default" {
|
||||
run ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE
|
||||
[ "$status" -eq 0 ]
|
||||
|
|
74
test/kpod_pull.bats
Normal file
74
test/kpod_pull.bats
Normal file
|
@ -0,0 +1,74 @@
|
|||
#!/usr/bin/env bats
|
||||
|
||||
load helpers
|
||||
|
||||
IMAGE="alpine:latest"
|
||||
ROOT="$TESTDIR/crio"
|
||||
RUNROOT="$TESTDIR/crio-run"
|
||||
KPOD_OPTIONS="--root $ROOT --runroot $RUNROOT ${STORAGE_OPTS}"
|
||||
|
||||
function teardown() {
|
||||
cleanup_test
|
||||
}
|
||||
|
||||
@test "kpod pull from docker with tag" {
|
||||
run ${KPOD_BINARY} ${KPOD_OPTIONS} pull debian:6.0.10
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ${KPOD_BINARY} $KPOD_OPTIONS rmi debian:6.0.10
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "kpod pull from docker without tag" {
|
||||
run ${KPOD_BINARY} $KPOD_OPTIONS pull debian
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ${KPOD_BINARY} $KPOD_OPTIONS rmi debian
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "kpod pull from a non-docker registry with tag" {
|
||||
run ${KPOD_BINARY} $KPOD_OPTIONS pull registry.fedoraproject.org/fedora:rawhide
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ${KPOD_BINARY} $KPOD_OPTIONS rmi registry.fedoraproject.org/fedora:rawhide
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "kpod pull from a non-docker registry without tag" {
|
||||
run ${KPOD_BINARY} $KPOD_OPTIONS pull registry.fedoraproject.org/fedora
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ${KPOD_BINARY} $KPOD_OPTIONS rmi registry.fedoraproject.org/fedora
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "kpod pull using digest" {
|
||||
run ${KPOD_BINARY} $KPOD_OPTIONS pull alpine@sha256:1072e499f3f655a032e88542330cf75b02e7bdf673278f701d7ba61629ee3ebe
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ${KPOD_BINARY} $KPOD_OPTIONS rmi alpine:latest
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "kpod pull from a non existent image" {
|
||||
run ${KPOD_BINARY} $KPOD_OPTIONS pull umohnani/get-started
|
||||
echo "$output"
|
||||
[ "$status" -ne 0 ]
|
||||
}
|
||||
|
||||
@test "kpod pull from docker with shortname" {
|
||||
run ${KPOD_BINARY} ${KPOD_OPTIONS} pull debian
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ${KPOD_BINARY} $KPOD_OPTIONS rmi docker.io/debian:latest
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "kpod pull from docker with shortname and tag" {
|
||||
run ${KPOD_BINARY} ${KPOD_OPTIONS} pull debian:6.0.10
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ${KPOD_BINARY} $KPOD_OPTIONS rmi docker.io/debian:6.0.10
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
9
test/registries.conf
Normal file
9
test/registries.conf
Normal file
|
@ -0,0 +1,9 @@
|
|||
[registries.search]
|
||||
registries = ['registry.access.redhat.com', 'registry.fedoraproject.org', 'docker.io']
|
||||
|
||||
[registries.insecure]
|
||||
registries = []
|
||||
|
||||
#blocked (docker only)
|
||||
[registries.block]
|
||||
registries = []
|
Loading…
Add table
Add a link
Reference in a new issue