Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bats test: add a backup image to avoid network errors #1567

Merged
merged 1 commit into from
Apr 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading