From 4eccc552338f81206aefcba876fe7fa8e87f1269 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Thu, 19 Sep 2019 06:48:07 -0400 Subject: [PATCH] test: build source image from a remote image reference Signed-off-by: Vincent Batts --- test/02-from_image_ref.bats | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 test/02-from_image_ref.bats diff --git a/test/02-from_image_ref.bats b/test/02-from_image_ref.bats new file mode 100644 index 0000000..0acb9f5 --- /dev/null +++ b/test/02-from_image_ref.bats @@ -0,0 +1,26 @@ +#!/usr/bin/env bats -t + +load helpers + +@test "Build from image reference" { + d=$(mktemp -d) + ref="registry.fedoraproject.org/fedora-minimal" + run_ctr -v ${d}:/output/ $CTR_IMAGE -i "${ref}" + [ "$status" -eq 0 ] + #echo ${lines[@]} + [[ ${lines[0]} =~ "Getting image source signatures" ]] + [[ ${lines[1]} =~ "Copying blob " ]] + [[ ${lines[5]} =~ "[SrcImg][INFO] [unpacking] layer sha256:" ]] + [[ ${lines[6]} =~ "[SrcImg][INFO] inspecting image reference ${ref}:" ]] + [[ ${lines[7]} =~ "[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 ] + [ "$(find ${d} -type f | wc -l)" -gt 5 ] +}