diff --git a/tests/integration/app_new.bats b/tests/integration/app_new.bats index 0454db05..7127df14 100644 --- a/tests/integration/app_new.bats +++ b/tests/integration/app_new.bats @@ -50,9 +50,7 @@ teardown(){ assert_success assert_exists "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" - _get_tag_hash 0.1.1+1.20.2 - _get_current_hash - assert_equal "$tagHash" "$currentHash" + assert_equal $(_get_tag_hash 0.1.1+1.20.2) $(_get_current_hash) } @test "does not overwrite existing env files" { @@ -113,13 +111,12 @@ teardown(){ @test "ensure recipe up to date if no --offline" { _reset_recipe - _get_n_hash 3 + wantHash=$(_get_n_hash 3) run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" reset --hard HEAD~3 assert_success - _get_current_hash - assert_equal "$currentHash" "$nHash" + assert_equal $(_get_current_hash) "$wantHash" run $ABRA app new "$TEST_RECIPE" \ --no-input \ @@ -128,22 +125,19 @@ teardown(){ assert_success assert_exists "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" - _get_head_hash - _get_current_hash - assert_equal "$HEAD_HASH" "$CURRENT_HASH" + assert_equal $(_get_head_hash) $(_get_current_hash) _reset_recipe } @test "ensure recipe not up to date if --offline" { _reset_recipe - _get_n_hash 3 + wantHash=$(_get_n_hash 3) run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" reset --hard HEAD~3 assert_success - _get_current_hash - assert_equal "$currentHash" "$nHash" + assert_equal $(_get_current_hash) "$wantHash" # NOTE(d1): need to use --chaos to force same commit run $ABRA app new "$TEST_RECIPE" \ @@ -155,8 +149,7 @@ teardown(){ assert_success assert_exists "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" - _get_current_hash - assert_equal "$currentHash" "$nHash" + assert_equal $(_get_current_hash) "$wantHash" _reset_recipe } diff --git a/tests/integration/helpers/git.bash b/tests/integration/helpers/git.bash index 6921d426..5f3c5b1a 100644 --- a/tests/integration/helpers/git.bash +++ b/tests/integration/helpers/git.bash @@ -48,19 +48,23 @@ _git_commit() { _get_tag_hash() { tagHash=$(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" rev-list -n 1 "$1") assert_success + echo "$tagHash" } _get_head_hash() { headHash=$(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" show -s --format="%H" HEAD) assert_success + echo "$headHash" } _get_current_hash() { currentHash=$(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" show -s --format="%H") assert_success + echo "$currentHash" } _get_n_hash() { nHash=$(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" show -s --format="%H" "HEAD~$1") assert_success + echo "$nHash" }