This repository has been archived by the owner on Jun 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Add test cases for CoCo image pulling without forked containerd
Additional tests are necessary to verify new feature that pulling image without forked containerd in CoCo. 1)image sharing on the host without dm-verity. 2)image sharing on the host with dm-verity. 3)image pulling in the guest with nydus-snapshotter. Fixes #5763 Depends-on: github.com/kata-containers/kata-containers#7676 Signed-off-by: ChengyuZhu6 <[email protected]>
- Loading branch information
1 parent
6d7723a
commit 1d81ed2
Showing
6 changed files
with
172 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
integration/kubernetes/confidential/image_pulling_with_snapshotter.bats
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
#!/usr/bin/env bats | ||
# Copyright (c) 2023 Intel Corporation | ||
# Copyright (c) 2023 IBM Corporation | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
load "${BATS_TEST_DIRNAME}/lib.sh" | ||
load "${BATS_TEST_DIRNAME}/../../confidential/lib.sh" | ||
load "${BATS_TEST_DIRNAME}/tests_common.sh" | ||
|
||
tag_suffix="" | ||
if [ "$(uname -m)" != "x86_64" ]; then | ||
tag_suffix="-$(uname -m)" | ||
fi | ||
|
||
# Images used on the tests. | ||
|
||
image_unsigned_protected="quay.io/kata-containers/confidential-containers:unsigned${tag_suffix}" | ||
|
||
original_kernel_params=$(get_kernel_params) | ||
# Allow to configure the runtimeClassName on pod configuration. | ||
RUNTIMECLASS="${RUNTIMECLASS:-kata}" | ||
test_tag="[cc][agent][kubernetes][containerd]" | ||
|
||
setup() { | ||
remove_test_image "$image_unsigned_protected" || true | ||
setup_common | ||
} | ||
|
||
@test "$test_tag Test can pull an image as a raw block disk image to guest with dm-verity enabled" { | ||
if [ "$(uname -m)" = s390x ]; then | ||
skip "test for s390x as nydus-image doesn't currently support this platform" | ||
fi | ||
if [ "$SNAPSHOTTER" = "nydus" ]; then | ||
EXPORT_MODE="image_block_with_verity" RUNTIMECLASS="$RUNTIMECLASS" SNAPSHOTTER="nydus" configure_remote_snapshotter | ||
pod_config="$(new_pod_config "$image_unsigned_protected")" | ||
echo $pod_config | ||
create_test_pod | ||
fi | ||
} | ||
|
||
@test "$test_tag Test can pull an image as a raw block disk image to guest without dm-verity" { | ||
if [ "$(uname -m)" = s390x ]; then | ||
skip "test for s390x as nydus-image doesn't currently support this platform" | ||
fi | ||
if [ "$SNAPSHOTTER" = "nydus" ]; then | ||
EXPORT_MODE="image_block" RUNTIMECLASS="$RUNTIMECLASS" SNAPSHOTTER="nydus" configure_remote_snapshotter | ||
pod_config="$(new_pod_config "$image_unsigned_protected")" | ||
echo $pod_config | ||
create_test_pod | ||
fi | ||
} | ||
|
||
@test "$test_tag Test can create two pods with pulling the image only once with dm-verity enabled" { | ||
if [ "$(uname -m)" = s390x ]; then | ||
skip "test for s390x as nydus-image doesn't currently support this platform" | ||
fi | ||
if [ "$SNAPSHOTTER" = "nydus" ]; then | ||
EXPORT_MODE="image_block_with_verity" RUNTIMECLASS="$RUNTIMECLASS" SNAPSHOTTER="nydus" configure_remote_snapshotter | ||
|
||
pod_config="$(new_pod_config "$image_unsigned_protected" "1")" | ||
echo $pod_config | ||
create_test_pod | ||
pod_config="$(new_pod_config "$image_unsigned_protected" "2")" | ||
echo $pod_config | ||
create_test_pod | ||
|
||
pull_times=$(journalctl -g "PullImage \"$image_unsigned_protected\" with snapshotter nydus" | wc -l) | ||
[ ${pull_times} -eq 1 ] | ||
fi | ||
} | ||
|
||
@test "$test_tag Test can pull an image inside the guest with remote-snapshotter" { | ||
switch_image_service_offload on | ||
if [ "$SNAPSHOTTER" = "nydus" ]; then | ||
EXPORT_MODE="image_guest_pull" RUNTIMECLASS="$RUNTIMECLASS" SNAPSHOTTER="nydus" configure_remote_snapshotter | ||
pod_config="$(new_pod_config "$image_unsigned_protected")" | ||
echo $pod_config | ||
create_test_pod | ||
fi | ||
} | ||
|
||
teardown() { | ||
remove_test_image "$image_unsigned_protected" || true | ||
kill_nydus_snapshotter_process | ||
teardown_common | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters