#!/usr/bin/env bash setup_file(){ load "$PWD/tests/integration/helpers/common" _common_setup _add_server _new_app } teardown_file(){ _rm_server _reset_recipe } 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' } # NOTE(d1): relies on only 3 versions being published for the $TEST_RECIPE. @test "release patch bump" { 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.21.6' 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.2.1+1.21.6' 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.2.1+1.21.6' _reset_recipe } # NOTE(d1): this test can't assert hardcoded versions since we upgrade a minor # version which could be anything in the future. so, we do our best with # --regexp. @test "release minor bump" { 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\.3\.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 --regexp '0\.3\.0\+1\.2.*' _reset_recipe "$TEST_RECIPE" } @test "unknown files not committed" { run $ABRA recipe upgrade "$TEST_RECIPE" --no-input --patch assert_success run bash -c 'echo "unstaged changes" >> "$ABRA_DIR/recipes/$TEST_RECIPE/foo"' assert_success assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo" 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" rm foo assert_failure assert_output --partial "fatal: pathspec 'foo' did not match any files" _reset_recipe }