Skip to content

Commit 1d8d439

Browse files
committed
tests/lxc-test-rootfs: add idmapped rootfs testcase
I've discovered that we have no test coverage for rootfs "lxc.rootfs.options = idmap=container" at all. Let's add this basic test at least. Signed-off-by: Alexander Mikhalitsyn <[email protected]>
1 parent ca8f4a9 commit 1d8d439

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/tests/lxc-test-rootfs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ set -ex
99
cleanup() {
1010
set +e
1111
lxc-destroy -n lxc-test-rootfs -f
12+
sed -i '/^root:910000:10000/d' /etc/subuid /etc/subgid
1213
if [ $PHASE != "done" ]; then
1314
echo "rootfs test failed at $PHASE"
1415
exit 1
@@ -48,4 +49,20 @@ mkdir /proc/$pid/root/rwtest || ro=1
4849
rmdir /proc/$pid/root/rwtest
4950
ro=0
5051

52+
lxc-stop -n lxc-test-rootfs -k
53+
PHASE=idmapped_rootfs
54+
echo "Starting phase $PHASE"
55+
usermod -v 910000-919999 -w 910000-919999 root
56+
sed -i '/lxc.rootfs.options/d' $config
57+
echo "lxc.idmap = u 0 910000 9999" >> $config
58+
echo "lxc.idmap = g 0 910000 9999" >> $config
59+
echo "lxc.rootfs.options = idmap=container" >> $config
60+
lxc-start -n lxc-test-rootfs
61+
pid=$(lxc-info -n lxc-test-rootfs -p -H)
62+
ro=0
63+
lxc-attach -n lxc-test-rootfs -- mkdir /rwtest || ro=1
64+
[ $ro -ne 1 ]
65+
rmdir /proc/$pid/root/rwtest
66+
ro=0
67+
5168
PHASE=done

0 commit comments

Comments
 (0)