Files
skopeo/tests/formats.bats
Nalin Dahyabhai 1ed6c7123f Finish wiring --format into build-using-dockerfile
We weren't properly passing the preferred output format to the Commit()
method when committing images that we were building using
build-with-dockerfile.  Fix that.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #127
Approved by: rhatdan
2017-05-30 17:29:31 +00:00

37 lines
2.2 KiB
Bash

#!/usr/bin/env bats
load helpers
@test "write-formats" {
buildimgtype
cid=$(buildah from --pull=false --signature-policy ${TESTSDIR}/policy.json scratch)
buildah commit --signature-policy ${TESTSDIR}/policy.json $cid scratch-image-default
buildah commit --format dockerv2 --signature-policy ${TESTSDIR}/policy.json $cid scratch-image-docker
buildah commit --format ociv1 --signature-policy ${TESTSDIR}/policy.json $cid scratch-image-oci
imgtype -expected-manifest-type application/vnd.oci.image.manifest.v1+json scratch-image-default
imgtype -expected-manifest-type application/vnd.oci.image.manifest.v1+json scratch-image-oci
imgtype -expected-manifest-type application/vnd.docker.distribution.manifest.v2+json scratch-image-docker
run imgtype -expected-manifest-type application/vnd.docker.distribution.manifest.v2+json scratch-image-default
[ "$status" -ne 0 ]
run imgtype -expected-manifest-type application/vnd.docker.distribution.manifest.v2+json scratch-image-oci
[ "$status" -ne 0 ]
run imgtype -expected-manifest-type application/vnd.oci.image.manifest.v1+json scratch-image-docker
[ "$status" -ne 0 ]
}
@test "bud-formats" {
buildimgtype
buildah build-using-dockerfile --signature-policy ${TESTSDIR}/policy.json -t scratch-image-default -f bud/from-scratch/Dockerfile
buildah build-using-dockerfile --format dockerv2 --signature-policy ${TESTSDIR}/policy.json -t scratch-image-docker -f bud/from-scratch/Dockerfile
buildah build-using-dockerfile --format ociv1 --signature-policy ${TESTSDIR}/policy.json -t scratch-image-oci -f bud/from-scratch/Dockerfile
imgtype -expected-manifest-type application/vnd.oci.image.manifest.v1+json scratch-image-default
imgtype -expected-manifest-type application/vnd.oci.image.manifest.v1+json scratch-image-oci
imgtype -expected-manifest-type application/vnd.docker.distribution.manifest.v2+json scratch-image-docker
run imgtype -expected-manifest-type application/vnd.docker.distribution.manifest.v2+json scratch-image-default
[ "$status" -ne 0 ]
run imgtype -expected-manifest-type application/vnd.docker.distribution.manifest.v2+json scratch-image-oci
[ "$status" -ne 0 ]
run imgtype -expected-manifest-type application/vnd.oci.image.manifest.v1+json scratch-image-docker
[ "$status" -ne 0 ]
}