Skip to content

Commit c794d6e

Browse files
committed
tests: Add a bootc-cached.sh test
Signed-off-by: Alberto Faria <[email protected]>
1 parent 2a2341e commit c794d6e

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/t/bootc-cached.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# SPDX-License-Identifier: GPL-2.0-or-later
2+
3+
image="${TEST_IMAGES[fedora-bootc]}"
4+
user="${TEST_IMAGES_DEFAULT_USER[fedora-bootc]}"
5+
6+
__drop_cached() {
7+
mapfile -d '' -t __cached < <( __engine images --filter=label=crun-vm.from --format '{{.ID}}' --no-trunc )
8+
if (( ${#__cached[@]} > 0 )); then
9+
__engine rmi "${__cached[@]}"
10+
fi
11+
}
12+
13+
__test() {
14+
__engine run --detach --name "$TEST_ID" "$image"
15+
__engine exec "$TEST_ID" --as "$user"
16+
__engine rm --force "$TEST_ID"
17+
}
18+
19+
__drop_cached
20+
__test
21+
__test

0 commit comments

Comments
 (0)