Skip to content
This repository has been archived by the owner on Feb 8, 2021. It is now read-only.

Commit

Permalink
add readonly rootfs ut
Browse files Browse the repository at this point in the history
Signed-off-by: Peng Tao <[email protected]>
  • Loading branch information
bergwolf committed Jun 9, 2017
1 parent 89178f6 commit e45920c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
9 changes: 9 additions & 0 deletions hack/lib/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -228,3 +228,12 @@ hyper::test::container_logs_no_newline() {
echo logs result $res
test x$res = "xfoobar"
}

hyper::test::container_readonly_rootfs_and_volume() {
echo "Container rootfs and volume readonly test"
id=$(sudo hyperctl run -p ${HYPER_ROOT}/hack/pods/readonly-rootfs.pod | sed -ne 's/POD id is \(.*\)/\1/p')
res1=$(sudo hyperctl exec $id touch /foobar | grep 'Read-only file system' > /dev/null 2>&1; echo $?)
res2=$(sudo hyperctl exec $id touch /tmp/foobar | grep 'Read-only file system' > /dev/null 2>&1; echo $?)
sudo hyperctl rm $id
test $res1 -eq 0 -a $res2 -eq 0
}
18 changes: 18 additions & 0 deletions hack/pods/readonly-rootfs.pod
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"containers" : [{
"name": "busybox-readonly",
"image": "busybox",
"command": ["/bin/sh"],
"readonly": true,
"volumes": [{
"volume": "tmp",
"path": "/tmp",
"readOnly": true
}]
}],
"volumes": [{
"name": "tmp",
"source": "",
"format": ""
}]
}
1 change: 1 addition & 0 deletions hack/test-cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ __EOF__
hyper::test::imagevolume
hyper::test::force_kill_container
hyper::test::container_logs_no_newline
hyper::test::container_readonly_rootfs_and_volume

stop_hyperd
}
Expand Down

0 comments on commit e45920c

Please sign in to comment.