Add test for network creation
This commit is contained in:
parent
ae70278a9f
commit
a77617ae96
11
default.nix
11
default.nix
@ -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 "$@"
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
31
tests/01-create-network.sh
Normal file
31
tests/01-create-network.sh
Normal 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" ]
|
Loading…
Reference in New Issue
Block a user