Files
abra/tests/integration/helpers/common.bash
decentral1se ea48917e6c
All checks were successful
continuous-integration/drone/push Build is passing
test: ensure ssh-agent is configured
See https://build.coopcloud.tech/toolshed/abra/3594/1/7
2026-02-17 12:54:40 +00:00

40 lines
985 B
Bash

#!/usr/bin/env bash
_common_setup() {
bats_load_library bats-support
bats_load_library bats-assert
bats_load_library bats-file
load "$PWD/tests/integration/helpers/file"
load "$PWD/tests/integration/helpers/app"
load "$PWD/tests/integration/helpers/git"
load "$PWD/tests/integration/helpers/recipe"
load "$PWD/tests/integration/helpers/server"
load "$PWD/tests/integration/helpers/docker"
export ABRA="$PWD/abra"
export TEST_APP_NAME="$(basename "${BATS_TEST_FILENAME//./_}")"
export TEST_APP_DOMAIN="$TEST_APP_NAME.$TEST_SERVER"
export TEST_MOVE_SERVER="default2"
export TEST_RECIPE="abra-test-recipe"
_ensure_swarm
_ensure_ssh_agent
}
_ensure_ssh_agent() {
if ! command -v ssh-agent >/dev/null 2>&1
then
echo "ssh-agent is missing, please install it"
exit 1
fi
export SSH_AUTH_SOCK="$HOME/.ssh/ssh_auth_sock"
if [ ! -S ~/.ssh/ssh_auth_sock ]; then
eval `ssh-agent`
ln -sf "$SSH_AUTH_SOCK" ~/.ssh/ssh_auth_sock
fi
}