forked from coop-cloud/abra
test: break up integration, rejig manual
This commit is contained in:
parent
cb210d0c81
commit
afeee1270e
|
@ -4,4 +4,5 @@
|
||||||
.vscode/
|
.vscode/
|
||||||
abra
|
abra
|
||||||
dist/
|
dist/
|
||||||
|
tests/integration/.abra/catalogue
|
||||||
vendor/
|
vendor/
|
||||||
|
|
12
Makefile
12
Makefile
|
@ -43,15 +43,3 @@ loc-author:
|
||||||
sort -f | \
|
sort -f | \
|
||||||
uniq -ic | \
|
uniq -ic | \
|
||||||
sort -n
|
sort -n
|
||||||
|
|
||||||
int-core:
|
|
||||||
@docker run \
|
|
||||||
-v $$(pwd):/src \
|
|
||||||
--env-file .e2e.env \
|
|
||||||
debian:bullseye-slim \
|
|
||||||
sh -c "\
|
|
||||||
apt update && apt install -y wget curl git; echo ""; echo ""; \
|
|
||||||
git config --global user.email 'e2e@coopcloud.tech'; \
|
|
||||||
git config --global user.name 'e2e'; \
|
|
||||||
cd /src/tests/integration && bash core.sh -- --dev \
|
|
||||||
"
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
TYPE=gitea
|
|
@ -0,0 +1 @@
|
||||||
|
TYPE=wordpress
|
|
@ -0,0 +1 @@
|
||||||
|
TYPE=wordpress
|
|
@ -0,0 +1,4 @@
|
||||||
|
GANDI_TOKEN=...
|
||||||
|
HCLOUD_TOKEN=...
|
||||||
|
REGISTRY_PASSWORD=...
|
||||||
|
REGISTRY_USERNAME=...
|
|
@ -0,0 +1,7 @@
|
||||||
|
FROM debian:bullseye-slim
|
||||||
|
|
||||||
|
RUN apt update && apt install -y wget curl git;
|
||||||
|
|
||||||
|
RUN git config --global user.email "integration-tests@coopcloud.tech";
|
||||||
|
|
||||||
|
RUN git config --global user.name "integration-tests";
|
|
@ -0,0 +1,4 @@
|
||||||
|
# integration tests
|
||||||
|
|
||||||
|
- `cp .envrc.sample .envrc` (fill out values && `direnv allow`)
|
||||||
|
- `TARGET=install.sh make` (ensure `docker context use default`)
|
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source ./common.sh
|
||||||
|
|
||||||
|
echo "all apps, all servers"
|
||||||
|
$ABRA app ls
|
||||||
|
printf "\\n\\n\\n"
|
||||||
|
|
||||||
|
echo "all wordpress apps, all servers"
|
||||||
|
$ABRA app ls --type wordpress
|
||||||
|
printf "\\n\\n\\n"
|
||||||
|
|
||||||
|
echo "all wordpress apps, only server2"
|
||||||
|
$ABRA app ls --type wordpress --server server2
|
||||||
|
printf "\\n\\n\\n"
|
|
@ -0,0 +1,9 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source ./common.sh
|
||||||
|
|
||||||
|
$ABRA autocomplete bash
|
||||||
|
|
||||||
|
$ABRA autocomplete fizsh
|
||||||
|
|
||||||
|
$ABRA autocomplete zsh
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source ./common.sh
|
||||||
|
|
||||||
|
$ABRA catalogue generate --debug
|
||||||
|
|
||||||
|
$ABRA catalogue generate gitea --debug
|
|
@ -0,0 +1,22 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
ABRA="$HOME/.local/bin/abra"
|
||||||
|
INSTALLER_URL="https://install.abra.coopcloud.tech"
|
||||||
|
|
||||||
|
for arg in "$@"; do
|
||||||
|
if [ "$arg" == "--dev" ]; then
|
||||||
|
ABRA="/src/abra"
|
||||||
|
INSTALLER_URL="https://git.coopcloud.tech/coop-cloud/abra/raw/branch/main/scripts/installer/installer"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
export PATH=$PATH:$HOME/.local/bin
|
||||||
|
|
||||||
|
echo "choosing $ABRA as abra command"
|
||||||
|
echo "choosing $INSTALLER_URL as abra installer url"
|
||||||
|
}
|
||||||
|
|
||||||
|
init "$@"
|
|
@ -1,101 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# the goal of this script is to ensure basic core functionality is working
|
|
||||||
# before we make new releases. we try to make a balance between manual testing
|
|
||||||
# and automated testing, i.e. we don't invest too much time in a fragile
|
|
||||||
# automation that costs us more time to maintain and instead just do the test
|
|
||||||
# manually (see `../manual/manual.md` for more). it is a balance which we
|
|
||||||
# figure out together.
|
|
||||||
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
# ========================================================================
|
|
||||||
# choosing abra executable for test run
|
|
||||||
# ========================================================================
|
|
||||||
echo "choosing $ABRA as abra executable"
|
|
||||||
echo "choosing $INSTALLER_URL as abra installer url"
|
|
||||||
|
|
||||||
# ========================================================================
|
|
||||||
# latest stable release
|
|
||||||
# ========================================================================
|
|
||||||
wget -O- https://install.abra.autonomic.zone | bash
|
|
||||||
~/.local/bin/abra -v
|
|
||||||
|
|
||||||
# ========================================================================
|
|
||||||
# latest rc release
|
|
||||||
# ========================================================================
|
|
||||||
wget -O- https://install.abra.autonomic.zone | bash -s -- --rc
|
|
||||||
~/.local/bin/abra -v
|
|
||||||
|
|
||||||
# ========================================================================
|
|
||||||
# upgrade to stable in-place
|
|
||||||
# ========================================================================
|
|
||||||
$ABRA upgrade
|
|
||||||
~/.local/bin/abra -v
|
|
||||||
|
|
||||||
# ========================================================================
|
|
||||||
# upgrade to rc in-place
|
|
||||||
# ========================================================================
|
|
||||||
$ABRA upgrade --rc
|
|
||||||
~/.local/bin/abra -v
|
|
||||||
|
|
||||||
# ========================================================================
|
|
||||||
# autocomplete
|
|
||||||
# ========================================================================
|
|
||||||
$ABRA autocomplete bash
|
|
||||||
$ABRA autocomplete fizsh
|
|
||||||
$ABRA autocomplete zsh
|
|
||||||
|
|
||||||
# ========================================================================
|
|
||||||
# record command
|
|
||||||
# ========================================================================
|
|
||||||
$ABRA record new -p gandi -t A -n int-core -v 192.157.2.21 coopcloud.tech
|
|
||||||
$ABRA record list -p gandi coopcloud.tech | grep -q int-core
|
|
||||||
$ABRA -n record rm -p gandi -t A -n int-core coopcloud.tech
|
|
||||||
|
|
||||||
# ========================================================================
|
|
||||||
# catalogue command
|
|
||||||
# ========================================================================
|
|
||||||
$ABRA catalogue generate
|
|
||||||
$ABRA catalogue generate -s gitea
|
|
||||||
|
|
||||||
# ========================================================================
|
|
||||||
# recipe command
|
|
||||||
# ========================================================================
|
|
||||||
$ABRA recipe new testrecipe
|
|
||||||
|
|
||||||
$ABRA recipe list
|
|
||||||
$ABRA recipe list -p cloud
|
|
||||||
|
|
||||||
$ABRA recipe versions peertube
|
|
||||||
|
|
||||||
$ABRA recipe lint gitea
|
|
||||||
|
|
||||||
# ========================================================================
|
|
||||||
# server command
|
|
||||||
# ========================================================================
|
|
||||||
$ABRA -n server new -p hetzner-cloud --hn int-core
|
|
||||||
|
|
||||||
$ABRA server ls | grep -q int-core
|
|
||||||
|
|
||||||
$ABRA -n server rm -s -p hetzner-cloud --hn int-core
|
|
||||||
|
|
||||||
# ========================================================================
|
|
||||||
# app command
|
|
||||||
# ========================================================================
|
|
||||||
|
|
||||||
$ABRA app ls
|
|
||||||
|
|
||||||
$ABRA app ls -S
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source ./common.sh
|
||||||
|
|
||||||
|
wget -O- https://install.abra.autonomic.zone | bash
|
||||||
|
~/.local/bin/abra -v
|
||||||
|
|
||||||
|
wget -O- https://install.abra.autonomic.zone | bash -s -- --rc
|
||||||
|
~/.local/bin/abra -v
|
||||||
|
|
||||||
|
$ABRA upgrade
|
||||||
|
~/.local/bin/abra -v
|
||||||
|
|
||||||
|
$ABRA upgrade --rc
|
||||||
|
~/.local/bin/abra -v
|
|
@ -0,0 +1,11 @@
|
||||||
|
default:
|
||||||
|
@docker run \
|
||||||
|
-v $$(pwd)/../../:/src \
|
||||||
|
-v $$(pwd)/.abra:/root/.abra \
|
||||||
|
--env-file .envrc \
|
||||||
|
decentral1se/abra-int:latest \
|
||||||
|
sh -c '\
|
||||||
|
echo "Running $(TARGET)..."; \
|
||||||
|
cd /src/tests/integration; \
|
||||||
|
bash "$(TARGET)" -- --dev \
|
||||||
|
'
|
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source ./common.sh
|
||||||
|
|
||||||
|
$ABRA recipe new testrecipe
|
||||||
|
|
||||||
|
$ABRA recipe list
|
||||||
|
$ABRA recipe list -p cloud
|
||||||
|
|
||||||
|
$ABRA recipe versions peertube
|
||||||
|
|
||||||
|
$ABRA recipe lint gitea
|
|
@ -0,0 +1,9 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source ./common.sh
|
||||||
|
|
||||||
|
$ABRA record new -p gandi -t A -n int-core -v 192.157.2.21 coopcloud.tech
|
||||||
|
|
||||||
|
$ABRA record list -p gandi coopcloud.tech | grep -q int-core
|
||||||
|
|
||||||
|
$ABRA -n record rm -p gandi -t A -n int-core coopcloud.tech
|
|
@ -0,0 +1,9 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source ./common.sh
|
||||||
|
|
||||||
|
$ABRA -n server new -p hetzner-cloud --hn int-core
|
||||||
|
|
||||||
|
$ABRA server ls | grep -q int-core
|
||||||
|
|
||||||
|
$ABRA -n server rm -s -p hetzner-cloud --hn int-core
|
|
@ -1 +0,0 @@
|
||||||
TYPE=works
|
|
|
@ -1,84 +0,0 @@
|
||||||
---
|
|
||||||
|
|
||||||
# The goal of this compose file is to have a testing ground for understanding
|
|
||||||
# what cases we need to handle to get stable deployments. For that, we need to
|
|
||||||
# work with healthchecks and deploy configurations quite closely. If you run
|
|
||||||
# the `make symlink` target then this will be loaded into a "fake" app on your
|
|
||||||
# local machine which you can deploy with `abra`.
|
|
||||||
|
|
||||||
version: "3.8"
|
|
||||||
services:
|
|
||||||
r1_should_work:
|
|
||||||
image: redis:alpine
|
|
||||||
deploy:
|
|
||||||
update_config:
|
|
||||||
failure_action: rollback
|
|
||||||
order: start-first
|
|
||||||
rollback_config:
|
|
||||||
order: start-first
|
|
||||||
restart_policy:
|
|
||||||
max_attempts: 1
|
|
||||||
healthcheck:
|
|
||||||
test: redis-cli ping
|
|
||||||
interval: 2s
|
|
||||||
retries: 3
|
|
||||||
start_period: 1s
|
|
||||||
timeout: 3s
|
|
||||||
|
|
||||||
r2_broken_health_check:
|
|
||||||
image: redis:alpine
|
|
||||||
deploy:
|
|
||||||
update_config:
|
|
||||||
failure_action: rollback
|
|
||||||
order: start-first
|
|
||||||
rollback_config:
|
|
||||||
order: start-first
|
|
||||||
restart_policy:
|
|
||||||
max_attempts: 3
|
|
||||||
healthcheck:
|
|
||||||
test: foobar
|
|
||||||
interval: 2s
|
|
||||||
retries: 3
|
|
||||||
start_period: 1s
|
|
||||||
timeout: 3s
|
|
||||||
|
|
||||||
r3_no_health_check:
|
|
||||||
image: redis:alpine
|
|
||||||
deploy:
|
|
||||||
update_config:
|
|
||||||
failure_action: rollback
|
|
||||||
order: start-first
|
|
||||||
rollback_config:
|
|
||||||
order: start-first
|
|
||||||
restart_policy:
|
|
||||||
max_attempts: 3
|
|
||||||
|
|
||||||
r4_disabled_health_check:
|
|
||||||
image: redis:alpine
|
|
||||||
deploy:
|
|
||||||
update_config:
|
|
||||||
failure_action: rollback
|
|
||||||
order: start-first
|
|
||||||
rollback_config:
|
|
||||||
order: start-first
|
|
||||||
restart_policy:
|
|
||||||
max_attempts: 3
|
|
||||||
healthcheck:
|
|
||||||
disable: true
|
|
||||||
|
|
||||||
r5_should_also_work:
|
|
||||||
image: redis:alpine
|
|
||||||
deploy:
|
|
||||||
update_config:
|
|
||||||
failure_action: rollback
|
|
||||||
order: start-first
|
|
||||||
rollback_config:
|
|
||||||
order: start-first
|
|
||||||
restart_policy:
|
|
||||||
max_attempts: 1
|
|
||||||
healthcheck:
|
|
||||||
test: redis-cli ping
|
|
||||||
interval: 2s
|
|
||||||
retries: 3
|
|
||||||
start_period: 1s
|
|
||||||
timeout: 3s
|
|
|
@ -1 +0,0 @@
|
||||||
TYPE=works
|
|
|
@ -1,9 +1,5 @@
|
||||||
# manual test plan
|
# manual test plan
|
||||||
|
|
||||||
Best served after running `make int-core` which assures most core functionality
|
|
||||||
is still working. These manual tests are for testing things that are hard to
|
|
||||||
wire up for testing in an automated way.
|
|
||||||
|
|
||||||
## recipe publish
|
## recipe publish
|
||||||
|
|
||||||
- `abra recipe upgrade <recipe>`
|
- `abra recipe upgrade <recipe>`
|
||||||
|
@ -17,36 +13,28 @@ wire up for testing in an automated way.
|
||||||
|
|
||||||
## deploy, upgrade, rollback
|
## deploy, upgrade, rollback
|
||||||
|
|
||||||
- `abra app deploy <app>`
|
|
||||||
- `abra app deploy --force <app>`
|
|
||||||
- `abra app deploy --chaos <app>`
|
- `abra app deploy --chaos <app>`
|
||||||
- `abra app upgrade <app>`
|
- `abra app deploy --force <app>`
|
||||||
|
- `abra app deploy <app>`
|
||||||
- `abra app rollback <app>`
|
- `abra app rollback <app>`
|
||||||
|
- `abra app upgrade <app>`
|
||||||
|
|
||||||
## app day-to-day ops
|
## app day-to-day ops
|
||||||
|
|
||||||
### easy mode
|
|
||||||
|
|
||||||
- `abra app ls -t <recipe>`
|
|
||||||
- `abra app ls -s <server>`
|
|
||||||
- `abra app ls -s <server> -t <recipe>`
|
|
||||||
- `abra app ls -s <server> -t <recipe> -S`
|
|
||||||
- `abra app config <app>`
|
|
||||||
- `abra app check <app>`
|
- `abra app check <app>`
|
||||||
- `abra app ps <app>`
|
- `abra app config <app>`
|
||||||
- `abra app logs <app>`
|
|
||||||
- `abra app cp <app>`
|
- `abra app cp <app>`
|
||||||
- `abra app run <app>`
|
|
||||||
- `abra app secret ls <app>`
|
|
||||||
- `abra app volume ls <app>`
|
|
||||||
- `abra app new --secrets <recipe>`
|
|
||||||
|
|
||||||
### hard mode
|
|
||||||
|
|
||||||
- `abra app restart <app>`
|
|
||||||
- `abra app remove <app>`
|
|
||||||
- `abra app secret insert <app> foo v1 bar`
|
|
||||||
- `abra app secret remove <app> foo`
|
|
||||||
- `abra app secret generate --all`
|
|
||||||
- `abra app volume remove --force <app>`
|
|
||||||
- `abra app errors -w <app>`
|
- `abra app errors -w <app>`
|
||||||
|
- `abra app logs <app>`
|
||||||
|
- `abra app ls --status <app>`
|
||||||
|
- `abra app new --secrets <recipe>`
|
||||||
|
- `abra app ps <app>`
|
||||||
|
- `abra app remove <app>`
|
||||||
|
- `abra app restart <app>`
|
||||||
|
- `abra app run <app>`
|
||||||
|
- `abra app secret generate --all`
|
||||||
|
- `abra app secret insert <app> foo v1 bar`
|
||||||
|
- `abra app secret ls <app>`
|
||||||
|
- `abra app secret remove <app> foo`
|
||||||
|
- `abra app volume ls <app>`
|
||||||
|
- `abra app volume remove --force <app>`
|
||||||
|
|
Loading…
Reference in New Issue