refactor: integration -> manual

This commit is contained in:
2023-08-02 08:45:24 +02:00
parent 2cd453ae8d
commit c9144d90f3
14 changed files with 0 additions and 0 deletions

View File

@ -1,4 +0,0 @@
GANDI_TOKEN=...
HCLOUD_TOKEN=...
REGISTRY_PASSWORD=...
REGISTRY_USERNAME=...

View File

@ -1 +0,0 @@
logs

View File

@ -1,28 +0,0 @@
# integration tests
> You need to be a member of Autonomic Co-op to run these tests, sorry!
`testfunctions.sh` contains the functions necessary to save and manipulate
logs. Run `test_all.sh logdir` to run tests specified in that file and save the
logs to `logdir`.
When creating new tests, make sure the test command is a one-liner (you can use
`;` to separate commands). Include `testfunctions.sh` and then write your tests
like this:
```
run_test '$ABRA other stuff here'
```
By default, the testing script will ask after every command if the execution
succeeded. If you reply `n`, it will log the test in the `logdir`. If you want
all tests to run without questions, run `export logall=yes` before executing
the test script.
To run tests, you'll need to prepare your environment:
```
cp .envrc.sample .envrc # fill out values...
direnv allow
./test_all.sh logs
```

View File

@ -1,14 +0,0 @@
#!/bin/bash
source ./testfunctions.sh
source ./common.sh
run_test '$ABRA app ls'
run_test '$ABRA app ls --status'
run_test '$ABRA app ls --type wordpress'
run_test '$ABRA app ls --type wordpress --server swarm.autonomic.zone'
run_test '$ABRA app ls --type wordpress --server swarm.autonomic.zone --status'

View File

@ -1,12 +0,0 @@
#!/bin/bash
source ./testfunctions.sh
source ./common.sh
run_test '$ABRA autocomplete bash'
run_test '$ABRA autocomplete fizsh'
run_test '$ABRA autocomplete zsh'
run_test '$ABRA autocomplete fish'

View File

@ -1,8 +0,0 @@
#!/bin/bash
source ./testfunctions.sh
source ./common.sh
run_test '$ABRA catalogue generate'
run_test '$ABRA catalogue generate gitea'

View File

@ -1,14 +0,0 @@
#!/bin/bash
source ./testfunctions.sh
source ./common.sh
create_server_app_recipe
run_test '$ABRA app cmd foo.com test --local'
run_test '$ABRA app cmd foo.com test --local -- foo'
run_test '$ABRA app cmd foo.com test --local -- foo bar baz'
clean_server_app_recipe

View File

@ -1,25 +0,0 @@
#!/bin/bash
set -e
create_server_app_recipe() {
ln -srf ../resources/testapp ~/.abra/servers/foo.com
ln -srf ../resources/testrecipe ~/.abra/recipes
}
clean_server_app_recipe() {
unlink ~/.abra/servers/foo.com
unlink ~/.abra/recipes/testrecipe
}
function init() {
ABRA="$(pwd)/../../abra"
INSTALLER_URL="https://git.coopcloud.tech/coop-cloud/abra/raw/branch/main/scripts/installer/installer"
export PATH=$PATH:$HOME/.local/bin
echo "choosing $ABRA as abra command"
echo "choosing $INSTALLER_URL as abra installer url"
}
init "$@"

View File

@ -1,12 +0,0 @@
#!/bin/bash
source ./testfunctions.sh
source ./common.sh
run_test 'wget -O- https://install.abra.autonomic.zone | bash; ~/.local/bin/abra -v'
run_test 'wget -O- https://install.abra.autonomic.zone | bash -s -- --rc; ~/.local/bin/abra -v'
run_test '$ABRA upgrade; ~/.local/bin/abra -v'
run_test '$ABRA upgrade --rc; ~/.local/bin/abra -v'

View File

@ -1,14 +0,0 @@
#!/bin/bash
source ./testfunctions.sh
source ./common.sh
run_test '$ABRA recipe new testrecipe'
run_test '$ABRA recipe list'
run_test '$ABRA recipe list --pattern cloud'
run_test '$ABRA recipe versions peertube'
run_test '$ABRA recipe lint gitea'

View File

@ -1,21 +0,0 @@
#!/bin/bash
source ./testfunctions.sh
source ./common.sh
run_test "$ABRA record new \
--provider gandi \
--record-type A \
--record-name integration-tests \
--record-value 192.157.2.21 \
--no-input coopcloud.tech \
"
run_test '$ABRA record list --provider gandi coopcloud.tech'
run_test "$ABRA record rm \
--provider gandi \
--record-type A \
--record-name integration-tests \
--no-input coopcloud.tech
"

View File

@ -1,10 +0,0 @@
#!/bin/bash
source ./testfunctions.sh
source ./common.sh
run_test '$ABRA server new --provider hetzner-cloud --hetzner-name integration-tests --no-input'
run_test '$ABRA server ls'
run_test '$ABRA server rm --provider hetzner-cloud --hetzner-name int-core --server --no-input'

View File

@ -1,24 +0,0 @@
#!/bin/bash
if [ -z $1 ]; then
echo "usage: ./test_all.sh logdir"
exit
fi
res_dir=$1/
if [[ ! -d "$res_dir" ]]; then
mkdir "$res_dir"
fi
# Usage: run_test [number] [name] [command]
run_test () {
logfile="$res_dir/$1-$2.log"
echo $logfile
}
testScripts=("app.sh" "autocomplete.sh" "catalogue.sh" "install.sh" "recipe.sh" "records.sh" "server.sh", "cmd.sh")
for i in "${testScripts[@]}"; do
cmd="./$i $res_dir${i/sh/log}"
eval $cmd
done

View File

@ -1,35 +0,0 @@
#!/bin/bash
if [ -z $1 ]; then
logfile=/dev/null
else
logfile=$1
fi
if [ -z $logall ]; then
logall=no
fi
run_test () {
if [ -z "$@" ]; then
echo "run_test needs a command to run"
else
tempLogfile=$(mktemp)
cmd=$(eval echo "$@")
echo -e "\\n------------ INPUT -------------------" | tee -a $tempLogfile
echo "$" "$cmd" | tee -a $tempLogfile
echo "------------ OUTPUT ------------------" | tee -a $tempLogfile
eval $cmd 2>&1 | tee -a $tempLogfile
if [ $logall = "yes" ]; then
cat $tempLogfile >> $logfile
echo -e "\\n\\n" >> $logfile
else
read -N 1 -p "Did the test pass? [y/n]: " pass
if [ $pass = 'n' ]; then
cat $tempLogfile >> $logfile
echo -e "\\n\\n" >> $logfile
fi
fi
rm $tempLogfile
fi
}