forked from toolshed/abra
test: less fragile integration suite [ci skip]
See coop-cloud/organising#584 See coop-cloud/organising#595
This commit is contained in:
@ -46,10 +46,5 @@ _reset_app(){
|
||||
assert_success
|
||||
assert_not_exists "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env"
|
||||
|
||||
run $ABRA app new "$TEST_RECIPE" \
|
||||
--no-input \
|
||||
--server "$TEST_SERVER" \
|
||||
--domain "$TEST_APP_DOMAIN"
|
||||
assert_success
|
||||
assert_exists "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env"
|
||||
_new_app
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ _common_setup() {
|
||||
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 KADABRA="$PWD/kadabra"
|
||||
@ -17,4 +18,6 @@ _common_setup() {
|
||||
export TEST_APP_NAME="$(basename "${BATS_TEST_FILENAME//./_}")"
|
||||
export TEST_APP_DOMAIN="$TEST_APP_NAME.$TEST_SERVER"
|
||||
export TEST_RECIPE="abra-test-recipe"
|
||||
|
||||
_ensure_swarm
|
||||
}
|
||||
|
13
tests/integration/helpers/docker.bash
Normal file
13
tests/integration/helpers/docker.bash
Normal file
@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
_ensure_swarm() {
|
||||
if [ "$(docker info | grep Swarm | sed 's/Swarm: //g' | tr -d ' ')" == "inactive" ]; then
|
||||
run docker swarm init
|
||||
assert_success
|
||||
fi
|
||||
|
||||
if ! $(docker network ls | grep -q 'proxy'); then
|
||||
run docker network create -d overlay proxy
|
||||
assert_success
|
||||
fi
|
||||
}
|
@ -46,25 +46,17 @@ _git_commit() {
|
||||
}
|
||||
|
||||
_get_tag_hash() {
|
||||
tagHash=$(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" rev-list -n 1 "$1")
|
||||
assert_success
|
||||
echo "$tagHash"
|
||||
echo $(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" rev-list -n 1 "$1")
|
||||
}
|
||||
|
||||
_get_head_hash() {
|
||||
headHash=$(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" show -s --format="%H" HEAD)
|
||||
assert_success
|
||||
echo "$headHash"
|
||||
echo $(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" show -s --format="%H" HEAD)
|
||||
}
|
||||
|
||||
_get_current_hash() {
|
||||
currentHash=$(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" show -s --format="%H")
|
||||
assert_success
|
||||
echo "$currentHash"
|
||||
echo $(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" show -s --format="%H")
|
||||
}
|
||||
|
||||
_get_n_hash() {
|
||||
nHash=$(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" show -s --format="%H" "HEAD~$1")
|
||||
assert_success
|
||||
echo "$nHash"
|
||||
echo $(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" show -s --format="%H" "HEAD~$1")
|
||||
}
|
||||
|
@ -17,3 +17,12 @@ _reset_recipe(){
|
||||
|
||||
_fetch_recipe
|
||||
}
|
||||
|
||||
_ensure_latest_version(){
|
||||
latestRelease=$(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" tag -l | tail -n 1)
|
||||
|
||||
if [ ! $latestRelease = "$1" ]; then
|
||||
echo "expected latest recipe version of '$1', saw: $latestRelease"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
Reference in New Issue
Block a user