diff --git a/.e2e.env.sample b/.e2e.env.sample new file mode 100644 index 00000000..ff5abf44 --- /dev/null +++ b/.e2e.env.sample @@ -0,0 +1 @@ +GANDI_TOKEN=... diff --git a/.gitignore b/.gitignore index f5dd64a2..9a0f910a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ -abra -.vscode/ -vendor/ -.envrc -dist/ *fmtcoverage.html +.e2e.env +.envrc +.vscode/ +abra +dist/ +vendor/ diff --git a/Makefile b/Makefile index 020130f9..666a9bce 100644 --- a/Makefile +++ b/Makefile @@ -43,3 +43,13 @@ loc-author: sort -f | \ uniq -ic | \ sort -n + +e2e: + @docker run \ + -v $$(pwd):/src \ + --env-file .e2e.env \ + debian:bullseye-slim \ + sh -c "\ + apt update && apt install -y wget curl; echo ""; echo ""; \ + cd /src/tests && bash e2e.sh -- --dev \ + " diff --git a/tests/e2e.sh b/tests/e2e.sh new file mode 100755 index 00000000..db887d43 --- /dev/null +++ b/tests/e2e.sh @@ -0,0 +1,80 @@ +#!/bin/bash + +set -e + +ABRA="$HOME/.local/bin/abra -d" +INSTALLER_URL="https://install.abra.coopcloud.tech" + +for arg in "$@"; do + if [ "$arg" == "--dev" ]; then + ABRA="/src/abra -d" + INSTALLER_URL="https://git.coopcloud.tech/coop-cloud/abra/raw/branch/main/scripts/installer/installer" + fi +done + +export PATH=$PATH:$HOME/.local/bin + +echo "========================================================================" +echo "choosing abra executable for test run" +echo "========================================================================" +echo "choosing $ABRA as abra executable" +echo "choosing $INSTALLER_URL as abra installer url" + +echo "" +echo "" + +echo "========================================================================" +echo "latest stable release" +echo "========================================================================" +wget -O- https://install.abra.autonomic.zone | bash +~/.local/bin/abra -v + +echo "" +echo "" + +echo "========================================================================" +echo "latest rc release" +echo "========================================================================" +wget -O- https://install.abra.autonomic.zone | bash -s -- --rc +~/.local/bin/abra -v + +echo "" +echo "" + +echo "========================================================================" +echo "upgrade to stable in-place" +echo "========================================================================" +$ABRA upgrade +~/.local/bin/abra -v + +echo "" +echo "" + +echo "========================================================================" +echo "upgrade to rc in-place" +echo "========================================================================" +$ABRA upgrade --rc +~/.local/bin/abra -v + +echo "" +echo "" + +echo "========================================================================" +echo "autocomplete" +echo "========================================================================" +$ABRA autocomplete bash +$ABRA autocomplete fizsh +$ABRA autocomplete zsh + +echo "" +echo "" + +echo "========================================================================" +echo "record command" +echo "========================================================================" +$ABRA record new -p gandi -t A -n e2e -v 192.157.2.21 coopcloud.tech +$ABRA record list -p gandi coopcloud.tech | grep -q e2e +$ABRA -n record rm -p gandi -t A -n e2e coopcloud.tech + +echo "" +echo ""