#!/usr/bin/env bash setup_file(){ load "$PWD/tests/integration/helpers/common" _common_setup _add_server _new_app } teardown_file(){ _rm_server } setup(){ load "$PWD/tests/integration/helpers/common" _common_setup } @test "validate recipe argument" { run $ABRA recipe release --no-input assert_failure assert_output --partial 'no recipe name provided' run $ABRA recipe release DOESNTEXIST --no-input assert_failure assert_output --partial 'unable to validate recipe' } @test "release patch bump" { run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" tag --list assert_success assert_output '0.1.0+1.20.0' run bash -c 'cat "$ABRA_DIR/recipes/$TEST_RECIPE/compose.yml" | grep -q "0.1.0+1.20.0"' assert_success run $ABRA recipe upgrade "$TEST_RECIPE" --no-input --patch assert_success run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" diff assert_success assert_output --partial 'image: nginx:1.20.2' run $ABRA recipe sync "$TEST_RECIPE" --no-input --patch assert_success assert_output --partial 'synced label' run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" diff assert_success assert_output --partial 'coop-cloud.${STACK_NAME}.version=0.1.1+1.20.2' run $ABRA recipe release "$TEST_RECIPE" --no-input --patch assert_success assert_output --partial 'no -p/--publish passed, not publishing' run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" tag --list assert_success assert_output --partial '0.1.0+1.20.0' assert_output --partial '0.1.1+1.20.2' _checkout_recipe "$TEST_RECIPE" run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" reset --hard HEAD~1 assert_success run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" tag -d '0.1.1+1.20.2' assert_success assert_output --partial "Deleted tag '0.1.1+1.20.2'" } @test "release minor bump" { run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" tag --list assert_success assert_output '0.1.0+1.20.0' run bash -c 'grep -q "0.1.0+1.20.0" "$ABRA_DIR/recipes/$TEST_RECIPE/compose.yml"' assert_success run $ABRA recipe upgrade "$TEST_RECIPE" --no-input --minor assert_success run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" diff assert_success assert_output --regexp 'image: nginx:1.2.*' run $ABRA recipe sync "$TEST_RECIPE" --no-input --minor assert_success assert_output --partial 'synced label' run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" diff assert_success assert_output --regexp 'coop-cloud\.\$\{STACK_NAME\}\.version=0\.2\.0\+1\.2.*' run $ABRA recipe release "$TEST_RECIPE" --no-input --minor assert_success assert_output --partial 'no -p/--publish passed, not publishing' run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" tag --list assert_success assert_output --partial '0.1.0+1.20.0' assert_output --regexp '0\.2\.0\+1\.2.*' _reset_recipe "$TEST_RECIPE" }