Compare commits

...

2 Commits

Author SHA1 Message Date
Brian Picciano 5ee80b1b7d Add tests for DNS 9 months ago
Brian Picciano 96a3ecfe14 Perform garage tests on each of the running nodes 9 months ago
  1. 1
      default.nix
  2. 3
      tests.sh
  3. 3
      tests/NOTES.txt
  4. 20
      tests/cases/dnsmasq/00-hosts.sh
  5. 24
      tests/cases/garage/00-cli.sh
  6. 16
      tests/cases/garage/01-mc.sh
  7. 7
      tests/utils/shared-daemon-env.sh
  8. 24
      tests/utils/with-1-data-1-empty-node-cluster.sh

@ -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 "$@"

@ -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" "$@"

@ -0,0 +1,3 @@
Ctrl+A X -> exits
qemu-system-aarch64 -M virt -nographic -cdrom tests/alpine-virt-3.17.3-aarch64.iso

@ -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,13 +1,21 @@
# shellcheck source=../../utils/with-1-data-1-empty-node-cluster.sh
source "$UTILS"/with-1-data-1-empty-node-cluster.sh
status="$(isle garage cli status | tail -n+3)"
function do_tests {
status="$(isle garage cli status | tail -n+3)"
[ "$(echo "$status" | wc -l)" = "3" ]
echo "$status" | grep -q '10.6.9.1:3900'
echo "$status" | grep -q '10.6.9.1:3910'
echo "$status" | grep -q '10.6.9.1:3920'
[ "$(echo "$status" | wc -l)" = "3" ]
echo "$status" | grep -q '10.6.9.1:3900'
echo "$status" | grep -q '10.6.9.1:3910'
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'
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
files="$(isle garage mc -- tree --json garage)"
[ "$(echo "$files" | jq -s '.|length')" -ge "1" ]
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" ]
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…
Cancel
Save