Compare commits

..

No commits in common. "a77617ae9684549da373fd6dc2d56cde5fb43386" and "bc798acffa1e7fa05ac1155c5c7bdcefe70892cc" have entirely different histories.

6 changed files with 18 additions and 93 deletions

View File

@ -52,10 +52,6 @@ vpn:
# That's it.
tun:
# Name of the tun network device which will route VPN traffic.
device: isle-tun
storage:
# Allocations defined here are used to store data in the distributed storage

View File

@ -165,17 +165,8 @@ in rec {
};
tests = pkgs.writeShellScript "isle-tests" ''
export PATH=${appImage}/bin:$PATH
export PATH=$PATH:${appImage}/bin
test_dir=${./tests}
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 "$@"
exec $SHELL $test_dir/entrypoint.sh "$@"
'';
}

View File

@ -68,7 +68,7 @@ func nebulaPmuxProcConfig(
"respond": true,
},
"tun": map[string]interface{}{
"dev": daemonConfig.VPN.Tun.Device,
"dev": "isle-tun",
},
"firewall": daemonConfig.VPN.Firewall,
}

View File

@ -2,10 +2,6 @@ package daemon
import "strconv"
type ConfigTun struct {
Device string `yaml:"device"`
}
type ConfigFirewall struct {
Conntrack ConfigConntrack `yaml:"conntrack"`
Outbound []ConfigFirewallRule `yaml:"outbound"`
@ -54,7 +50,6 @@ type Config struct {
VPN struct {
PublicAddr string `yaml:"public_addr"`
Firewall ConfigFirewall `yaml:"firewall"`
Tun ConfigTun `yaml:"tun"`
} `yaml:"vpn"`
Storage struct {
Allocations []ConfigStorageAllocation

View File

@ -1,31 +0,0 @@
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" ]

View File

@ -1,30 +1,14 @@
set -e
REGEXS=()
while [[ $# -gt 0 ]]; do
case $1 in
-h|--help)
cat <<EOF
USAGE: [flags] [test regexs...]
FLAGS
--keep-tmp
--verbose (-v)
--help (-h)
EOF
exit 1
;;
-v|--verbose)
VERBOSE=1
shift
;;
--keep-tmp)
KEEP_TMP=1
shift
shift;
;;
*)
REGEXS+=("$1")
shift
echo "USAGE: [-v|--verbose]"
exit 1
;;
esac
done
@ -34,7 +18,7 @@ cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null
root=$(pwd)
TMPDIR="$(mktemp --tmpdir -d isle-tests.XXXXXX)"
if [ -z "$KEEP_TMP" ]; then trap 'rm -rf $TMPDIR' EXIT; fi
trap 'rm -rf $TMPDIR' EXIT
export TMPDIR
echo "tmp dir is $TMPDIR"
@ -46,35 +30,25 @@ test_files=$(
| sort -n\
)
for r in "${REGEXS[@]}"; do
test_files="$(echo "$test_files" | grep -P "$r")"
done
echo -e "number of tests: $(echo "$test_files" | wc -l)\n"
for file in $test_files; do
echo "$file"
[ -z "$VERBOSE" ] && output="$TMPDIR/$file.log" || output=/dev/stdout
(
export TMPDIR="$TMPDIR/$file.tmp"
export XDG_RUNTIME_DIR="$TMPDIR/.run"
export XDG_DATA_HOME="$TMPDIR/.data"
tmp="$TMPDIR/$file.tmp"
mkdir -p "$tmp"
mkdir -p "$TMPDIR" "$XDG_RUNTIME_DIR" "$XDG_DATA_HOME"
cd "$TMPDIR"
if ! $SHELL -e -x "$root/$file" >"$output" 2>&1; then
if ! (cd "$tmp" && TMPDIR="$tmp" $SHELL -e -x "$root/$file" >"$output" 2>&1); then
echo "$file FAILED"
if [ -z "$VERBOSE" ]; then
echo "output of test is as follows"
echo "------------------------------"
cat "$output"
cat "$TMPDIR/$file.log"
echo "------------------------------"
fi
exit 1
fi
)
done
echo -e '\nall tests succeeded!'