mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
tests: rename AUX_{DIR,UID} to ROOTLESS_AUX_*
Also, fix the typo (AUX_DIX) in cleanup.
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit ac2a53be8e)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
+11
-11
@@ -33,25 +33,25 @@ function teardown() {
|
|||||||
@test "runc create sets up user before chdir to cwd if needed" {
|
@test "runc create sets up user before chdir to cwd if needed" {
|
||||||
requires rootless rootless_idmap
|
requires rootless rootless_idmap
|
||||||
|
|
||||||
# Some setup for this test (AUX_DIR and AUX_UID) is done
|
# Some setup for this test (ROOTLESS_AUX_DIR and ROOTLESS_AUX_UID) is done
|
||||||
# by rootless.sh. Check that setup is done...
|
# by rootless.sh. Check that setup is done...
|
||||||
if [[ ! -v AUX_UID || ! -v AUX_DIR || ! -d "$AUX_DIR" ]]; then
|
if [[ ! -v ROOTLESS_AUX_UID || ! -v ROOTLESS_AUX_DIR || ! -d "$ROOTLESS_AUX_DIR" ]]; then
|
||||||
skip "bad/unset AUX_DIR/AUX_UID"
|
skip "bad/unset ROOTLESS_AUX_DIR/ROOTLESS_AUX_UID"
|
||||||
fi
|
fi
|
||||||
# ... and is correct, i.e. the current user
|
# ... and is correct, i.e. the current user
|
||||||
# does not have permission to access AUX_DIR.
|
# does not have permission to access ROOTLESS_AUX_DIR.
|
||||||
if ls -l "$AUX_DIR" 2>/dev/null; then
|
if ls -l "$ROOTLESS_AUX_DIR" 2>/dev/null; then
|
||||||
skip "bad AUX_DIR permissions"
|
skip "bad ROOTLESS_AUX_DIR permissions"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
update_config ' .mounts += [{
|
update_config ' .mounts += [{
|
||||||
source: "'"$AUX_DIR"'",
|
source: "'"$ROOTLESS_AUX_DIR"'",
|
||||||
destination: "'"$AUX_DIR"'",
|
destination: "'"$ROOTLESS_AUX_DIR"'",
|
||||||
options: ["bind"]
|
options: ["bind"]
|
||||||
}]
|
}]
|
||||||
| .process.user.uid = '"$AUX_UID"'
|
| .process.user.uid = '"$ROOTLESS_AUX_UID"'
|
||||||
| .process.cwd = "'"$AUX_DIR"'"
|
| .process.cwd = "'"$ROOTLESS_AUX_DIR"'"
|
||||||
| .process.args |= ["ls", "'"$AUX_DIR"'"]'
|
| .process.args |= ["ls", "'"$ROOTLESS_AUX_DIR"'"]'
|
||||||
|
|
||||||
runc run test_busybox
|
runc run test_busybox
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
|
|||||||
+8
-8
@@ -54,15 +54,15 @@ function enable_idmap() {
|
|||||||
[ -e /usr/bin/unused-newuidmap ] && mv /usr/bin/{unused-,}newuidmap
|
[ -e /usr/bin/unused-newuidmap ] && mv /usr/bin/{unused-,}newuidmap
|
||||||
[ -e /usr/bin/unused-newgidmap ] && mv /usr/bin/{unused-,}newgidmap
|
[ -e /usr/bin/unused-newgidmap ] && mv /usr/bin/{unused-,}newgidmap
|
||||||
|
|
||||||
# Create a directory owned by $AUX_UID inside container, to be used
|
# Create a directory owned by $ROOTLESS_AUX_UID inside container, to be used
|
||||||
# by a test case in cwd.bats. This setup can't be done by the test itself,
|
# by a test case in cwd.bats. This setup can't be done by the test itself,
|
||||||
# as it needs root for chown.
|
# as it needs root for chown.
|
||||||
export AUX_UID=1024
|
export ROOTLESS_AUX_UID=1024
|
||||||
AUX_DIR="$(mktemp -d)"
|
ROOTLESS_AUX_DIR="$(mktemp -d)"
|
||||||
# 1000 is linux.uidMappings.containerID value,
|
# 1000 is linux.uidMappings.containerID value,
|
||||||
# as set by runc_rootless_idmap
|
# as set by runc_rootless_idmap
|
||||||
chown "$((ROOTLESS_UIDMAP_START - 1000 + AUX_UID))" "$AUX_DIR"
|
chown "$((ROOTLESS_UIDMAP_START - 1000 + ROOTLESS_AUX_UID))" "$ROOTLESS_AUX_DIR"
|
||||||
export AUX_DIR
|
export ROOTLESS_AUX_DIR
|
||||||
}
|
}
|
||||||
|
|
||||||
function disable_idmap() {
|
function disable_idmap() {
|
||||||
@@ -81,9 +81,9 @@ function disable_idmap() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function cleanup() {
|
function cleanup() {
|
||||||
if [ -v AUX_DIR ]; then
|
if [ -v ROOTLESS_AUX_DIR ]; then
|
||||||
rmdir "$AUX_DIR"
|
rmdir "$ROOTLESS_AUX_DIR"
|
||||||
unset AUX_DIX
|
unset ROOTLESS_AUX_DIR
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user