2018-06-11 14:55:51 +08:00
|
|
|
#!/usr/bin/env bats
|
|
|
|
|
|
|
|
load helpers
|
|
|
|
|
|
|
|
@test "commit" {
|
|
|
|
cid=$(buildah from --pull --signature-policy ${TESTSDIR}/policy.json alpine)
|
|
|
|
buildah commit --signature-policy ${TESTSDIR}/policy.json $cid alpine-image
|
|
|
|
run buildah images alpine-image
|
|
|
|
[ "${status}" -eq 0 ]
|
|
|
|
buildah rm $cid
|
|
|
|
buildah rmi -a
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "commit format test" {
|
|
|
|
cid=$(buildah from --pull --signature-policy ${TESTSDIR}/policy.json alpine)
|
|
|
|
buildah commit --signature-policy ${TESTSDIR}/policy.json $cid alpine-image-oci
|
|
|
|
buildah commit --format docker --signature-policy ${TESTSDIR}/policy.json $cid alpine-image-docker
|
|
|
|
|
2018-06-22 23:33:37 +08:00
|
|
|
buildah --debug=false inspect --type=image --format '{{.Manifest}}' alpine-image-oci | grep "application/vnd.oci.image.layer.v1.tar+gzip"
|
|
|
|
buildah --debug=false inspect --type=image --format '{{.Manifest}}' alpine-image-docker | grep "application/vnd.docker.image.rootfs.diff.tar.gzip"
|
2018-06-11 14:55:51 +08:00
|
|
|
buildah rm $cid
|
|
|
|
buildah rmi -a
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "commit quiet test" {
|
|
|
|
cid=$(buildah from --pull --signature-policy ${TESTSDIR}/policy.json alpine)
|
2018-06-22 23:33:37 +08:00
|
|
|
run buildah --debug=false commit --iidfile /dev/null --signature-policy ${TESTSDIR}/policy.json -q $cid alpine-image
|
|
|
|
echo "$output"
|
2018-06-11 14:55:51 +08:00
|
|
|
[ "${status}" -eq 0 ]
|
2018-06-22 23:33:37 +08:00
|
|
|
[ "$output" = "" ]
|
2018-06-11 14:55:51 +08:00
|
|
|
buildah rm $cid
|
|
|
|
buildah rmi -a
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "commit rm test" {
|
|
|
|
cid=$(buildah from --pull --signature-policy ${TESTSDIR}/policy.json alpine)
|
|
|
|
buildah commit --signature-policy ${TESTSDIR}/policy.json --rm $cid alpine-image
|
|
|
|
run buildah --debug=false rm $cid
|
2018-06-22 23:33:37 +08:00
|
|
|
[ "${status}" -eq 1 ]
|
2018-06-11 14:55:51 +08:00
|
|
|
[ "${lines[0]}" == "error removing container \"alpine-working-container\": error reading build container: container not known" ]
|
|
|
|
[ $(wc -l <<< "$output") -eq 1 ]
|
|
|
|
buildah rmi -a
|
|
|
|
}
|
2018-06-22 23:20:02 +08:00
|
|
|
|
|
|
|
@test "commit-alternate-storage" {
|
|
|
|
echo FROM
|
|
|
|
cid=$(buildah from --pull --signature-policy ${TESTSDIR}/policy.json openshift/hello-openshift)
|
|
|
|
echo COMMIT
|
|
|
|
buildah commit --signature-policy ${TESTSDIR}/policy.json $cid "containers-storage:[vfs@${TESTDIR}/root2+${TESTDIR}/runroot2]newimage"
|
|
|
|
echo FROM
|
|
|
|
buildah --storage-driver vfs --root ${TESTDIR}/root2 --runroot ${TESTDIR}/runroot2 from newimage
|
|
|
|
}
|