mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-19 17:26:28 +00:00
tests: Add test cases for format, mount and extend pkgs
This commit adds a myriad of test cases to ensure the format and mount and extend packages are working as expected Signed-off-by: Dave Tucker <dt@docker.com>
This commit is contained in:
parent
8dcb57429a
commit
6f80f53ea1
10
test/cases/040_packages/008_format_mount/000_auto/check.sh
Executable file
10
test/cases/040_packages/008_format_mount/000_auto/check.sh
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
function failed {
|
||||
printf "format_mount test suite FAILED\n" >&1
|
||||
exit 1
|
||||
}
|
||||
|
||||
touch /var/lib/docker/foo || failed
|
||||
|
||||
printf "format_mount test suite PASSED\n" >&1
|
26
test/cases/040_packages/008_format_mount/000_auto/test.sh
Normal file
26
test/cases/040_packages/008_format_mount/000_auto/test.sh
Normal file
@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
# SUMMARY: Check that a disk can be formatted and mounted
|
||||
# LABELS:
|
||||
# REPEAT:
|
||||
|
||||
set -e
|
||||
|
||||
# Source libraries. Uncomment if needed/defined
|
||||
#. "${RT_LIB}"
|
||||
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
|
||||
|
||||
NAME=test-format
|
||||
|
||||
clean_up() {
|
||||
find . -depth -iname "${NAME}*" -not -iname "*.yml" -exec rm -rf {} \;
|
||||
}
|
||||
|
||||
trap clean_up EXIT
|
||||
|
||||
# Test code goes here
|
||||
moby build -name ${NAME} -output kernel+initrd test.yml
|
||||
RESULT="$(linuxkit run -disk file=${NAME}1.img,size=512M ${NAME})"
|
||||
echo "${RESULT}"
|
||||
echo "${RESULT}" | grep -q "suite PASSED"
|
||||
|
||||
exit 0
|
30
test/cases/040_packages/008_format_mount/000_auto/test.yml
Normal file
30
test/cases/040_packages/008_format_mount/000_auto/test.yml
Normal file
@ -0,0 +1,30 @@
|
||||
kernel:
|
||||
image: linuxkit/kernel:4.9.39
|
||||
cmdline: "console=ttyS0"
|
||||
init:
|
||||
- linuxkit/init:838b772355a8690143b37de1cdd4ac5db725271f
|
||||
- linuxkit/runc:d5cbeb95bdafedb82ad2cf11cff1a5da7fcae630
|
||||
onboot:
|
||||
- name: format
|
||||
image: linuxkit/format:efafddf9bc6165b5efaf09c532c15a1100a10e61
|
||||
command: ["/usr/bin/format"]
|
||||
- name: mount
|
||||
image: linuxkit/mount:54990a6a69cb3ead4da8a9c1f0b651e27aea8d3f
|
||||
command: ["/usr/bin/mountie", "/var/lib/docker"]
|
||||
- name: test
|
||||
image: alpine:3.6
|
||||
readonly: true
|
||||
binds:
|
||||
- /var/lib/docker:/var/lib/docker
|
||||
- /check.sh:/check.sh
|
||||
command: ["sh", "./check.sh"]
|
||||
- name: poweroff
|
||||
image: linuxkit/poweroff:bce51402e293da0b653923a43c3c7be6e0effa05
|
||||
command: ["/bin/sh", "/poweroff.sh", "10"]
|
||||
files:
|
||||
- path: check.sh
|
||||
source: ./check.sh
|
||||
trust:
|
||||
org:
|
||||
- linuxkit
|
||||
- library
|
10
test/cases/040_packages/008_format_mount/001_by_label/check.sh
Executable file
10
test/cases/040_packages/008_format_mount/001_by_label/check.sh
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
function failed {
|
||||
printf "format_mount test suite FAILED\n" >&1
|
||||
exit 1
|
||||
}
|
||||
|
||||
touch /var/lib/docker/foo || failed
|
||||
|
||||
printf "format_mount test suite PASSED\n" >&1
|
@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
# SUMMARY: Check that a formatted disk can be mounted by label
|
||||
# LABELS:
|
||||
# REPEAT:
|
||||
|
||||
set -e
|
||||
|
||||
# Source libraries. Uncomment if needed/defined
|
||||
#. "${RT_LIB}"
|
||||
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
|
||||
|
||||
NAME=test-format
|
||||
|
||||
clean_up() {
|
||||
find . -depth -iname "${NAME}*" -not -iname "*.yml" -exec rm -rf {} \;
|
||||
}
|
||||
|
||||
trap clean_up EXIT
|
||||
|
||||
# Test code goes here
|
||||
moby build -name ${NAME} -output kernel+initrd test.yml
|
||||
RESULT="$(linuxkit run -disk file=${NAME}1.img,size=512M ${NAME})"
|
||||
echo "${RESULT}"
|
||||
echo "${RESULT}" | grep -q "suite PASSED"
|
||||
|
||||
exit 0
|
@ -0,0 +1,30 @@
|
||||
kernel:
|
||||
image: linuxkit/kernel:4.9.39
|
||||
cmdline: "console=ttyS0"
|
||||
init:
|
||||
- linuxkit/init:838b772355a8690143b37de1cdd4ac5db725271f
|
||||
- linuxkit/runc:d5cbeb95bdafedb82ad2cf11cff1a5da7fcae630
|
||||
onboot:
|
||||
- name: format
|
||||
image: linuxkit/format:efafddf9bc6165b5efaf09c532c15a1100a10e61
|
||||
command: ["/usr/bin/format", "-label", "docker"]
|
||||
- name: mount
|
||||
image: linuxkit/mount:54990a6a69cb3ead4da8a9c1f0b651e27aea8d3f
|
||||
command: ["/usr/bin/mountie", "-label", "docker", "/var/lib/docker"]
|
||||
- name: test
|
||||
image: alpine:3.6
|
||||
readonly: true
|
||||
binds:
|
||||
- /var/lib/docker:/var/lib/docker
|
||||
- /check.sh:/check.sh
|
||||
command: ["sh", "./check.sh"]
|
||||
- name: poweroff
|
||||
image: linuxkit/poweroff:bce51402e293da0b653923a43c3c7be6e0effa05
|
||||
command: ["/bin/sh", "/poweroff.sh", "10"]
|
||||
files:
|
||||
- path: check.sh
|
||||
source: ./check.sh
|
||||
trust:
|
||||
org:
|
||||
- linuxkit
|
||||
- library
|
1
test/cases/040_packages/008_format_mount/002_by_name/.gitignore
vendored
Normal file
1
test/cases/040_packages/008_format_mount/002_by_name/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
test.yml
|
10
test/cases/040_packages/008_format_mount/002_by_name/check.sh
Executable file
10
test/cases/040_packages/008_format_mount/002_by_name/check.sh
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
function failed {
|
||||
printf "format_mount test suite FAILED\n" >&1
|
||||
exit 1
|
||||
}
|
||||
|
||||
touch /var/lib/docker/foo || failed
|
||||
|
||||
printf "format_mount test suite PASSED\n" >&1
|
33
test/cases/040_packages/008_format_mount/002_by_name/test.sh
Normal file
33
test/cases/040_packages/008_format_mount/002_by_name/test.sh
Normal file
@ -0,0 +1,33 @@
|
||||
#!/bin/sh
|
||||
# SUMMARY: Check that a formatted disk can be mounted by name
|
||||
# LABELS:
|
||||
# REPEAT:
|
||||
|
||||
set -e
|
||||
|
||||
# Source libraries. Uncomment if needed/defined
|
||||
#. "${RT_LIB}"
|
||||
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
|
||||
|
||||
NAME=test-format
|
||||
|
||||
clean_up() {
|
||||
find . -depth -iname "${NAME}*" -not -iname "*.yml" -exec rm -rf {} \;
|
||||
rm -rf test.yml || true
|
||||
}
|
||||
|
||||
trap clean_up EXIT
|
||||
# Test code goes here
|
||||
if [ "${RT_OS}" = "osx" ]; then
|
||||
DEVICE="/dev/vda"
|
||||
else
|
||||
DEVICE="/dev/sda"
|
||||
fi
|
||||
|
||||
sed -e "s,@DEVICE@,${DEVICE},g" test.yml.orig > test.yml
|
||||
moby build -name ${NAME} -output kernel+initrd test.yml
|
||||
RESULT="$(linuxkit run -disk file=${NAME}1.img,size=512M ${NAME})"
|
||||
echo "${RESULT}"
|
||||
echo "${RESULT}" | grep -q "suite PASSED"
|
||||
|
||||
exit 0
|
@ -0,0 +1,30 @@
|
||||
kernel:
|
||||
image: linuxkit/kernel:4.9.38
|
||||
cmdline: "console=ttyS0 page_poison=1"
|
||||
init:
|
||||
- linuxkit/init:059b2bb4b6efa5c58cf53fed4d0ea863521959fc
|
||||
- linuxkit/runc:4a35484aa6f90a1f06cdf1fb36f7056926a084b9
|
||||
onboot:
|
||||
- name: format
|
||||
image: linuxkit/format:efafddf9bc6165b5efaf09c532c15a1100a10e61
|
||||
command: ["/usr/bin/format", "@DEVICE@"]
|
||||
- name: mount
|
||||
image: linuxkit/mount:54990a6a69cb3ead4da8a9c1f0b651e27aea8d3f
|
||||
command: ["/usr/bin/mountie", "-device", "@DEVICE@1", "/var/lib/docker"]
|
||||
- name: test
|
||||
image: alpine:3.6
|
||||
readonly: true
|
||||
binds:
|
||||
- /var/lib/docker:/var/lib/docker
|
||||
- /check.sh:/check.sh
|
||||
command: ["sh", "./check.sh"]
|
||||
- name: poweroff
|
||||
image: linuxkit/poweroff:bce51402e293da0b653923a43c3c7be6e0effa05
|
||||
command: ["/bin/sh", "/poweroff.sh", "10"]
|
||||
files:
|
||||
- path: check.sh
|
||||
source: ./check.sh
|
||||
trust:
|
||||
org:
|
||||
- linuxkit
|
||||
- library
|
10
test/cases/040_packages/008_format_mount/003_btrfs/check.sh
Executable file
10
test/cases/040_packages/008_format_mount/003_btrfs/check.sh
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
function failed {
|
||||
printf "format_mount test suite FAILED\n" >&1
|
||||
exit 1
|
||||
}
|
||||
|
||||
touch /var/lib/docker/foo || failed
|
||||
|
||||
printf "format_mount test suite PASSED\n" >&1
|
26
test/cases/040_packages/008_format_mount/003_btrfs/test.sh
Normal file
26
test/cases/040_packages/008_format_mount/003_btrfs/test.sh
Normal file
@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
# SUMMARY: Check that a btrfs formatted disk can be mounted
|
||||
# LABELS:
|
||||
# REPEAT:
|
||||
|
||||
set -e
|
||||
|
||||
# Source libraries. Uncomment if needed/defined
|
||||
#. "${RT_LIB}"
|
||||
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
|
||||
|
||||
NAME=test-format
|
||||
|
||||
clean_up() {
|
||||
find . -depth -iname "${NAME}*" -not -iname "*.yml" -exec rm -rf {} \;
|
||||
}
|
||||
|
||||
trap clean_up EXIT
|
||||
|
||||
# Test code goes here
|
||||
moby build -name ${NAME} -output kernel+initrd test.yml
|
||||
RESULT="$(linuxkit run -disk file=${NAME}1.img,size=512M ${NAME})"
|
||||
echo "${RESULT}"
|
||||
echo "${RESULT}" | grep -q "suite PASSED"
|
||||
|
||||
exit 0
|
37
test/cases/040_packages/008_format_mount/003_btrfs/test.yml
Normal file
37
test/cases/040_packages/008_format_mount/003_btrfs/test.yml
Normal file
@ -0,0 +1,37 @@
|
||||
kernel:
|
||||
image: linuxkit/kernel:4.9.39
|
||||
cmdline: "console=ttyS0"
|
||||
init:
|
||||
- linuxkit/init:838b772355a8690143b37de1cdd4ac5db725271f
|
||||
- linuxkit/runc:d5cbeb95bdafedb82ad2cf11cff1a5da7fcae630
|
||||
onboot:
|
||||
- name: modprobe
|
||||
image: alpine:3.6
|
||||
capabilities: [all]
|
||||
binds:
|
||||
- /lib/modules:/lib/modules
|
||||
- /sys:/sys
|
||||
command: ["modprobe", "btrfs"]
|
||||
- name: format
|
||||
image: linuxkit/format:efafddf9bc6165b5efaf09c532c15a1100a10e61
|
||||
command: ["/usr/bin/format", "-type", "btrfs" ]
|
||||
- name: mount
|
||||
image: linuxkit/mount:54990a6a69cb3ead4da8a9c1f0b651e27aea8d3f
|
||||
command: ["/usr/bin/mountie", "/var/lib/docker"]
|
||||
- name: test
|
||||
image: alpine:3.6
|
||||
readonly: true
|
||||
binds:
|
||||
- /var/lib/docker:/var/lib/docker
|
||||
- /check.sh:/check.sh
|
||||
command: ["sh", "./check.sh"]
|
||||
- name: poweroff
|
||||
image: linuxkit/poweroff:bce51402e293da0b653923a43c3c7be6e0effa05
|
||||
command: ["/bin/sh", "/poweroff.sh", "10"]
|
||||
files:
|
||||
- path: check.sh
|
||||
source: ./check.sh
|
||||
trust:
|
||||
org:
|
||||
- linuxkit
|
||||
- library
|
10
test/cases/040_packages/008_format_mount/004_xfs/check.sh
Executable file
10
test/cases/040_packages/008_format_mount/004_xfs/check.sh
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
function failed {
|
||||
printf "format_mount test suite FAILED\n" >&1
|
||||
exit 1
|
||||
}
|
||||
|
||||
touch /var/lib/docker/foo || failed
|
||||
|
||||
printf "format_mount test suite PASSED\n" >&1
|
26
test/cases/040_packages/008_format_mount/004_xfs/test.sh
Normal file
26
test/cases/040_packages/008_format_mount/004_xfs/test.sh
Normal file
@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
# SUMMARY: Check that an XFS formatted disk can be mounted
|
||||
# LABELS:
|
||||
# REPEAT:
|
||||
|
||||
set -e
|
||||
|
||||
# Source libraries. Uncomment if needed/defined
|
||||
#. "${RT_LIB}"
|
||||
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
|
||||
|
||||
NAME=test-format
|
||||
|
||||
clean_up() {
|
||||
find . -depth -iname "${NAME}*" -not -iname "*.yml" -exec rm -rf {} \;
|
||||
}
|
||||
|
||||
trap clean_up EXIT
|
||||
|
||||
# Test code goes here
|
||||
moby build -name ${NAME} -output kernel+initrd test.yml
|
||||
RESULT="$(linuxkit run -disk file=${NAME}1.img,size=512M ${NAME})"
|
||||
echo "${RESULT}"
|
||||
echo "${RESULT}" | grep -q "suite PASSED"
|
||||
|
||||
exit 0
|
30
test/cases/040_packages/008_format_mount/004_xfs/test.yml
Normal file
30
test/cases/040_packages/008_format_mount/004_xfs/test.yml
Normal file
@ -0,0 +1,30 @@
|
||||
kernel:
|
||||
image: linuxkit/kernel:4.9.39
|
||||
cmdline: "console=ttyS0"
|
||||
init:
|
||||
- linuxkit/init:838b772355a8690143b37de1cdd4ac5db725271f
|
||||
- linuxkit/runc:d5cbeb95bdafedb82ad2cf11cff1a5da7fcae630
|
||||
onboot:
|
||||
- name: format
|
||||
image: linuxkit/format:efafddf9bc6165b5efaf09c532c15a1100a10e61
|
||||
command: ["/usr/bin/format", "-type", "xfs" ]
|
||||
- name: mount
|
||||
image: linuxkit/mount:54990a6a69cb3ead4da8a9c1f0b651e27aea8d3f
|
||||
command: ["/usr/bin/mountie", "/var/lib/docker"]
|
||||
- name: test
|
||||
image: alpine:3.6
|
||||
readonly: true
|
||||
binds:
|
||||
- /var/lib/docker:/var/lib/docker
|
||||
- /check.sh:/check.sh
|
||||
command: ["sh", "./check.sh"]
|
||||
- name: poweroff
|
||||
image: linuxkit/poweroff:bce51402e293da0b653923a43c3c7be6e0effa05
|
||||
command: ["/bin/sh", "/poweroff.sh", "10"]
|
||||
files:
|
||||
- path: check.sh
|
||||
source: ./check.sh
|
||||
trust:
|
||||
org:
|
||||
- linuxkit
|
||||
- library
|
11
test/cases/040_packages/008_format_mount/010_multiple/check.sh
Executable file
11
test/cases/040_packages/008_format_mount/010_multiple/check.sh
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
function failed {
|
||||
printf "format_mount test suite FAILED\n" >&1
|
||||
exit 1
|
||||
}
|
||||
|
||||
touch /var/lib/docker/foo || failed
|
||||
touch /var/foo/bar || failed
|
||||
|
||||
printf "format_mount test suite PASSED\n" >&1
|
@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
# SUMMARY: Check that the format and mount packages work
|
||||
# LABELS:
|
||||
# REPEAT:
|
||||
|
||||
set -e
|
||||
|
||||
# Source libraries. Uncomment if needed/defined
|
||||
#. "${RT_LIB}"
|
||||
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
|
||||
|
||||
NAME=test-format
|
||||
|
||||
clean_up() {
|
||||
find . -depth -iname "${NAME}*" -not -iname "*.yml" -exec rm -rf {} \;
|
||||
}
|
||||
|
||||
trap clean_up EXIT
|
||||
|
||||
# Test code goes here
|
||||
moby build -name ${NAME} -output kernel+initrd test.yml
|
||||
RESULT="$(linuxkit run -disk file=${NAME}1.img,size=512M -disk file=${NAME}2.img,size=512M ${NAME})"
|
||||
echo "${RESULT}"
|
||||
echo "${RESULT}" | grep -q "suite PASSED"
|
||||
|
||||
exit 0
|
@ -0,0 +1,37 @@
|
||||
kernel:
|
||||
image: linuxkit/kernel:4.9.39
|
||||
cmdline: "console=ttyS0"
|
||||
init:
|
||||
- linuxkit/init:838b772355a8690143b37de1cdd4ac5db725271f
|
||||
- linuxkit/runc:d5cbeb95bdafedb82ad2cf11cff1a5da7fcae630
|
||||
onboot:
|
||||
- name: format
|
||||
image: linuxkit/format:efafddf9bc6165b5efaf09c532c15a1100a10e61
|
||||
command: ["/usr/bin/format", "-label", "docker"]
|
||||
- name: format
|
||||
image: linuxkit/format:efafddf9bc6165b5efaf09c532c15a1100a10e61
|
||||
command: ["/usr/bin/format", "-label", "foo"]
|
||||
- name: mount
|
||||
image: linuxkit/mount:54990a6a69cb3ead4da8a9c1f0b651e27aea8d3f
|
||||
command: ["/usr/bin/mountie", "-label", "docker", "/var/lib/docker"]
|
||||
- name: mount
|
||||
image: linuxkit/mount:54990a6a69cb3ead4da8a9c1f0b651e27aea8d3f
|
||||
command: ["/usr/bin/mountie", "-label", "foo", "/var/foo"]
|
||||
- name: test
|
||||
image: alpine:3.6
|
||||
readonly: true
|
||||
binds:
|
||||
- /var/lib/docker:/var/lib/docker
|
||||
- /var/foo:/var/foo
|
||||
- /check.sh:/check.sh
|
||||
command: ["sh", "./check.sh"]
|
||||
- name: poweroff
|
||||
image: linuxkit/poweroff:bce51402e293da0b653923a43c3c7be6e0effa05
|
||||
command: ["/bin/sh", "/poweroff.sh", "10"]
|
||||
files:
|
||||
- path: check.sh
|
||||
source: ./check.sh
|
||||
trust:
|
||||
org:
|
||||
- linuxkit
|
||||
- library
|
2
test/cases/040_packages/009_extend/000_ext4/Dockerfile
Normal file
2
test/cases/040_packages/009_extend/000_ext4/Dockerfile
Normal file
@ -0,0 +1,2 @@
|
||||
FROM alpine:3.6
|
||||
RUN apk add --no-cache qemu-img sfdisk e2fsprogs util-linux
|
13
test/cases/040_packages/009_extend/000_ext4/check.sh
Executable file
13
test/cases/040_packages/009_extend/000_ext4/check.sh
Executable file
@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -x
|
||||
|
||||
function failed {
|
||||
printf "extend test suite FAILED\n" >&1
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ -f /var/lib/docker/bar ] || failed
|
||||
touch /var/lib/docker/foo || failed
|
||||
df -h | grep -q "490.9M" || failed
|
||||
printf "extend test suite PASSED\n" >&1
|
3
test/cases/040_packages/009_extend/000_ext4/extend.sh
Executable file
3
test/cases/040_packages/009_extend/000_ext4/extend.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
set -ex
|
||||
qemu-img resize -f qcow2 "$1" +256M
|
25
test/cases/040_packages/009_extend/000_ext4/test-create.yml
Normal file
25
test/cases/040_packages/009_extend/000_ext4/test-create.yml
Normal file
@ -0,0 +1,25 @@
|
||||
kernel:
|
||||
image: linuxkit/kernel:4.9.39
|
||||
cmdline: "console=ttyS0"
|
||||
init:
|
||||
- linuxkit/init:838b772355a8690143b37de1cdd4ac5db725271f
|
||||
- linuxkit/runc:d5cbeb95bdafedb82ad2cf11cff1a5da7fcae630
|
||||
onboot:
|
||||
- name: format
|
||||
image: linuxkit/format:efafddf9bc6165b5efaf09c532c15a1100a10e61
|
||||
- name: mount
|
||||
image: linuxkit/mount:54990a6a69cb3ead4da8a9c1f0b651e27aea8d3f
|
||||
command: ["/usr/bin/mountie", "/var/lib/docker"]
|
||||
- name: test
|
||||
image: alpine:3.6
|
||||
readonly: true
|
||||
binds:
|
||||
- /var/lib/docker:/var/lib/docker
|
||||
command: ["touch", "/var/lib/docker/bar"]
|
||||
- name: poweroff
|
||||
image: linuxkit/poweroff:bce51402e293da0b653923a43c3c7be6e0effa05
|
||||
command: ["/bin/sh", "/poweroff.sh", "10"]
|
||||
trust:
|
||||
org:
|
||||
- linuxkit
|
||||
- library
|
35
test/cases/040_packages/009_extend/000_ext4/test.sh
Normal file
35
test/cases/040_packages/009_extend/000_ext4/test.sh
Normal file
@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
# SUMMARY: Check that an ext4 partition can be extended
|
||||
# LABELS:
|
||||
# REPEAT:
|
||||
|
||||
set -ex
|
||||
|
||||
# Source libraries. Uncomment if needed/defined
|
||||
#. "${RT_LIB}"
|
||||
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
|
||||
|
||||
NAME=test-extend
|
||||
DISK=disk0.img
|
||||
clean_up() {
|
||||
find . -depth -iname "${NAME}*" -not -iname "*.yml" -exec rm -rf {} \;
|
||||
rm -rf ${DISK} || true
|
||||
docker rmi ${NAME} || true
|
||||
}
|
||||
|
||||
trap clean_up EXIT
|
||||
|
||||
# Test code goes here
|
||||
rm -rf ${DISK} || true
|
||||
docker build -t ${NAME} .
|
||||
moby build --name create -output kernel+initrd test-create.yml
|
||||
linuxkit run -disk file=${DISK},size=256M create
|
||||
rm -rf "create*"
|
||||
[ -f ${DISK} ] || exit 1
|
||||
docker run -i --rm --privileged -v "$PWD:/tmp" -w /tmp ${NAME} ./extend.sh ${DISK}
|
||||
moby build -name ${NAME} -output kernel+initrd test.yml
|
||||
RESULT="$(linuxkit run -disk file=${DISK} ${NAME})"
|
||||
echo "${RESULT}"
|
||||
echo "${RESULT}" | grep -q "suite PASSED"
|
||||
|
||||
exit 0
|
29
test/cases/040_packages/009_extend/000_ext4/test.yml
Normal file
29
test/cases/040_packages/009_extend/000_ext4/test.yml
Normal file
@ -0,0 +1,29 @@
|
||||
kernel:
|
||||
image: linuxkit/kernel:4.9.39
|
||||
cmdline: "console=ttyS0"
|
||||
init:
|
||||
- linuxkit/init:838b772355a8690143b37de1cdd4ac5db725271f
|
||||
- linuxkit/runc:d5cbeb95bdafedb82ad2cf11cff1a5da7fcae630
|
||||
onboot:
|
||||
- name: extend
|
||||
image: linuxkit/extend:1e81ffe40ad63887d6210228c2a791f28375ee0f
|
||||
- name: mount
|
||||
image: linuxkit/mount:54990a6a69cb3ead4da8a9c1f0b651e27aea8d3f
|
||||
command: ["/usr/bin/mountie", "/var/lib/docker"]
|
||||
- name: test
|
||||
image: alpine:3.6
|
||||
readonly: true
|
||||
binds:
|
||||
- /var/lib/docker:/var/lib/docker
|
||||
- /check.sh:/check.sh
|
||||
command: ["sh", "./check.sh"]
|
||||
- name: poweroff
|
||||
image: linuxkit/poweroff:bce51402e293da0b653923a43c3c7be6e0effa05
|
||||
command: ["/bin/sh", "/poweroff.sh", "10"]
|
||||
files:
|
||||
- path: check.sh
|
||||
source: ./check.sh
|
||||
trust:
|
||||
org:
|
||||
- linuxkit
|
||||
- library
|
2
test/cases/040_packages/009_extend/001_btrfs/Dockerfile
Normal file
2
test/cases/040_packages/009_extend/001_btrfs/Dockerfile
Normal file
@ -0,0 +1,2 @@
|
||||
FROM alpine:3.6
|
||||
RUN apk add --no-cache qemu-img sfdisk e2fsprogs util-linux
|
13
test/cases/040_packages/009_extend/001_btrfs/check.sh
Executable file
13
test/cases/040_packages/009_extend/001_btrfs/check.sh
Executable file
@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -x
|
||||
|
||||
function failed {
|
||||
printf "extend test suite FAILED\n" >&1
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ -f /var/lib/docker/bar ] || failed
|
||||
touch /var/lib/docker/foo || failed
|
||||
df -h | grep -q "511.0M" || failed
|
||||
printf "extend test suite PASSED\n" >&1
|
3
test/cases/040_packages/009_extend/001_btrfs/extend.sh
Executable file
3
test/cases/040_packages/009_extend/001_btrfs/extend.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
set -ex
|
||||
qemu-img resize -f qcow2 "$1" +256M
|
33
test/cases/040_packages/009_extend/001_btrfs/test-create.yml
Normal file
33
test/cases/040_packages/009_extend/001_btrfs/test-create.yml
Normal file
@ -0,0 +1,33 @@
|
||||
kernel:
|
||||
image: linuxkit/kernel:4.9.39
|
||||
cmdline: "console=ttyS0"
|
||||
init:
|
||||
- linuxkit/init:838b772355a8690143b37de1cdd4ac5db725271f
|
||||
- linuxkit/runc:d5cbeb95bdafedb82ad2cf11cff1a5da7fcae630
|
||||
onboot:
|
||||
- name: modprobe
|
||||
image: alpine:3.6
|
||||
capabilities: [all]
|
||||
binds:
|
||||
- /lib/modules:/lib/modules
|
||||
- /sys:/sys
|
||||
command: ["modprobe", "btrfs"]
|
||||
- name: format
|
||||
image: linuxkit/format:efafddf9bc6165b5efaf09c532c15a1100a10e61
|
||||
command: ["/usr/bin/format", "-type", "btrfs" ]
|
||||
- name: mount
|
||||
image: linuxkit/mount:54990a6a69cb3ead4da8a9c1f0b651e27aea8d3f
|
||||
command: ["/usr/bin/mountie", "/var/lib/docker"]
|
||||
- name: test
|
||||
image: alpine:3.6
|
||||
readonly: true
|
||||
binds:
|
||||
- /var/lib/docker:/var/lib/docker
|
||||
command: ["touch", "/var/lib/docker/bar"]
|
||||
- name: poweroff
|
||||
image: linuxkit/poweroff:bce51402e293da0b653923a43c3c7be6e0effa05
|
||||
command: ["/bin/sh", "/poweroff.sh", "10"]
|
||||
trust:
|
||||
org:
|
||||
- linuxkit
|
||||
- library
|
35
test/cases/040_packages/009_extend/001_btrfs/test.sh
Normal file
35
test/cases/040_packages/009_extend/001_btrfs/test.sh
Normal file
@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
# SUMMARY: Check that a btrfs partition can be extended
|
||||
# LABELS:
|
||||
# REPEAT:
|
||||
|
||||
set -ex
|
||||
|
||||
# Source libraries. Uncomment if needed/defined
|
||||
#. "${RT_LIB}"
|
||||
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
|
||||
|
||||
NAME=test-extend
|
||||
DISK=disk0.img
|
||||
clean_up() {
|
||||
find . -depth -iname "${NAME}*" -not -iname "*.yml" -exec rm -rf {} \;
|
||||
rm -rf ${DISK} || true
|
||||
docker rmi ${NAME} || true
|
||||
}
|
||||
|
||||
trap clean_up EXIT
|
||||
|
||||
# Test code goes here
|
||||
rm -rf disk0.img || true
|
||||
docker build -t ${NAME} .
|
||||
moby build --name create -output kernel+initrd test-create.yml
|
||||
linuxkit run -disk file=${DISK},size=256M create
|
||||
rm -rf "create*"
|
||||
[ -f ${DISK} ] || exit 1
|
||||
docker run -i --rm --privileged -v "$PWD:/tmp" -w /tmp ${NAME} ./extend.sh ${DISK}
|
||||
moby build -name ${NAME} -output kernel+initrd test.yml
|
||||
RESULT="$(linuxkit run -disk file=${DISK} ${NAME})"
|
||||
echo "${RESULT}"
|
||||
echo "${RESULT}" | grep -q "suite PASSED"
|
||||
|
||||
exit 0
|
37
test/cases/040_packages/009_extend/001_btrfs/test.yml
Normal file
37
test/cases/040_packages/009_extend/001_btrfs/test.yml
Normal file
@ -0,0 +1,37 @@
|
||||
kernel:
|
||||
image: linuxkit/kernel:4.9.39
|
||||
cmdline: "console=ttyS0"
|
||||
init:
|
||||
- linuxkit/init:838b772355a8690143b37de1cdd4ac5db725271f
|
||||
- linuxkit/runc:d5cbeb95bdafedb82ad2cf11cff1a5da7fcae630
|
||||
onboot:
|
||||
- name: modprobe
|
||||
image: alpine:3.6
|
||||
capabilities: [all]
|
||||
binds:
|
||||
- /lib/modules:/lib/modules
|
||||
- /sys:/sys
|
||||
command: ["modprobe", "btrfs"]
|
||||
- name: extend
|
||||
image: linuxkit/extend:1e81ffe40ad63887d6210228c2a791f28375ee0f
|
||||
command: ["/usr/bin/extend", "-type", "btrfs"]
|
||||
- name: mount
|
||||
image: linuxkit/mount:54990a6a69cb3ead4da8a9c1f0b651e27aea8d3f
|
||||
command: ["/usr/bin/mountie", "/var/lib/docker"]
|
||||
- name: test
|
||||
image: alpine:3.6
|
||||
readonly: true
|
||||
binds:
|
||||
- /var/lib/docker:/var/lib/docker
|
||||
- /check.sh:/check.sh
|
||||
command: ["sh", "./check.sh"]
|
||||
- name: poweroff
|
||||
image: linuxkit/poweroff:bce51402e293da0b653923a43c3c7be6e0effa05
|
||||
command: ["/bin/sh", "/poweroff.sh", "10"]
|
||||
files:
|
||||
- path: check.sh
|
||||
source: ./check.sh
|
||||
trust:
|
||||
org:
|
||||
- linuxkit
|
||||
- library
|
2
test/cases/040_packages/009_extend/002_xfs/Dockerfile
Normal file
2
test/cases/040_packages/009_extend/002_xfs/Dockerfile
Normal file
@ -0,0 +1,2 @@
|
||||
FROM alpine:3.6
|
||||
RUN apk add --no-cache qemu-img sfdisk e2fsprogs util-linux
|
13
test/cases/040_packages/009_extend/002_xfs/check.sh
Executable file
13
test/cases/040_packages/009_extend/002_xfs/check.sh
Executable file
@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -x
|
||||
|
||||
function failed {
|
||||
printf "extend test suite FAILED\n" >&1
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ -f /var/lib/docker/bar ] || failed
|
||||
touch /var/lib/docker/foo || failed
|
||||
df -h | grep -q "507.7M" || failed
|
||||
printf "extend test suite PASSED\n" >&1
|
3
test/cases/040_packages/009_extend/002_xfs/extend.sh
Executable file
3
test/cases/040_packages/009_extend/002_xfs/extend.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
set -ex
|
||||
qemu-img resize -f qcow2 "$1" +256M
|
26
test/cases/040_packages/009_extend/002_xfs/test-create.yml
Normal file
26
test/cases/040_packages/009_extend/002_xfs/test-create.yml
Normal file
@ -0,0 +1,26 @@
|
||||
kernel:
|
||||
image: linuxkit/kernel:4.9.39
|
||||
cmdline: "console=ttyS0"
|
||||
init:
|
||||
- linuxkit/init:838b772355a8690143b37de1cdd4ac5db725271f
|
||||
- linuxkit/runc:d5cbeb95bdafedb82ad2cf11cff1a5da7fcae630
|
||||
onboot:
|
||||
- name: format
|
||||
image: linuxkit/format:efafddf9bc6165b5efaf09c532c15a1100a10e61
|
||||
command: ["/usr/bin/format", "-type", "xfs"]
|
||||
- name: mount
|
||||
image: linuxkit/mount:54990a6a69cb3ead4da8a9c1f0b651e27aea8d3f
|
||||
command: ["/usr/bin/mountie", "/var/lib/docker"]
|
||||
- name: test
|
||||
image: alpine:3.6
|
||||
readonly: true
|
||||
binds:
|
||||
- /var/lib/docker:/var/lib/docker
|
||||
command: ["touch", "/var/lib/docker/bar"]
|
||||
- name: poweroff
|
||||
image: linuxkit/poweroff:bce51402e293da0b653923a43c3c7be6e0effa05
|
||||
command: ["/bin/sh", "/poweroff.sh", "10"]
|
||||
trust:
|
||||
org:
|
||||
- linuxkit
|
||||
- library
|
35
test/cases/040_packages/009_extend/002_xfs/test.sh
Normal file
35
test/cases/040_packages/009_extend/002_xfs/test.sh
Normal file
@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
# SUMMARY: Check that an XFS partition can be extended
|
||||
# LABELS:
|
||||
# REPEAT:
|
||||
|
||||
set -ex
|
||||
|
||||
# Source libraries. Uncomment if needed/defined
|
||||
#. "${RT_LIB}"
|
||||
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
|
||||
|
||||
NAME=test-extend
|
||||
DISK=disk0.img
|
||||
clean_up() {
|
||||
find . -depth -iname "${NAME}*" -not -iname "*.yml" -exec rm -rf {} \;
|
||||
rm -rf ${DISK} || true
|
||||
docker rmi ${NAME} || true
|
||||
}
|
||||
|
||||
trap clean_up EXIT
|
||||
|
||||
# Test code goes here
|
||||
rm -rf disk0.img || true
|
||||
docker build -t ${NAME} .
|
||||
moby build --name create -output kernel+initrd test-create.yml
|
||||
linuxkit run -disk file=${DISK},size=256M create
|
||||
rm -rf "create*"
|
||||
[ -f ${DISK} ] || exit 1
|
||||
docker run -i --rm --privileged -v "$PWD:/tmp" -w /tmp ${NAME} ./extend.sh ${DISK}
|
||||
moby build -name ${NAME} -output kernel+initrd test.yml
|
||||
RESULT="$(linuxkit run -disk file=${DISK} ${NAME})"
|
||||
echo "${RESULT}"
|
||||
echo "${RESULT}" | grep -q "suite PASSED"
|
||||
|
||||
exit 0
|
30
test/cases/040_packages/009_extend/002_xfs/test.yml
Normal file
30
test/cases/040_packages/009_extend/002_xfs/test.yml
Normal file
@ -0,0 +1,30 @@
|
||||
kernel:
|
||||
image: linuxkit/kernel:4.9.39
|
||||
cmdline: "console=ttyS0"
|
||||
init:
|
||||
- linuxkit/init:838b772355a8690143b37de1cdd4ac5db725271f
|
||||
- linuxkit/runc:d5cbeb95bdafedb82ad2cf11cff1a5da7fcae630
|
||||
onboot:
|
||||
- name: extend
|
||||
image: linuxkit/extend:1e81ffe40ad63887d6210228c2a791f28375ee0f
|
||||
command: ["/usr/bin/extend", "-type", "xfs"]
|
||||
- name: mount
|
||||
image: linuxkit/mount:54990a6a69cb3ead4da8a9c1f0b651e27aea8d3f
|
||||
command: ["/usr/bin/mountie", "/var/lib/docker"]
|
||||
- name: test
|
||||
image: alpine:3.6
|
||||
readonly: true
|
||||
binds:
|
||||
- /var/lib/docker:/var/lib/docker
|
||||
- /check.sh:/check.sh
|
||||
command: ["sh", "./check.sh"]
|
||||
- name: poweroff
|
||||
image: linuxkit/poweroff:bce51402e293da0b653923a43c3c7be6e0effa05
|
||||
command: ["/bin/sh", "/poweroff.sh", "10"]
|
||||
files:
|
||||
- path: check.sh
|
||||
source: ./check.sh
|
||||
trust:
|
||||
org:
|
||||
- linuxkit
|
||||
- library
|
Loading…
Reference in New Issue
Block a user