Compare commits
2 Commits
8dcc436aaa
...
5ee80b1b7d
Author | SHA1 | Date | |
---|---|---|---|
|
5ee80b1b7d | ||
|
96a3ecfe14 |
@ -170,6 +170,7 @@ in rec {
|
||||
pkgs.busybox
|
||||
pkgs.yq-go
|
||||
pkgs.jq
|
||||
pkgs.dig
|
||||
]}
|
||||
export SHELL=${pkgs.bash}/bin/bash
|
||||
exec ${pkgs.bash}/bin/bash ${./tests}/entrypoint.sh "$@"
|
||||
|
3
tests.sh
3
tests.sh
@ -8,8 +8,9 @@ this_user="$(whoami)"
|
||||
echo "Requesting sudo in order to set thread capabilities, will drop back down to user '$this_user' immediately"
|
||||
|
||||
sudo -E capsh \
|
||||
--caps="cap_net_admin+eip cap_setpcap,cap_setuid,cap_setgid+ep" \
|
||||
--caps="cap_net_admin,cap_net_bind_service+eip cap_setpcap,cap_setuid,cap_setgid+ep" \
|
||||
--keep=1 \
|
||||
--user="$this_user" \
|
||||
--addamb=cap_net_admin \
|
||||
--addamb=cap_net_bind_service \
|
||||
-- "$entrypoint" "$@"
|
||||
|
3
tests/NOTES.txt
Normal file
3
tests/NOTES.txt
Normal file
@ -0,0 +1,3 @@
|
||||
Ctrl+A X -> exits
|
||||
|
||||
qemu-system-aarch64 -M virt -nographic -cdrom tests/alpine-virt-3.17.3-aarch64.iso
|
20
tests/cases/dnsmasq/00-hosts.sh
Normal file
20
tests/cases/dnsmasq/00-hosts.sh
Normal file
@ -0,0 +1,20 @@
|
||||
# shellcheck source=../../utils/with-1-data-1-empty-node-cluster.sh
|
||||
source "$UTILS"/with-1-data-1-empty-node-cluster.sh
|
||||
|
||||
function assert_a {
|
||||
want_ip="$1"
|
||||
hostname="$2"
|
||||
r="$(dig @"$current_ip" +noall +answer "$hostname")"
|
||||
echo "$r" | grep -q "$want_ip"
|
||||
}
|
||||
|
||||
as_primus
|
||||
assert_a "$primus_ip" primus.hosts.shared.test
|
||||
|
||||
# TODO This doesn't work at present, there would need to be some mechanism to
|
||||
# block the test until secondus' bootstrap info can propagate to primus.
|
||||
#assert_a "$secondus_ip" secondus.hosts.shared.test
|
||||
|
||||
as_secondus
|
||||
assert_a "$primus_ip" primus.hosts.shared.test
|
||||
assert_a "$secondus_ip" secondus.hosts.shared.test
|
@ -1,6 +1,7 @@
|
||||
# shellcheck source=../../utils/with-1-data-1-empty-node-cluster.sh
|
||||
source "$UTILS"/with-1-data-1-empty-node-cluster.sh
|
||||
|
||||
function do_tests {
|
||||
status="$(isle garage cli status | tail -n+3)"
|
||||
|
||||
[ "$(echo "$status" | wc -l)" = "3" ]
|
||||
@ -11,3 +12,10 @@ echo "$status" | grep -q '10.6.9.1:3920'
|
||||
buckets="$(isle garage cli bucket list | tail -n+2)"
|
||||
[ "$(echo "$buckets" | wc -l)" = 1 ]
|
||||
echo "$buckets" | grep -q 'global-shared'
|
||||
}
|
||||
|
||||
as_primus
|
||||
do_tests
|
||||
|
||||
as_secondus
|
||||
do_tests
|
||||
|
@ -1,8 +1,16 @@
|
||||
# shellcheck source=../../utils/with-1-data-1-empty-node-cluster.sh
|
||||
source "$UTILS"/with-1-data-1-empty-node-cluster.sh
|
||||
|
||||
function do_tests {
|
||||
files="$(isle garage mc -- tree --json garage)"
|
||||
[ "$(echo "$files" | jq -s '.|length')" -ge "1" ]
|
||||
|
||||
file="$(echo "$files" | jq -sr '.[0].key')"
|
||||
[ "$(isle garage mc -- cat "garage/$file" | wc -c)" -gt "0" ]
|
||||
}
|
||||
|
||||
as_primus
|
||||
do_tests
|
||||
|
||||
as_secondus
|
||||
do_tests
|
||||
|
@ -8,4 +8,9 @@ XDG_DATA_HOME="$TMPDIR/.data"
|
||||
|
||||
mkdir -p "$TMPDIR" "$XDG_RUNTIME_DIR" "$XDG_DATA_HOME"
|
||||
|
||||
echo "export TMPDIR='$TMPDIR' XDG_RUNTIME_DIR='$XDG_RUNTIME_DIR' XDG_DATA_HOME='$XDG_DATA_HOME'"
|
||||
cat <<EOF
|
||||
export TMPDIR="$TMPDIR"
|
||||
export XDG_RUNTIME_DIR="$XDG_RUNTIME_DIR"
|
||||
export XDG_DATA_HOME="$XDG_DATA_HOME"
|
||||
cd "$TMPDIR"
|
||||
EOF
|
||||
|
@ -1,13 +1,26 @@
|
||||
set -e
|
||||
|
||||
base="shared/1-data-1-empty"
|
||||
|
||||
primus_base="$base/primus"
|
||||
primus_ip="10.6.9.1"
|
||||
|
||||
secondus_base="$base/secondus"
|
||||
secondus_ip="10.6.9.2"
|
||||
|
||||
function as_primus {
|
||||
current_ip="$primus_ip"
|
||||
eval "$($SHELL "$UTILS/shared-daemon-env.sh" "$primus_base")"
|
||||
}
|
||||
|
||||
function as_secondus {
|
||||
current_ip="$secondus_ip"
|
||||
eval "$($SHELL "$UTILS/shared-daemon-env.sh" "$secondus_base")"
|
||||
}
|
||||
|
||||
# Even if it's already intialized, we want to put the caller in primus'
|
||||
# environment
|
||||
eval "$($SHELL "$UTILS/shared-daemon-env.sh" "$primus_base")"
|
||||
cd "$TMPDIR"
|
||||
as_primus
|
||||
|
||||
secondus_bootstrap="$(pwd)/secondus-bootstrap.yml"
|
||||
|
||||
@ -41,7 +54,7 @@ EOF
|
||||
--config-path daemon.yml \
|
||||
--domain shared.test \
|
||||
--hostname primus \
|
||||
--ip-net "10.6.9.1/24" \
|
||||
--ip-net "$current_ip/24" \
|
||||
--name "testing" \
|
||||
> admin.yml
|
||||
|
||||
@ -57,12 +70,11 @@ EOF
|
||||
isle admin create-bootstrap \
|
||||
--admin-path admin.yml \
|
||||
--hostname secondus \
|
||||
--ip 10.6.9.2 \
|
||||
--ip "$secondus_ip" \
|
||||
> "$secondus_bootstrap"
|
||||
|
||||
(
|
||||
eval "$($SHELL "$UTILS/shared-daemon-env.sh" "$secondus_base")"
|
||||
cd "$TMPDIR"
|
||||
as_secondus
|
||||
|
||||
cat >daemon.yml <<EOF
|
||||
vpn:
|
||||
|
Loading…
Reference in New Issue
Block a user