2017-03-18 06:45:19 +08:00
|
|
|
#!/usr/bin/env bats
|
|
|
|
|
|
|
|
load helpers
|
|
|
|
|
|
|
|
@test "run" {
|
|
|
|
if ! which runc ; then
|
|
|
|
skip
|
|
|
|
fi
|
|
|
|
createrandom ${TESTDIR}/randomfile
|
|
|
|
cid=$(buildah from --pull --signature-policy ${TESTSDIR}/policy.json --image alpine)
|
2017-03-25 00:49:22 +08:00
|
|
|
root=$(buildah mount $cid)
|
|
|
|
buildah config $cid --workingdir /tmp
|
|
|
|
run buildah --debug=false run $cid pwd
|
2017-03-18 06:45:19 +08:00
|
|
|
output=$(echo "$output" | tr -d '\r')
|
|
|
|
[ "$output" = /tmp ]
|
2017-03-25 00:49:22 +08:00
|
|
|
buildah config $cid --workingdir /root
|
2017-03-18 06:45:19 +08:00
|
|
|
run buildah --debug=false run $cid pwd
|
|
|
|
output=$(echo "$output" | tr -d '\r')
|
|
|
|
[ "$output" = /root ]
|
|
|
|
cp ${TESTDIR}/randomfile $root/tmp/
|
|
|
|
buildah run $cid cp /tmp/randomfile /tmp/other-randomfile
|
|
|
|
test -s $root/tmp/other-randomfile
|
|
|
|
cmp ${TESTDIR}/randomfile $root/tmp/other-randomfile
|
2017-03-25 00:49:22 +08:00
|
|
|
buildah unmount $cid
|
|
|
|
buildah delete $cid
|
2017-03-18 06:45:19 +08:00
|
|
|
}
|