From a77617ae9684549da373fd6dc2d56cde5fb43386 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Fri, 1 Sep 2023 17:19:59 +0200 Subject: [PATCH] Add test for network creation --- default.nix | 11 ++++++++++- tests/01-create-network.sh | 31 +++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 tests/01-create-network.sh diff --git a/default.nix b/default.nix index c5913f0..a281680 100644 --- a/default.nix +++ b/default.nix @@ -167,6 +167,15 @@ in rec { tests = pkgs.writeShellScript "isle-tests" '' export PATH=${appImage}/bin:$PATH test_dir=${./tests} - exec $SHELL $test_dir/entrypoint.sh "$@" + + this_user="$(${pkgs.coreutils}/bin/whoami)" + + echo "Requesting sudo in order to set thread capabilities, will drop back down to user '$this_user' immediately" + sudo ${pkgs.libcap}/bin/capsh \ + --caps="cap_net_admin+eip cap_setpcap,cap_setuid,cap_setgid+ep" \ + --keep=1 \ + --user="$this_user" \ + --addamb=cap_net_admin \ + -- $test_dir/entrypoint.sh "$@" ''; } diff --git a/tests/01-create-network.sh b/tests/01-create-network.sh new file mode 100644 index 0000000..025a1e2 --- /dev/null +++ b/tests/01-create-network.sh @@ -0,0 +1,31 @@ +mkdir a +mkdir b +mkdir c + +cat >daemon.yml <