#!/usr/bin/env bash setup() { DIR="$( cd "$( dirname "$BATS_TEST_FILENAME" )" >/dev/null 2>&1 && pwd )" source "$DIR/helpers.sh" _setup_env mkdir -p "$HOME/.abra_test/servers/example.com" if ! grep -R -q "example.com" "$HOME/.docker"; then docker context create --docker host=ssh://foo@example.com:222 example.com fi } @test "create new recipe" { run $ABRA recipe new foobar assert_success assert_output --partial 'Your new foobar recipe has been created' run $ABRA app new foobar \ --no-input \ --server example.com \ --domain foobar.example.com assert_success assert_output --partial 'A new foobar app has been created!' } @test "recipe fetch" { run $ABRA recipe fetch matrix-synapse assert_success assert [ -d "$ABRA_DIR/recipes/matrix-synapse" ] } @test "recipe sync allows unstaged changes" { run $ABRA recipe fetch matrix-synapse assert_success run echo "unstaged changes" >> "$ABRA_DIR/recipes/matrix-synapse/foo" assert_success run $ABRA recipe sync matrix-synapse --patch assert_success } @test "recipe sync detects unstaged label changes" { run $ABRA recipe fetch matrix-synapse assert_success run $ABRA recipe sync matrix-synapse --patch assert_success run $ABRA recipe sync matrix-synapse --patch assert_success assert_output --partial 'is already set, nothing to do?' } @test "recipe list" { run $ABRA recipe list assert_success NUM_RECIPES=$(jq length "$ABRA_DIR/catalogue/recipes.json") assert_output --partial "total recipes: $NUM_RECIPES" } @test "recipe list with pattern" { run $ABRA recipe list --pattern cloud assert_success assert_output --partial 'nextcloud' refute_output --partial 'matrix-synapse' } @test "recipe lint" { run $ABRA recipe lint gitea assert_success } @test "recipe versions" { run $ABRA recipe versions gitea assert_success assert_output --partial '2.3.2+1.20.3-rootless' } teardown() { _default_teardown if grep -R -q "example.com" "$HOME/.docker"; then docker context rm example.com fi }