tests: Remove docker dependency from extend tests

This commit removes the dependency on Docker by using raw disks and
appending from /dev/zero to extend them once initially formatted.

Additionally, the tests now use unique ${NAME} variables

Signed-off-by: Dave Tucker <dt@docker.com>
This commit is contained in:
Dave Tucker 2017-08-08 12:33:42 +01:00
parent 9a562a3b8c
commit e17a12219a
10 changed files with 16 additions and 37 deletions

View File

@ -1,2 +0,0 @@
FROM alpine:3.6
RUN apk add --no-cache qemu-img sfdisk e2fsprogs util-linux

View File

@ -1,3 +0,0 @@
#!/bin/sh
set -ex
qemu-img resize -f qcow2 "$1" +256M

View File

@ -9,24 +9,22 @@ set -ex
#. "${RT_LIB}" #. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh" . "${RT_PROJECT_ROOT}/_lib/lib.sh"
NAME=test-extend NAME=test-extend-ext4
DISK=disk0.img DISK=disk0.img
clean_up() { clean_up() {
find . -depth -iname "${NAME}*" -not -iname "*.yml" -exec rm -rf {} \; find . -depth -iname "${NAME}*" -not -iname "*.yml" -exec rm -rf {} \;
rm -rf "create*" || true
rm -rf ${DISK} || true rm -rf ${DISK} || true
docker rmi ${NAME} || true
} }
trap clean_up EXIT trap clean_up EXIT
# Test code goes here # Test code goes here
rm -rf ${DISK} || true
docker build -t ${NAME} .
moby build --name create -output kernel+initrd test-create.yml moby build --name create -output kernel+initrd test-create.yml
linuxkit run -disk file=${DISK},size=256M create linuxkit run -disk file=${DISK},format=raw,size=256M create
rm -rf "create*"
[ -f ${DISK} ] || exit 1 [ -f ${DISK} ] || exit 1
docker run -i --rm --privileged -v "$PWD:/tmp" -w /tmp ${NAME} ./extend.sh ${DISK} # osx takes issue with bs=1M
dd if=/dev/zero bs=1048576 count=256 >> ${DISK}
moby build -name ${NAME} -output kernel+initrd test.yml moby build -name ${NAME} -output kernel+initrd test.yml
RESULT="$(linuxkit run -disk file=${DISK} ${NAME})" RESULT="$(linuxkit run -disk file=${DISK} ${NAME})"
echo "${RESULT}" echo "${RESULT}"

View File

@ -1,2 +0,0 @@
FROM alpine:3.6
RUN apk add --no-cache qemu-img sfdisk e2fsprogs util-linux

View File

@ -1,3 +0,0 @@
#!/bin/sh
set -ex
qemu-img resize -f qcow2 "$1" +256M

View File

@ -9,24 +9,22 @@ set -ex
#. "${RT_LIB}" #. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh" . "${RT_PROJECT_ROOT}/_lib/lib.sh"
NAME=test-extend NAME=test-extend-btrfs
DISK=disk0.img DISK=disk0.img
clean_up() { clean_up() {
find . -depth -iname "${NAME}*" -not -iname "*.yml" -exec rm -rf {} \; find . -depth -iname "${NAME}*" -not -iname "*.yml" -exec rm -rf {} \;
rm -rf "create*" || true
rm -rf ${DISK} || true rm -rf ${DISK} || true
docker rmi ${NAME} || true
} }
trap clean_up EXIT trap clean_up EXIT
# Test code goes here # Test code goes here
rm -rf disk0.img || true
docker build -t ${NAME} .
moby build --name create -output kernel+initrd test-create.yml moby build --name create -output kernel+initrd test-create.yml
linuxkit run -disk file=${DISK},size=256M create linuxkit run -disk file=${DISK},format=raw,size=256M create
rm -rf "create*"
[ -f ${DISK} ] || exit 1 [ -f ${DISK} ] || exit 1
docker run -i --rm --privileged -v "$PWD:/tmp" -w /tmp ${NAME} ./extend.sh ${DISK} # osx takes issue with bs=1M
dd if=/dev/zero bs=1048576 count=256 >> ${DISK}
moby build -name ${NAME} -output kernel+initrd test.yml moby build -name ${NAME} -output kernel+initrd test.yml
RESULT="$(linuxkit run -disk file=${DISK} ${NAME})" RESULT="$(linuxkit run -disk file=${DISK} ${NAME})"
echo "${RESULT}" echo "${RESULT}"

View File

@ -1,2 +0,0 @@
FROM alpine:3.6
RUN apk add --no-cache qemu-img sfdisk e2fsprogs util-linux

View File

@ -9,5 +9,5 @@ function failed {
[ -f /var/lib/docker/bar ] || failed [ -f /var/lib/docker/bar ] || failed
touch /var/lib/docker/foo || failed touch /var/lib/docker/foo || failed
df -h | grep -q "507.7M" || failed df -h | grep -q "504.8M" || failed
printf "extend test suite PASSED\n" >&1 printf "extend test suite PASSED\n" >&1

View File

@ -1,3 +0,0 @@
#!/bin/sh
set -ex
qemu-img resize -f qcow2 "$1" +256M

View File

@ -9,24 +9,22 @@ set -ex
#. "${RT_LIB}" #. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh" . "${RT_PROJECT_ROOT}/_lib/lib.sh"
NAME=test-extend NAME=test-extend-xfs
DISK=disk0.img DISK=disk0.img
clean_up() { clean_up() {
find . -depth -iname "${NAME}*" -not -iname "*.yml" -exec rm -rf {} \; find . -depth -iname "${NAME}*" -not -iname "*.yml" -exec rm -rf {} \;
rm -rf "create*" || true
rm -rf ${DISK} || true rm -rf ${DISK} || true
docker rmi ${NAME} || true
} }
trap clean_up EXIT trap clean_up EXIT
# Test code goes here # Test code goes here
rm -rf disk0.img || true
docker build -t ${NAME} .
moby build --name create -output kernel+initrd test-create.yml moby build --name create -output kernel+initrd test-create.yml
linuxkit run -disk file=${DISK},size=256M create linuxkit run -disk file=${DISK},format=raw,size=256M create
rm -rf "create*"
[ -f ${DISK} ] || exit 1 [ -f ${DISK} ] || exit 1
docker run -i --rm --privileged -v "$PWD:/tmp" -w /tmp ${NAME} ./extend.sh ${DISK} # osx takes issue with bs=1M
dd if=/dev/zero bs=1048576 count=256 >> ${DISK}
moby build -name ${NAME} -output kernel+initrd test.yml moby build -name ${NAME} -output kernel+initrd test.yml
RESULT="$(linuxkit run -disk file=${DISK} ${NAME})" RESULT="$(linuxkit run -disk file=${DISK} ${NAME})"
echo "${RESULT}" echo "${RESULT}"