0
0
forked from toolshed/abra

test: less fragile integration suite [ci skip]

See coop-cloud/organising#584
See coop-cloud/organising#595
This commit is contained in:
2024-06-22 16:40:07 +02:00
parent a9ce2106c6
commit 2014cd6622
39 changed files with 249 additions and 425 deletions

View File

@ -17,6 +17,10 @@ setup(){
_common_setup
}
teardown(){
_reset_recipe
}
@test "validate recipe argument" {
run $ABRA recipe upgrade --no-input
assert_failure
@ -57,20 +61,18 @@ setup(){
}
@test "ensure up to date" {
wantHash=$(_get_n_hash 3)
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" reset --hard HEAD~3
assert_success
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status
assert_output --regexp 'behind .* 3 commits'
assert_equal $(_get_current_hash) "$wantHash"
run $ABRA recipe upgrade "$TEST_RECIPE" --no-input
assert_success
assert_output --partial 'can upgrade service: app'
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status
assert_output --regexp 'behind .* 3 commits'
_reset_recipe
assert_equal $(_get_head_hash) $(_get_current_hash)
}
@test "only one of -x/y/z flags" {
@ -79,16 +81,18 @@ setup(){
assert_output --partial 'you can only use one of'
}
# NOTE(d1): relies on only 3 versions being published for the $TEST_RECIPE.
@test "upgrade patch" {
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" checkout "0.2.0+1.21.0"
assert_success
assert_equal $(_get_tag_hash 0.2.0+1.21.0) $(_get_current_hash)
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'
_checkout_recipe
}
@test "upgrade minor" {
@ -98,6 +102,4 @@ setup(){
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" diff
assert_success
assert_output --regexp 'image: nginx:1.2.*'
_checkout_recipe
}