2019-09-19 10:48:07 +00:00
|
|
|
#!/usr/bin/env bats -t
|
|
|
|
|
|
|
|
load helpers
|
|
|
|
|
|
|
|
@test "Build from image reference" {
|
2019-09-19 12:03:52 +00:00
|
|
|
local d
|
|
|
|
d=$(mktemp -d)
|
|
|
|
echo "temporary directory: ${d}"
|
|
|
|
|
2019-09-19 10:48:07 +00:00
|
|
|
ref="registry.fedoraproject.org/fedora-minimal"
|
2019-09-26 17:03:12 +00:00
|
|
|
run_ctr --mount type=bind,source=${d},destination=/output $CTR_IMAGE -i "${ref}" -o /output
|
2019-09-19 10:48:07 +00:00
|
|
|
[ "$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 ]
|
|
|
|
}
|