From 96a3ecfe14fa97f9170337dd040d336036ed0d59 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Wed, 6 Sep 2023 21:06:03 +0200 Subject: [PATCH] Perform garage tests on each of the running nodes --- tests/cases/garage/00-cli.sh | 24 ++++++++++++------- tests/cases/garage/01-mc.sh | 16 +++++++++---- tests/utils/shared-daemon-env.sh | 7 +++++- .../utils/with-1-data-1-empty-node-cluster.sh | 14 +++++++---- 4 files changed, 44 insertions(+), 17 deletions(-) diff --git a/tests/cases/garage/00-cli.sh b/tests/cases/garage/00-cli.sh index 32f8049..df9828e 100644 --- a/tests/cases/garage/00-cli.sh +++ b/tests/cases/garage/00-cli.sh @@ -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 diff --git a/tests/cases/garage/01-mc.sh b/tests/cases/garage/01-mc.sh index b7dab7f..b8a3456 100644 --- a/tests/cases/garage/01-mc.sh +++ b/tests/cases/garage/01-mc.sh @@ -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 diff --git a/tests/utils/shared-daemon-env.sh b/tests/utils/shared-daemon-env.sh index 48b412a..54103c1 100644 --- a/tests/utils/shared-daemon-env.sh +++ b/tests/utils/shared-daemon-env.sh @@ -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 < "$secondus_bootstrap" ( - eval "$($SHELL "$UTILS/shared-daemon-env.sh" "$secondus_base")" - cd "$TMPDIR" + as_secondus cat >daemon.yml <