Add test for network creation

This commit is contained in:
Brian Picciano 2023-09-01 17:19:59 +02:00
parent ae70278a9f
commit a77617ae96
2 changed files with 41 additions and 1 deletions

View File

@ -167,6 +167,15 @@ in rec {
tests = pkgs.writeShellScript "isle-tests" '' tests = pkgs.writeShellScript "isle-tests" ''
export PATH=${appImage}/bin:$PATH export PATH=${appImage}/bin:$PATH
test_dir=${./tests} 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 "$@"
''; '';
} }

View File

@ -0,0 +1,31 @@
mkdir a
mkdir b
mkdir c
cat >daemon.yml <<EOF
vpn:
tun:
device: isle-test
storage:
allocations:
- data_path: a/data
meta_path: a/meta
capacity: 100
- data_path: b/data
meta_path: b/meta
capacity: 100
- data_path: c/data
meta_path: c/meta
capacity: 100
EOF
isle admin create-network \
--config-path daemon.yml \
--domain test.isle.com \
--hostname primus \
--ip-net "10.6.9.1/24" \
--name "testing"
[ "$(cat a/meta/isle/rpc_port)" = "3900" ]
[ "$(cat b/meta/isle/rpc_port)" = "3910" ]
[ "$(cat c/meta/isle/rpc_port)" = "3920" ]