Skip to content

Commit

Permalink
bats test: add a backup image to avoid network errors
Browse files Browse the repository at this point in the history
Signed-off-by: Qinqi Qu <quqinqi@linux.alibaba.com>
  • Loading branch information
adamqqqplay committed Apr 9, 2024
1 parent 260a044 commit 462486e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions tests/bats/run_container_with_rafs_and_compile_linux.bats
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
load "${BATS_TEST_DIRNAME}/common_tests.sh"

setup() {
nydus_rafs_image="ghcr.io/dragonflyoss/image-service/bldlinux:v0.1-rafs-v6-lz4"
nydus_rafs_image="docker.io/openanolis/bldlinux:v0.1-rafs-v6-lz4"
nydus_rafs_image_bak="ghcr.io/dragonflyoss/image-service/bldlinux:v0.1-rafs-v6-lz4"
run_nydus_snapshotter
config_containerd_for_nydus
ctr images ls | grep -q "${nydus_rafs_image}" && ctr images rm $nydus_rafs_image
ctr-remote images rpull $nydus_rafs_image
nerdctl pull --snapshotter=nydus $nydus_rafs_image
ctr images ls | grep -q "${nydus_rafs_image_bak}" && ctr images rm $nydus_rafs_image_bak
nerdctl pull --snapshotter=nydus $nydus_rafs_image_bak
}

@test "run container with rafs and compile linux" {
nerdctl run --rm --net=host --snapshotter=nydus $nydus_rafs_image /bin/bash -c 'cd /linux-5.10.87; make defconfig; make -j8'
if [ $? -ne 0 ]; then
nydus_rafs_image=${nydus_rafs_image_bak}
nerdctl run --rm --net=host --snapshotter=nydus $nydus_rafs_image /bin/bash -c 'cd /linux-5.10.87; make defconfig; make -j8'
fi
echo "drop cache and compile linux in container again"
echo 3 > /proc/sys/vm/drop_caches
nerdctl run --rm --net=host --snapshotter=nydus $nydus_rafs_image /bin/bash -c 'cd /linux-5.10.87; make defconfig; make -j8'
Expand Down

0 comments on commit 462486e

Please sign in to comment.