Skip to content

Commit 0aa66e8

Browse files
committed
Test adjustments for Docker with containerd image store.
Signed-off-by: Cesar Talledo <cesar.talledo@docker.com>
1 parent d963f0d commit 0aa66e8

2 files changed

Lines changed: 29 additions & 18 deletions

File tree

tests/cind/basic.bats

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,18 @@ function teardown() {
7777
docker_stop "$syscont"
7878
docker image prune -f
7979

80-
# verify the committed image has an appropriate size (slightly
81-
# bigger than the base image since it includes inner containerd busybox & alpine images)
82-
local unique_size=$(__docker system df -v --format '{{json .}}' | jq '.Images[] | select(.Repository == "image-commit") | .UniqueSize' | tr -d '"' | grep -Eo '[[:alpha:]]+|[0-9]+')
83-
local num=$(echo $unique_size | awk '{print $1}')
84-
local unit=$(echo $unique_size | awk '{print $3}')
85-
[ "$num" -lt "15" ]
86-
[ "$unit" == "MB" ]
80+
# verify the committed image has an appropriate size (slightly bigger than the
81+
# base image since it includes inner containerd busybox & alpine images).
82+
#
83+
# note: this check only works when Docker is using the Docker image store, as
84+
# otherwise docker system df does not report the image's unique size.
85+
if docker_containerd_image_store; then
86+
local unique_size=$(__docker system df -v --format '{{json .}}' | jq '.Images[] | select(.Repository == "image-commit") | .UniqueSize' | tr -d '"' | grep -Eo '[[:alpha:]]+|[0-9]+')
87+
local num=$(echo $unique_size | awk '{print $1}')
88+
local unit=$(echo $unique_size | awk '{print $3}')
89+
[ "$num" -lt "15" ]
90+
[ "$unit" == "MB" ]
91+
fi
8792

8893
# launch a sys container with the committed image
8994
syscont=$(docker_run --rm image-commit)

tests/scr/testSysbox

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -241,21 +241,25 @@ function test_with_rootfs_cloning() {
241241
return 0
242242
}
243243

244-
# Test sysbox when Docker is configured with the containerd image store
245-
function test_with_containerd_image_store() {
246-
247-
# TODO: ideally we should run all tests with the containerd image store, but
248-
# we first need to adjust several helper functions for this. For now, just run
249-
# a subset of tests to verify the base functionality is good.
244+
# Test sysbox when Docker is configured with the (legacy) docker image store
245+
# (default is containerd image store)
246+
function test_with_docker_image_store() {
250247

251248
printf "\n"
252-
printf "Executing Docker containerd image store + Sysbox tests \n"
249+
printf "Executing Docker image store + Sysbox tests \n"
253250
printf -- "--------------------------------------------------------\n"
254251

255-
printf "\nConfiguring Docker with the containerd image store\n"
256-
docker-cfg --containerd-image-store=true
252+
printf "\nConfiguring Docker with the (legacy) image store\n"
253+
docker-cfg --containerd-image-store=false
257254

255+
bats --tap tests/sysmgr
256+
bats --tap tests/sysfs
257+
bats --tap tests/docker
258+
bats --tap tests/dind
259+
bats --tap tests/cind
260+
bats --tap tests/apps/l1
258261
bats --tap tests/buildx
262+
./tests/pods/pods.sh
259263

260264
# Try again with Sysbox using rootfs cloning
261265
printf "\nDisabling Sysbox shiftfs and overlayfs on ID-mapped mounts.\n"
@@ -266,6 +270,8 @@ function test_with_containerd_image_store() {
266270
restart_sysbox sysbox_cmdline
267271

268272
bats --tap tests/sysmgr/rootfsCloning.bats
273+
bats --tap tests/docker
274+
bats --tap tests/dind
269275
bats --tap tests/buildx
270276

271277
# Cleanup
@@ -274,7 +280,7 @@ function test_with_containerd_image_store() {
274280
restart_sysbox sysbox_cmdline
275281

276282
printf "\nConfiguring Docker with the default image store\n"
277-
docker-cfg --containerd-image-store=false
283+
docker-cfg --containerd-image-store=true
278284
}
279285

280286
# Test sysbox when Docker is configured with userns-remap mode.
@@ -365,7 +371,7 @@ function main() {
365371
test_with_idmapped_only
366372
test_with_shiftfs_only
367373
test_with_rootfs_cloning
368-
test_with_containerd_image_store
374+
test_with_docker_image_store
369375
test_with_docker_userns_remap
370376
test_sysbox_config
371377
test_sysbox_lifecycle

0 commit comments

Comments
 (0)