diff --git a/.gitignore b/.gitignore index f9a1f743d..6bc0e2a1a 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,9 @@ test_results/ *.profraw coverage-reports/ +# The integration tests' default scratch root. +.test-scratch/ + # API docs for local preview only. _site/ _serve/ diff --git a/Makefile b/Makefile index 1855256d2..7f4ca4445 100644 --- a/Makefile +++ b/Makefile @@ -278,6 +278,11 @@ PRESERVE_KERNELS ?= false # Override with SCRATCH_ROOT=/your/path on the command line. SCRATCH_ROOT ?= $(ROOT_DIR)/.test-scratch +# An editable build's images exist in no registry: init-block builds the +# init image before the data directory is cleared here, and a locally built +# builder image is in the same position. The recipe lands the tars from bin/ +# after its own system start, into the store the tests actually see; absent +# a tar, the runtime pulls its documented default instead. define RUN_INTEGRATION @echo Ensuring apiserver stopped before the CLI integration tests... @bin/container system stop && sleep 3 && scripts/ensure-container-stopped.sh @@ -298,6 +303,14 @@ define RUN_INTEGRATION CLITEST_LOG_ROOT=$(LOG_ROOT) && export CLITEST_LOG_ROOT ; \ CLITEST_SCRATCH_ROOT=$(SCRATCH_ROOT) && export CLITEST_SCRATCH_ROOT ; \ CONTAINER_CLI_PATH=$(ROOT_DIR)/bin/container && export CONTAINER_CLI_PATH ; \ + if [ -f bin/init.tar ]; then \ + echo "==> Loading the built init image" && \ + bin/container i load -i bin/init.tar ; \ + fi && \ + if [ -f bin/builder.tar ]; then \ + echo "==> Loading the built builder image" && \ + bin/container i load -i bin/builder.tar ; \ + fi && \ echo "==> Starting warmup tests" && \ $(SWIFT) test $(INTEGRATION_SWIFT_EXTRA) -c $(BUILD_CONFIGURATION) $(SWIFT_CONFIGURATION) --filter "$(WARMUP_FILTER)" && \ echo "==> Starting $(words $(CONCURRENT_TEST_SUITES)) test suites concurrently (width=$(PARALLEL_WIDTH))" && \ diff --git a/Sources/ContainerTestSupport/WarmupImage.swift b/Sources/ContainerTestSupport/WarmupImage.swift index f839525cd..f379fbec4 100644 --- a/Sources/ContainerTestSupport/WarmupImage.swift +++ b/Sources/ContainerTestSupport/WarmupImage.swift @@ -23,6 +23,7 @@ public enum WarmupImage: String, CaseIterable, Sendable { case alpine320 = "ghcr.io/linuxcontainers/alpine:3.20" case alpine318 = "ghcr.io/linuxcontainers/alpine:3.18" case busybox136 = "ghcr.io/containerd/busybox:1.36" + case pythonAlpine = "docker.io/library/python:alpine" case kindestNodeV1_35_5 = "docker.io/kindest/node:v1.35.5@sha256:ce977ae6d65918d0b58a5f8b5e940429c2ce42fa3a5619ec2bbc60b949c0ac95" /// Directory under app-root holding OCI tar archives of each warmup image. diff --git a/scripts/install-init.sh b/scripts/install-init.sh index e8a3c5689..339ab026a 100755 --- a/scripts/install-init.sh +++ b/scripts/install-init.sh @@ -70,13 +70,18 @@ if [ "${CONTAINERIZATION_VERSION}" == "unspecified" ] ; then fi echo "Creating InitImage" make -C ${CONTAINERIZATION_PATH} init - ${CONTAINERIZATION_PATH}/bin/cctl images save -o /tmp/init.tar ${IMAGE_NAME} + # The tar stays in bin/ so the integration recipe can land the image + # again into whichever store the tests run against. + ${CONTAINERIZATION_PATH}/bin/cctl images save -o bin/init.tar ${IMAGE_NAME} # Sleep because commands after stop and start are racy. bin/container system stop sleep 3 - bin/container --debug system start "${START_ARGS[@]}" + # A start against a data directory with no configured kernel asks on + # stdin whether to install one, and this runs from make with no + # terminal, so the flag answers instead of a prompt, the way the + # integration recipe's own start does. + bin/container --debug system start --enable-kernel-install "${START_ARGS[@]}" sleep 3 - bin/container i load -i /tmp/init.tar - rm /tmp/init.tar + bin/container i load -i bin/init.tar fi