test: no args for helpers, fix recipe_* tests [ci skip]
This commit is contained in:
parent
ce7b4733d7
commit
f0560ca975
|
@ -53,7 +53,7 @@ teardown(){
|
||||||
run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
||||||
assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
||||||
|
|
||||||
_checkout_recipe "$TEST_RECIPE"
|
_checkout_recipe
|
||||||
}
|
}
|
||||||
|
|
||||||
# bats test_tags=slow
|
# bats test_tags=slow
|
||||||
|
@ -78,7 +78,7 @@ teardown(){
|
||||||
run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
||||||
assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
||||||
|
|
||||||
_checkout_recipe "$TEST_RECIPE"
|
_checkout_recipe
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "ensure recipe up to date if no --offline" {
|
@test "ensure recipe up to date if no --offline" {
|
||||||
|
@ -142,7 +142,7 @@ teardown(){
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_output --partial 'no backup config for app'
|
assert_output --partial 'no backup config for app'
|
||||||
|
|
||||||
_checkout_recipe "$TEST_RECIPE"
|
_checkout_recipe
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "error if backup paths not configured" {
|
@test "error if backup paths not configured" {
|
||||||
|
@ -153,7 +153,7 @@ teardown(){
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_output --partial 'backup paths are empty for app?'
|
assert_output --partial 'backup paths are empty for app?'
|
||||||
|
|
||||||
_checkout_recipe "$TEST_RECIPE"
|
_checkout_recipe
|
||||||
}
|
}
|
||||||
|
|
||||||
# bats test_tags=slow
|
# bats test_tags=slow
|
||||||
|
|
|
@ -103,7 +103,7 @@ setup(){
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_output --partial '.env.sample does not exist?'
|
assert_output --partial '.env.sample does not exist?'
|
||||||
|
|
||||||
_checkout_recipe "$TEST_RECIPE"
|
_checkout_recipe
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "error if missing env var" {
|
@test "error if missing env var" {
|
||||||
|
@ -115,5 +115,5 @@ setup(){
|
||||||
assert_output --partial \
|
assert_output --partial \
|
||||||
"$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env is missing NEW_VAR"
|
"$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env is missing NEW_VAR"
|
||||||
|
|
||||||
_checkout_recipe "$TEST_RECIPE"
|
_checkout_recipe
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,7 +132,7 @@ teardown(){
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_output --partial "$ABRA_DIR/recipes/$TEST_RECIPE/abra.sh does not exist"
|
assert_output --partial "$ABRA_DIR/recipes/$TEST_RECIPE/abra.sh does not exist"
|
||||||
|
|
||||||
_checkout_recipe "$TEST_RECIPE"
|
_checkout_recipe
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "error if missing command" {
|
@test "error if missing command" {
|
||||||
|
|
|
@ -51,7 +51,7 @@ teardown(){
|
||||||
run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
||||||
assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
||||||
|
|
||||||
_checkout_recipe "$TEST_RECIPE"
|
_checkout_recipe
|
||||||
}
|
}
|
||||||
|
|
||||||
# bats test_tags=slow
|
# bats test_tags=slow
|
||||||
|
@ -174,7 +174,7 @@ teardown(){
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_output --partial 'failed lint checks'
|
assert_output --partial 'failed lint checks'
|
||||||
|
|
||||||
_checkout_recipe "$TEST_RECIPE"
|
_checkout_recipe
|
||||||
}
|
}
|
||||||
|
|
||||||
# bats test_tags=slow
|
# bats test_tags=slow
|
||||||
|
|
|
@ -60,7 +60,7 @@ teardown(){
|
||||||
run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
||||||
assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
||||||
|
|
||||||
_checkout_recipe "$TEST_RECIPE"
|
_checkout_recipe
|
||||||
}
|
}
|
||||||
|
|
||||||
# bats test_tags=slow
|
# bats test_tags=slow
|
||||||
|
@ -100,7 +100,7 @@ teardown(){
|
||||||
run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
||||||
assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
||||||
|
|
||||||
_checkout_recipe "$TEST_RECIPE"
|
_checkout_recipe
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "ensure recipe up to date if no --offline" {
|
@test "ensure recipe up to date if no --offline" {
|
||||||
|
@ -202,7 +202,7 @@ teardown(){
|
||||||
|
|
||||||
_undeploy_app
|
_undeploy_app
|
||||||
|
|
||||||
_checkout_recipe "$TEST_RECIPE"
|
_checkout_recipe
|
||||||
}
|
}
|
||||||
|
|
||||||
# bats test_tags=slow
|
# bats test_tags=slow
|
||||||
|
|
|
@ -158,7 +158,7 @@ teardown(){
|
||||||
|
|
||||||
_undeploy_app
|
_undeploy_app
|
||||||
|
|
||||||
_checkout_recipe "$TEST_RECIPE"
|
_checkout_recipe
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "error if not already deployed" {
|
@test "error if not already deployed" {
|
||||||
|
|
|
@ -59,7 +59,7 @@ teardown(){
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_output --partial 'failed lint checks'
|
assert_output --partial 'failed lint checks'
|
||||||
|
|
||||||
_checkout_recipe "$TEST_RECIPE"
|
_checkout_recipe
|
||||||
|
|
||||||
_undeploy_app
|
_undeploy_app
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ teardown(){
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_output --partial 'failed to determine'
|
assert_output --partial 'failed to determine'
|
||||||
|
|
||||||
_checkout_recipe "$TEST_RECIPE"
|
_checkout_recipe
|
||||||
_undeploy_app
|
_undeploy_app
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,12 +67,11 @@ setup() {
|
||||||
|
|
||||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status
|
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status
|
||||||
refute_output --partial 'behind 3'
|
refute_output --partial 'behind 3'
|
||||||
|
|
||||||
|
_reset_recipe
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "ensure recipe not up to date if --offline" {
|
@test "ensure recipe not up to date if --offline" {
|
||||||
latestCommit="$(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" rev-parse --short HEAD)"
|
|
||||||
refute [ -z "$latestCommit" ];
|
|
||||||
|
|
||||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" reset --hard HEAD~3
|
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" reset --hard HEAD~3
|
||||||
assert_success
|
assert_success
|
||||||
|
|
||||||
|
@ -85,11 +84,7 @@ setup() {
|
||||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status
|
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status
|
||||||
assert_output --partial 'behind 3'
|
assert_output --partial 'behind 3'
|
||||||
|
|
||||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" checkout "$latestCommit"
|
_reset_recipe
|
||||||
assert_success
|
|
||||||
|
|
||||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status
|
|
||||||
refute_output --partial 'behind 3'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "recipe lint warns on error" {
|
@test "recipe lint warns on error" {
|
||||||
|
@ -103,5 +98,5 @@ setup() {
|
||||||
run $ABRA recipe lint "$TEST_RECIPE" --chaos
|
run $ABRA recipe lint "$TEST_RECIPE" --chaos
|
||||||
assert_success --partial 'watch out, some critical errors are present'
|
assert_success --partial 'watch out, some critical errors are present'
|
||||||
|
|
||||||
_checkout_recipe "$TEST_RECIPE"
|
_checkout_recipe
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,20 +26,14 @@ setup(){
|
||||||
assert_output --partial 'unable to validate recipe'
|
assert_output --partial 'unable to validate recipe'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# NOTE(d1): relies on only 3 versions being published for the $TEST_RECIPE.
|
||||||
@test "release patch bump" {
|
@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
|
run $ABRA recipe upgrade "$TEST_RECIPE" --no-input --patch
|
||||||
assert_success
|
assert_success
|
||||||
|
|
||||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" diff
|
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" diff
|
||||||
assert_success
|
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
|
run $ABRA recipe sync "$TEST_RECIPE" --no-input --patch
|
||||||
assert_success
|
assert_success
|
||||||
|
@ -47,7 +41,7 @@ setup(){
|
||||||
|
|
||||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" diff
|
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" diff
|
||||||
assert_success
|
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'
|
||||||
|
|
||||||
run $ABRA recipe release "$TEST_RECIPE" --no-input --patch
|
run $ABRA recipe release "$TEST_RECIPE" --no-input --patch
|
||||||
assert_success
|
assert_success
|
||||||
|
@ -55,27 +49,15 @@ setup(){
|
||||||
|
|
||||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" tag --list
|
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" tag --list
|
||||||
assert_success
|
assert_success
|
||||||
assert_output --partial '0.1.0+1.20.0'
|
assert_output --partial '0.2.1+1.21.6'
|
||||||
assert_output --partial '0.1.1+1.20.2'
|
|
||||||
|
|
||||||
_checkout_recipe "$TEST_RECIPE"
|
_reset_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'"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# 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" {
|
@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
|
run $ABRA recipe upgrade "$TEST_RECIPE" --no-input --minor
|
||||||
assert_success
|
assert_success
|
||||||
|
|
||||||
|
@ -89,7 +71,7 @@ setup(){
|
||||||
|
|
||||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" diff
|
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" diff
|
||||||
assert_success
|
assert_success
|
||||||
assert_output --regexp 'coop-cloud\.\$\{STACK_NAME\}\.version=0\.2\.0\+1\.2.*'
|
assert_output --regexp 'coop-cloud\.\$\{STACK_NAME\}\.version=0\.3\.0\+1\.2.*'
|
||||||
|
|
||||||
run $ABRA recipe release "$TEST_RECIPE" --no-input --minor
|
run $ABRA recipe release "$TEST_RECIPE" --no-input --minor
|
||||||
assert_success
|
assert_success
|
||||||
|
@ -97,8 +79,7 @@ setup(){
|
||||||
|
|
||||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" tag --list
|
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" tag --list
|
||||||
assert_success
|
assert_success
|
||||||
assert_output --partial '0.1.0+1.20.0'
|
assert_output --regexp '0\.3\.0\+1\.2.*'
|
||||||
assert_output --regexp '0\.2\.0\+1\.2.*'
|
|
||||||
|
|
||||||
_reset_recipe "$TEST_RECIPE"
|
_reset_recipe "$TEST_RECIPE"
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ setup(){
|
||||||
assert_success
|
assert_success
|
||||||
assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
||||||
|
|
||||||
_checkout_recipe "$TEST_RECIPE"
|
_checkout_recipe
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "detect unstaged label changes" {
|
@test "detect unstaged label changes" {
|
||||||
|
@ -55,28 +55,26 @@ setup(){
|
||||||
assert_success
|
assert_success
|
||||||
assert_output --partial 'is already set, nothing to do?'
|
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" {
|
@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
|
run $ABRA recipe upgrade "$TEST_RECIPE" --no-input --patch
|
||||||
assert_success
|
assert_success
|
||||||
|
|
||||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" diff
|
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" diff
|
||||||
assert_success
|
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
|
run $ABRA recipe sync "$TEST_RECIPE" --no-input --patch
|
||||||
assert_success
|
assert_success
|
||||||
|
|
||||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" diff
|
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" diff
|
||||||
assert_success
|
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" {
|
@test "sync minor label bump" {
|
||||||
|
@ -94,22 +92,18 @@ setup(){
|
||||||
assert_success
|
assert_success
|
||||||
assert_output --regexp 'coop-cloud\.\$\{STACK_NAME\}\.version=0\.2\.0\+1\.2.*'
|
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" {
|
@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'
|
_remove_tags
|
||||||
assert_success
|
|
||||||
assert_output --partial "Deleted tag '0.1.0+1.20.0'"
|
|
||||||
|
|
||||||
run $ABRA recipe sync "$TEST_RECIPE" --no-input --patch
|
run $ABRA recipe sync "$TEST_RECIPE" --no-input --patch
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_output --partial 'unable to continue'
|
assert_output --partial 'unable to continue'
|
||||||
assert_output --partial 'initial version'
|
assert_output --partial 'initial version'
|
||||||
|
|
||||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" fetch -a
|
_reset_tags
|
||||||
assert_success
|
|
||||||
assert_output --partial '[new tag]'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "output label sync only once" {
|
@test "output label sync only once" {
|
||||||
|
@ -125,5 +119,5 @@ setup(){
|
||||||
assert_line --index 0 --partial 'synced label'
|
assert_line --index 0 --partial 'synced label'
|
||||||
refute_line --index 1 --partial 'synced label'
|
refute_line --index 1 --partial 'synced label'
|
||||||
|
|
||||||
_checkout_recipe "$TEST_RECIPE"
|
_checkout_recipe
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,6 +68,8 @@ setup(){
|
||||||
|
|
||||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status
|
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status
|
||||||
refute_output --partial 'behind 3'
|
refute_output --partial 'behind 3'
|
||||||
|
|
||||||
|
_reset_recipe
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "only one of -x/y/z flags" {
|
@test "only one of -x/y/z flags" {
|
||||||
|
@ -76,24 +78,19 @@ setup(){
|
||||||
assert_output --partial 'you can only use one of'
|
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" {
|
@test "upgrade patch" {
|
||||||
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
|
run $ABRA recipe upgrade "$TEST_RECIPE" --no-input --patch
|
||||||
assert_success
|
assert_success
|
||||||
|
|
||||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" diff
|
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" diff
|
||||||
assert_success
|
assert_success
|
||||||
assert_output --partial 'image: nginx:1.20.2'
|
assert_output --partial 'image: nginx:1.21.6'
|
||||||
|
|
||||||
_checkout_recipe "$TEST_RECIPE"
|
_checkout_recipe
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "upgrade minor" {
|
@test "upgrade minor" {
|
||||||
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 --minor
|
run $ABRA recipe upgrade "$TEST_RECIPE" --no-input --minor
|
||||||
assert_success
|
assert_success
|
||||||
|
|
||||||
|
@ -101,5 +98,5 @@ setup(){
|
||||||
assert_success
|
assert_success
|
||||||
assert_output --regexp 'image: nginx:1.2.*'
|
assert_output --regexp 'image: nginx:1.2.*'
|
||||||
|
|
||||||
_checkout_recipe "$TEST_RECIPE"
|
_checkout_recipe
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue