Skip to content

Commit f65276d

Browse files
committed
tests/int/helpers: rm $bundle handling
It is not used since PR 2757, as all tests are run with cd to bundle directory. runc_spec argument count checking is removed since otherwise shellcheck complains: > SC2120: runc_spec references arguments, but none are ever passed. Signed-off-by: Kir Kolyshkin <[email protected]>
1 parent 3023e6c commit f65276d

File tree

1 file changed

+7
-21
lines changed

1 file changed

+7
-21
lines changed

tests/integration/helpers.bash

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -47,44 +47,34 @@ function __runc() {
4747
"$RUNC" ${RUNC_USE_SYSTEMD+--systemd-cgroup} --root "$ROOT/state" "$@"
4848
}
4949

50-
# Wrapper for runc spec, which takes only one argument (the bundle path).
50+
# Wrapper for runc spec.
5151
function runc_spec() {
52-
! [[ "$#" > 1 ]]
53-
5452
local args=()
55-
local bundle=""
56-
5753
if [ "$ROOTLESS" -ne 0 ]; then
5854
args+=("--rootless")
5955
fi
60-
if [ "$#" -ne 0 ]; then
61-
bundle="$1"
62-
args+=("--bundle" "$bundle")
63-
fi
6456

6557
runc spec "${args[@]}"
6658

6759
# Always add additional mappings if we have idmaps.
6860
if [[ "$ROOTLESS" -ne 0 ]] && [[ "$ROOTLESS_FEATURES" == *"idmap"* ]]; then
69-
runc_rootless_idmap "$bundle"
61+
runc_rootless_idmap
7062
fi
7163
}
7264

7365
# Helper function to reformat config.json file. Input uses jq syntax.
7466
function update_config() {
75-
bundle="${2:-.}"
76-
jq "$1" "$bundle/config.json" | awk 'BEGIN{RS="";getline<"-";print>ARGV[1]}' "$bundle/config.json"
67+
jq "$1" "./config.json" | awk 'BEGIN{RS="";getline<"-";print>ARGV[1]}' "./config.json"
7768
}
7869

7970
# Shortcut to add additional uids and gids, based on the values set as part of
8071
# a rootless configuration.
8172
function runc_rootless_idmap() {
82-
bundle="${1:-.}"
8373
update_config ' .mounts |= map((select(.type == "devpts") | .options += ["gid=5"]) // .)
8474
| .linux.uidMappings += [{"hostID": '"$ROOTLESS_UIDMAP_START"', "containerID": 1000, "size": '"$ROOTLESS_UIDMAP_LENGTH"'}]
8575
| .linux.gidMappings += [{"hostID": '"$ROOTLESS_GIDMAP_START"', "containerID": 100, "size": 1}]
8676
| .linux.gidMappings += [{"hostID": '"$(($ROOTLESS_GIDMAP_START + 10))"', "containerID": 1, "size": 20}]
87-
| .linux.gidMappings += [{"hostID": '"$(($ROOTLESS_GIDMAP_START + 100))"', "containerID": 1000, "size": '"$(($ROOTLESS_GIDMAP_LENGTH - 1000))"'}]' $bundle
77+
| .linux.gidMappings += [{"hostID": '"$(($ROOTLESS_GIDMAP_START + 100))"', "containerID": 1000, "size": '"$(($ROOTLESS_GIDMAP_LENGTH - 1000))"'}]'
8878
}
8979

9080
# Returns systemd version as a number (-1 if systemd is not enabled/supported).
@@ -141,7 +131,6 @@ function init_cgroup_paths() {
141131
# Randomize cgroup path(s), and update cgroupsPath in config.json.
142132
# This function sets a few cgroup-related variables.
143133
function set_cgroups_path() {
144-
bundle="${1:-.}"
145134
init_cgroup_paths
146135

147136
local rnd="$RANDOM"
@@ -165,7 +154,7 @@ function set_cgroups_path() {
165154
CGROUP_PATH=${CGROUP_BASE_PATH}${REL_CGROUPS_PATH}
166155
fi
167156

168-
update_config '.linux.cgroupsPath |= "'"${OCI_CGROUPS_PATH}"'"' "$bundle"
157+
update_config '.linux.cgroupsPath |= "'"${OCI_CGROUPS_PATH}"'"'
169158
}
170159

171160
# Get a value from a cgroup file.
@@ -259,15 +248,12 @@ function check_cpu_weight() {
259248

260249
# Helper function to set a resources limit
261250
function set_resources_limit() {
262-
bundle="${1:-.}"
263-
update_config '.linux.resources.pids.limit |= 100' $bundle
251+
update_config '.linux.resources.pids.limit |= 100'
264252
}
265253

266254
# Helper function to make /sys/fs/cgroup writable
267255
function set_cgroup_mount_writable() {
268-
bundle="${1:-.}"
269-
update_config '.mounts |= map((select(.type == "cgroup") | .options -= ["ro"]) // .)' \
270-
$bundle
256+
update_config '.mounts |= map((select(.type == "cgroup") | .options -= ["ro"]) // .)'
271257
}
272258

273259
# Fails the current test, providing the error given.

0 commit comments

Comments
 (0)