diff --git a/Makefile b/Makefile index cbc2c0e..69b388a 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ SRC := ./BuildSourceImage.sh CTR_IMAGE := localhost/containers/buildsourceimage CTR_ENGINE ?= podman +BATS_OPTS ?= cleanfiles = # these are packages whose src.rpms are very small srpm_urls = \ @@ -9,6 +10,9 @@ srpm_urls = \ https://archive.kernel.org/centos-vault/7.0.1406/os/Source/SPackages/centos-bookmarks-7-1.el7.src.rpm srpms = $(addprefix ./.testprep/srpms/,$(notdir $(rpms))) +export CTR_IMAGE +export CTR_ENGINE + all: validate validate: .validate @@ -35,7 +39,7 @@ cleanfiles += .testprep $(srpms) test-integration: .build-container .testprep @echo @echo "==> Running integration tests" - CTR_IMAGE=$(CTR_IMAGE) CTR_ENGINE=$(CTR_ENGINE) TMPDIR=$(shell realpath .testprep/tmp) bats test/ + TMPDIR=$(shell realpath .testprep/tmp) bats $(BATS_OPTS) test/ clean: diff --git a/test/01-from_rpms.bats b/test/01-from_rpms.bats index d50f64d..07aa5d3 100644 --- a/test/01-from_rpms.bats +++ b/test/01-from_rpms.bats @@ -7,19 +7,19 @@ load helpers d=$(mktemp -d) echo "temporary directory: ${d}" - run_ctr -v $(pwd)/.testprep/srpms/:/src:ro -v ${d}:/output/ $CTR_IMAGE -s /src + run_ctr -v $(pwd)/.testprep/srpms/:/src:ro --mount type=bind,source=${d},destination=/output $CTR_IMAGE -s /src [ "$status" -eq 0 ] [[ ${lines[0]} =~ "[SrcImg][INFO] calling source collection drivers" ]] # get the number of the last line n=$(expr ${#lines[@]} - 1) [[ ${lines[${n}]} =~ "[SrcImg][INFO] copied to oci:/output:latest-source" ]] - + echo "${d}" [ -f "${d}/index.json" ] [ -f "${d}/oci-layout" ] [ "$(du -b ${d}/index.json | awk '{ print $1 }')" -gt 0 ] [ "$(du -b ${d}/oci-layout | awk '{ print $1 }')" -gt 0 ] - + # let's press that the files are predictable [ "$(find ${d} -type f | wc -l)" -eq 7 ] [ -f "${d}/blobs/sha256/3afb43699ea82a69b16efb215363604d9e4ffe16c9ace7e53df66663847309cf" ] @@ -32,7 +32,7 @@ load helpers d=$(mktemp -d) echo "temporary directory: ${d}" - run_ctr -v $(pwd)/.testprep/srpms/:/src:ro -v ${d}:/output/ $CTR_IMAGE -s /src -p oci:/output/pushed-image:latest-source + run_ctr -v $(pwd)/.testprep/srpms/:/src:ro --mount type=bind,source=${d},destination=/output $CTR_IMAGE -s /src -p oci:/output/pushed-image:latest-source [ "$status" -eq 0 ] run ls ${d}/pushed-image diff --git a/test/02-from_image_ref.bats b/test/02-from_image_ref.bats index 3925456..38ce66c 100644 --- a/test/02-from_image_ref.bats +++ b/test/02-from_image_ref.bats @@ -8,7 +8,7 @@ load helpers echo "temporary directory: ${d}" ref="registry.fedoraproject.org/fedora-minimal" - run_ctr -v ${d}:/output/ $CTR_IMAGE -i "${ref}" + run_ctr --mount type=bind,source=${d},destination=/output $CTR_IMAGE -i "${ref}" [ "$status" -eq 0 ] #echo ${lines[@]} [[ ${lines[0]} =~ "Getting image source signatures" ]]