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. # That's it.
tun:
# Name of the tun network device which will route VPN traffic.
device: isle-tun
storage: storage:
# Allocations defined here are used to store data in the distributed 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" '' tests = pkgs.writeShellScript "isle-tests" ''
export PATH=${appImage}/bin:$PATH export PATH=$PATH:${appImage}/bin
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

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

View File

@ -2,10 +2,6 @@ package daemon
import "strconv" import "strconv"
type ConfigTun struct {
Device string `yaml:"device"`
}
type ConfigFirewall struct { type ConfigFirewall struct {
Conntrack ConfigConntrack `yaml:"conntrack"` Conntrack ConfigConntrack `yaml:"conntrack"`
Outbound []ConfigFirewallRule `yaml:"outbound"` Outbound []ConfigFirewallRule `yaml:"outbound"`
@ -54,7 +50,6 @@ type Config struct {
VPN struct { VPN struct {
PublicAddr string `yaml:"public_addr"` PublicAddr string `yaml:"public_addr"`
Firewall ConfigFirewall `yaml:"firewall"` Firewall ConfigFirewall `yaml:"firewall"`
Tun ConfigTun `yaml:"tun"`
} `yaml:"vpn"` } `yaml:"vpn"`
Storage struct { Storage struct {
Allocations []ConfigStorageAllocation 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 set -e
REGEXS=()
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
case $1 in case $1 in
-h|--help)
cat <<EOF
USAGE: [flags] [test regexs...]
FLAGS
--keep-tmp
--verbose (-v)
--help (-h)
EOF
exit 1
;;
-v|--verbose) -v|--verbose)
VERBOSE=1 VERBOSE=1
shift shift;
;;
--keep-tmp)
KEEP_TMP=1
shift
;; ;;
*) *)
REGEXS+=("$1") echo "USAGE: [-v|--verbose]"
shift exit 1
;; ;;
esac esac
done done
@ -34,7 +18,7 @@ cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null
root=$(pwd) root=$(pwd)
TMPDIR="$(mktemp --tmpdir -d isle-tests.XXXXXX)" 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 export TMPDIR
echo "tmp dir is $TMPDIR" echo "tmp dir is $TMPDIR"
@ -46,35 +30,25 @@ test_files=$(
| sort -n\ | 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" echo -e "number of tests: $(echo "$test_files" | wc -l)\n"
for file in $test_files; do for file in $test_files; do
echo "$file" echo "$file"
[ -z "$VERBOSE" ] && output="$TMPDIR/$file.log" || output=/dev/stdout [ -z "$VERBOSE" ] && output="$TMPDIR/$file.log" || output=/dev/stdout
( tmp="$TMPDIR/$file.tmp"
export TMPDIR="$TMPDIR/$file.tmp" mkdir -p "$tmp"
export XDG_RUNTIME_DIR="$TMPDIR/.run"
export XDG_DATA_HOME="$TMPDIR/.data"
mkdir -p "$TMPDIR" "$XDG_RUNTIME_DIR" "$XDG_DATA_HOME" if ! (cd "$tmp" && TMPDIR="$tmp" $SHELL -e -x "$root/$file" >"$output" 2>&1); then
cd "$TMPDIR" echo "$file FAILED"
if [ -z "$VERBOSE" ]; then
if ! $SHELL -e -x "$root/$file" >"$output" 2>&1; then echo "output of test is as follows"
echo "$file FAILED" echo "------------------------------"
if [ -z "$VERBOSE" ]; then cat "$TMPDIR/$file.log"
echo "output of test is as follows" echo "------------------------------"
echo "------------------------------"
cat "$output"
echo "------------------------------"
fi
exit 1
fi fi
) exit 1
fi
done done
echo -e '\nall tests succeeded!' echo -e '\nall tests succeeded!'