test: no args for helpers, fix recipe_* tests [ci skip]

This commit is contained in:
2023-09-23 23:57:52 +02:00
parent ce7b4733d7
commit f0560ca975
12 changed files with 45 additions and 78 deletions

View File

@ -41,7 +41,7 @@ setup(){
assert_success
assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
_checkout_recipe "$TEST_RECIPE"
_checkout_recipe
}
@test "detect unstaged label changes" {
@ -55,28 +55,26 @@ setup(){
assert_success
assert_output --partial 'is already set, nothing to do?'
_checkout_recipe "$TEST_RECIPE"
_checkout_recipe
}
# NOTE(d1): relies on only 3 versions being published for the $TEST_RECIPE.
@test "sync patch label bump" {
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'
assert_output --partial 'image: nginx:1.21.6'
run $ABRA recipe sync "$TEST_RECIPE" --no-input --patch
assert_success
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'
assert_output --partial 'coop-cloud.${STACK_NAME}.version=0.2.1+1.21.6'
_checkout_recipe "$TEST_RECIPE"
_checkout_recipe
}
@test "sync minor label bump" {
@ -94,22 +92,18 @@ setup(){
assert_success
assert_output --regexp 'coop-cloud\.\$\{STACK_NAME\}\.version=0\.2\.0\+1\.2.*'
_checkout_recipe "$TEST_RECIPE"
_checkout_recipe
}
@test "error if --no-input and no initial version" {
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" tag -d '0.1.0+1.20.0'
assert_success
assert_output --partial "Deleted tag '0.1.0+1.20.0'"
_remove_tags
run $ABRA recipe sync "$TEST_RECIPE" --no-input --patch
assert_failure
assert_output --partial 'unable to continue'
assert_output --partial 'initial version'
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" fetch -a
assert_success
assert_output --partial '[new tag]'
_reset_tags
}
@test "output label sync only once" {
@ -125,5 +119,5 @@ setup(){
assert_line --index 0 --partial 'synced label'
refute_line --index 1 --partial 'synced label'
_checkout_recipe "$TEST_RECIPE"
_checkout_recipe
}