Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ docs:
.PHONY: clean
clean:
rm -rf bin/ src/*.o src/*.gcno src/*.gcda *.gcov
$(MAKE) -C test clean
$(MAKE) -C docs clean

.PHONY: install install.bin install.crio install.podman podman crio
Expand Down
4 changes: 4 additions & 0 deletions test/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.PHONY: clean
clean:
-chmod -R 700 /tmp/conmon-test-*
rm -rf /tmp/conmon-test-* /tmp/conmon-term.*
25 changes: 6 additions & 19 deletions test/test_helper.bash
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ RUNTIME_BINARY="${RUNTIME_BINARY:-/usr/bin/runc}"

# UBI10-micro container image for test rootfs
UBI10_MICRO_IMAGE="registry.access.redhat.com/ubi10/ubi-micro:latest"
ROOTFS_CACHE_DIR="/tmp/conmon-test-images"
ROOTFS_CACHE_MARKER="/tmp/conmon-test-images/.ubi10-micro-cached"
VALID_PATH="/tmp"
INVALID_PATH="/not/a/path"

Expand All @@ -35,23 +33,12 @@ generate_ctr_id() {
echo "conmon-test-$(date +%s)-$$-$RANDOM"
}

# Cache UBI10-micro rootfs for container tests
cache_ubi10_rootfs() {
if [[ -f "$ROOTFS_CACHE_MARKER" ]]; then
return 0
fi

mkdir -p "$ROOTFS_CACHE_DIR"

# Pull UBI10-micro rootfs for container tests
pull_ubi10_rootfs() {
# Pull UBI10-micro image if not already present
if ! podman image exists "$UBI10_MICRO_IMAGE" 2>/dev/null; then
if ! podman pull "$UBI10_MICRO_IMAGE" >/dev/null 2>&1; then
skip "Failed to pull UBI10-micro image"
fi
if ! podman pull --policy=newer "$UBI10_MICRO_IMAGE" >/dev/null 2>&1; then
skip "Failed to pull UBI10-micro image"
fi

# Mark as cached
touch "$ROOTFS_CACHE_MARKER"
}

# Run conmon with given arguments and capture output
Expand Down Expand Up @@ -340,8 +327,8 @@ setup_container_env() {
local use_terminal="$2"
setup_test_env

# Cache UBI10-micro image
cache_ubi10_rootfs
# Pull UBI10-micro image
pull_ubi10_rootfs

# Create the rootfs directory
mkdir -p "$ROOTFS"
Expand Down
Loading