Perform garage tests on each of the running nodes

This commit is contained in:
Brian Picciano 2023-09-06 21:06:03 +02:00
parent 8dcc436aaa
commit 96a3ecfe14
4 changed files with 44 additions and 17 deletions

View File

@ -1,13 +1,21 @@
# shellcheck source=../../utils/with-1-data-1-empty-node-cluster.sh # shellcheck source=../../utils/with-1-data-1-empty-node-cluster.sh
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" | wc -l)" = "3" ]
echo "$status" | grep -q '10.6.9.1:3900' 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:3910'
echo "$status" | grep -q '10.6.9.1:3920' echo "$status" | grep -q '10.6.9.1:3920'
buckets="$(isle garage cli bucket list | tail -n+2)" buckets="$(isle garage cli bucket list | tail -n+2)"
[ "$(echo "$buckets" | wc -l)" = 1 ] [ "$(echo "$buckets" | wc -l)" = 1 ]
echo "$buckets" | grep -q 'global-shared' echo "$buckets" | grep -q 'global-shared'
}
as_primus
do_tests
as_secondus
do_tests

View File

@ -1,8 +1,16 @@
# shellcheck source=../../utils/with-1-data-1-empty-node-cluster.sh # shellcheck source=../../utils/with-1-data-1-empty-node-cluster.sh
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)" function do_tests {
[ "$(echo "$files" | jq -s '.|length')" -ge "1" ] files="$(isle garage mc -- tree --json garage)"
[ "$(echo "$files" | jq -s '.|length')" -ge "1" ]
file="$(echo "$files" | jq -sr '.[0].key')" file="$(echo "$files" | jq -sr '.[0].key')"
[ "$(isle garage mc -- cat "garage/$file" | wc -c)" -gt "0" ] [ "$(isle garage mc -- cat "garage/$file" | wc -c)" -gt "0" ]
}
as_primus
do_tests
as_secondus
do_tests

View File

@ -8,4 +8,9 @@ XDG_DATA_HOME="$TMPDIR/.data"
mkdir -p "$TMPDIR" "$XDG_RUNTIME_DIR" "$XDG_DATA_HOME" 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

View File

@ -4,10 +4,17 @@ base="shared/1-data-1-empty"
primus_base="$base/primus" primus_base="$base/primus"
secondus_base="$base/secondus" secondus_base="$base/secondus"
function as_primus {
eval "$($SHELL "$UTILS/shared-daemon-env.sh" "$primus_base")"
}
function as_secondus {
eval "$($SHELL "$UTILS/shared-daemon-env.sh" "$secondus_base")"
}
# Even if it's already intialized, we want to put the caller in primus' # Even if it's already intialized, we want to put the caller in primus'
# environment # environment
eval "$($SHELL "$UTILS/shared-daemon-env.sh" "$primus_base")" as_primus
cd "$TMPDIR"
secondus_bootstrap="$(pwd)/secondus-bootstrap.yml" secondus_bootstrap="$(pwd)/secondus-bootstrap.yml"
@ -61,8 +68,7 @@ EOF
> "$secondus_bootstrap" > "$secondus_bootstrap"
( (
eval "$($SHELL "$UTILS/shared-daemon-env.sh" "$secondus_base")" as_secondus
cd "$TMPDIR"
cat >daemon.yml <<EOF cat >daemon.yml <<EOF
vpn: vpn: