File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change 1- #! /usr/bin/env sh
1+ #! /usr/bin/env bash
22#
33# Run CNI plugin tests.
44#
@@ -18,6 +18,23 @@ testrun() {
1818 sudo -E sh -c " umask 0; PATH=${GOPATH} /bin:$( pwd) /bin:${PATH} go test -race $* "
1919}
2020
21+ ensure_sysctl () {
22+ local key
23+ local val
24+ local existing
25+
26+ key=" $1 "
27+ val=" $2 "
28+ existing=" $( sysctl -ben " $key " ) "
29+
30+ sysctl -r
31+
32+ if [ " $val " -ne " $existing " ]; then
33+ echo " sudo sysctl -we '$key '='$val '"
34+ sudo sysctl -we " $key " =" $val "
35+ fi
36+ }
37+
2138COVERALLS=${COVERALLS:- " " }
2239
2340if [ -n " ${COVERALLS} " ]; then
4057
4158# Run the pkg/ns tests as non root user
4259mkdir -p /tmp/cni-rootless
60+ ensure_sysctl kernel.unprivileged_userns_clone 1
61+ ensure_sysctl kernel.apparmor_restrict_unprivileged_userns 0
62+
4363(export XDG_RUNTIME_DIR=/tmp/cni-rootless; cd pkg/ns/; unshare -rmn go test)
You can’t perform that action at this time.
0 commit comments