Add a couple of tests for "run"

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
This commit is contained in:
Nalin Dahyabhai 2017-03-17 18:45:19 -04:00
parent 0d83d9ebfa
commit ce13780b83
1 changed files with 26 additions and 0 deletions

26
tests/run.bats Normal file
View File

@ -0,0 +1,26 @@
#!/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)
root=$(buildah mount --name=$cid)
buildah config --name=$cid --workingdir /tmp
run buildah --debug=false run --name=$cid pwd
output=$(echo "$output" | tr -d '\r')
[ "$output" = /tmp ]
buildah config --name=$cid --workingdir /root
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
buildah unmount --name=$cid
buildah delete --name=$cid
}