continuous-integration/drone/push Build is passing
This PR adds a declarative integration testing setup which includes 2 local VMs client and server which can be started and stopped via a command. The VMs are run with QEMU and created by https://github.com/microvm-nix/microvm.nix The key pair is generated for this use case and is safe to commit, it resolves the problem that the readFile function can only be used with git tracked files. --------- Co-authored-by: devydave <yannick-dev@tutanota.com> Reviewed-on: #902 Reviewed-by: p4u1 <133+p4u1@noreply.git.coopcloud.tech> Co-authored-by: devydave <bittedanke@tutanota.com>
38 lines
1.1 KiB
Bash
38 lines
1.1 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
_ensure_swarm() {
|
|
if [ "$(docker info | grep Swarm | sed 's/Swarm: //g' | tr -d ' ')" == "inactive" ]; then
|
|
run docker swarm init --advertise-addr 127.0.0.1:2377
|
|
assert_success
|
|
fi
|
|
|
|
if ! docker network ls | grep -q 'proxy'; then
|
|
run docker network create -d overlay proxy
|
|
assert_success
|
|
fi
|
|
|
|
if ! _is_local;
|
|
then
|
|
if [ "$(ssh "$TEST_SERVER" docker info | grep Swarm | sed 's/Swarm: //g' | tr -d ' ')" == "inactive" ]; then
|
|
run ssh "$TEST_SERVER" docker swarm init --advertise-addr 127.0.0.1:2377
|
|
assert_success
|
|
fi
|
|
|
|
if ! ssh "$TEST_SERVER" docker network ls | grep -q 'proxy'; then
|
|
run ssh "$TEST_SERVER" docker network create -d overlay proxy
|
|
assert_success
|
|
fi
|
|
fi
|
|
}
|
|
|
|
_inspect_env_test_app() {
|
|
if _is_local;
|
|
then
|
|
containerId="$(docker ps -f name="$TEST_APP_DOMAIN_$TEST_SERVER" -q)"
|
|
run docker inspect --format='{{range .Config.Env}}{{println .}}{{end}}' "$containerId"
|
|
else
|
|
containerId="$(ssh "$TEST_SERVER" docker ps -f name="$TEST_APP_DOMAIN" -q)"
|
|
run ssh "$TEST_SERVER" "docker inspect --format='{{range .Config.Env}}{{println .}}{{end}}' '$containerId'"
|
|
fi
|
|
}
|