forked from toolshed/abra
fix!: chaos consistency (deploy/undeploy/rollback/upgrade)
See coop-cloud/organising#559 --chaos for rollback/upgrade goes away.
This commit is contained in:
@ -72,80 +72,6 @@ teardown(){
|
||||
assert_equal $(_get_current_hash) $wantHash
|
||||
}
|
||||
|
||||
@test "bail if unstaged changes and no --chaos" {
|
||||
run bash -c "echo foo >> $ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
||||
assert_success
|
||||
assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
||||
|
||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status
|
||||
assert_success
|
||||
assert_output --partial 'foo'
|
||||
|
||||
run $ABRA app rollback "$TEST_APP_DOMAIN" --no-input --no-converge-checks
|
||||
assert_failure
|
||||
assert_output --partial 'locally unstaged changes'
|
||||
refute_output --partial 'chaos'
|
||||
|
||||
run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
||||
assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
||||
}
|
||||
|
||||
# bats test_tags=slow
|
||||
@test "do not bail if unstaged changes and --chaos" {
|
||||
run bash -c 'echo "unstaged changes" >> "$ABRA_DIR/recipes/$TEST_RECIPE/foo"'
|
||||
assert_success
|
||||
assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
||||
|
||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status
|
||||
assert_success
|
||||
assert_output --partial 'foo'
|
||||
|
||||
run $ABRA app deploy "$TEST_APP_DOMAIN" \
|
||||
--chaos --no-input --no-converge-checks
|
||||
assert_success
|
||||
assert_output --partial 'chaos'
|
||||
|
||||
run $ABRA app rollback "$TEST_APP_DOMAIN" \
|
||||
--chaos --no-input --no-converge-checks
|
||||
assert_success
|
||||
assert_output --partial 'chaos'
|
||||
|
||||
_undeploy_app
|
||||
|
||||
run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
||||
assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
||||
}
|
||||
|
||||
# bats test_tags=slow
|
||||
@test "ensure same commit if --chaos" {
|
||||
latestCommit="$(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" rev-parse --short HEAD)"
|
||||
|
||||
run $ABRA app deploy "$TEST_APP_DOMAIN" \
|
||||
--no-input --chaos
|
||||
assert_success
|
||||
assert_output --partial "${latestCommit}"
|
||||
assert_output --partial 'chaos'
|
||||
|
||||
run $ABRA app rollback "$TEST_APP_DOMAIN" \
|
||||
--chaos --no-input --no-converge-checks
|
||||
assert_success
|
||||
assert_output --partial "$latestCommit"
|
||||
assert_output --partial 'chaos'
|
||||
}
|
||||
|
||||
# bats test_tags=slow
|
||||
@test "no rollback if lint error" {
|
||||
_deploy_app
|
||||
|
||||
run sed -i '/traefik.enable=.*/d' "$ABRA_DIR/recipes/$TEST_RECIPE/compose.yml"
|
||||
assert_success
|
||||
|
||||
run $ABRA app rollback "$TEST_APP_DOMAIN" \
|
||||
--no-input --chaos --chaos --no-converge-checks
|
||||
assert_failure
|
||||
assert_output --partial 'failed lint checks'
|
||||
}
|
||||
|
||||
@test "error if not already deployed" {
|
||||
run $ABRA app rollback "$TEST_APP_DOMAIN" --no-input
|
||||
assert_failure
|
||||
@ -174,13 +100,6 @@ teardown(){
|
||||
assert_output --partial 'is not a downgrade'
|
||||
}
|
||||
|
||||
@test "bail out if specific version and chaos" {
|
||||
run $ABRA app rollback "$TEST_APP_DOMAIN" "0.2.0+1.21.0" \
|
||||
--chaos --no-input --no-converge-checks
|
||||
assert_failure
|
||||
assert_output --partial 'cannot use'
|
||||
}
|
||||
|
||||
# bats test_tags=slow
|
||||
@test "rollback to previous version" {
|
||||
run $ABRA app deploy "$TEST_APP_DOMAIN" "0.1.1+1.20.2" --no-input --no-converge-checks
|
||||
@ -202,3 +121,27 @@ teardown(){
|
||||
assert_success
|
||||
assert_output --partial "0.1.0+1.20.0"
|
||||
}
|
||||
|
||||
# bats test_tags=slow
|
||||
@test "rollback chaos deployment" {
|
||||
tagHash=$(_get_tag_hash "0.2.0+1.21.0")
|
||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" checkout "$tagHash"
|
||||
assert_success
|
||||
|
||||
run $ABRA app deploy "$TEST_APP_DOMAIN" --no-input --no-converge-checks --chaos
|
||||
assert_success
|
||||
assert_output --partial "${tagHash:0:8}"
|
||||
|
||||
run $ABRA app rollback "$TEST_APP_DOMAIN" "0.1.1+1.20.2" --no-input --no-converge-checks
|
||||
assert_success
|
||||
assert_output --partial "0.1.1+1.20.2"
|
||||
assert_output --partial "${tagHash:0:8}"
|
||||
|
||||
run $ABRA app rollback "$TEST_APP_DOMAIN" "0.1.0+1.20.0" --no-input --no-converge-checks
|
||||
assert_success
|
||||
assert_output --partial "0.1.0+1.20.0"
|
||||
|
||||
tagHash=$(_get_tag_hash "0.1.1+1.20.2")
|
||||
refute_output --partial "${tagHash:0:8}"
|
||||
assert_output --partial "false"
|
||||
}
|
||||
|
@ -41,6 +41,9 @@ teardown(){
|
||||
@test "undeploy app" {
|
||||
_deploy_app
|
||||
_undeploy_app
|
||||
|
||||
# NOTE(d1): ensure not chaos undeploy
|
||||
assert_output --partial 'false'
|
||||
}
|
||||
|
||||
# bats test_tags=slow
|
||||
@ -50,3 +53,15 @@ teardown(){
|
||||
run $ABRA app undeploy "$TEST_APP_DOMAIN" --no-input --prune
|
||||
assert_success
|
||||
}
|
||||
|
||||
# bats test_tags=slow
|
||||
@test "undeploy chaos deployment" {
|
||||
run $ABRA app deploy "$TEST_APP_DOMAIN" \
|
||||
--no-input --no-converge-checks --chaos
|
||||
|
||||
_undeploy_app
|
||||
|
||||
# NOTE(d1): ensure chaos undeploy
|
||||
assert_output --partial ${_get_current_hash:0:8}
|
||||
refute_output --partial 'false'
|
||||
}
|
||||
|
@ -43,26 +43,6 @@ teardown(){
|
||||
assert_output --partial 'is not an upgrade'
|
||||
}
|
||||
|
||||
@test "bail out if specific version and chaos" {
|
||||
run $ABRA app upgrade "$TEST_APP_DOMAIN" "0.2.0+1.21.0" \
|
||||
--chaos --no-input --no-converge-checks
|
||||
assert_failure
|
||||
assert_output --partial 'cannot use'
|
||||
}
|
||||
|
||||
# bats test_tags=slow
|
||||
@test "no upgrade if lint error" {
|
||||
_deploy_app
|
||||
|
||||
run sed -i '/traefik.enable=.*/d' "$ABRA_DIR/recipes/$TEST_RECIPE/compose.yml"
|
||||
assert_success
|
||||
|
||||
run $ABRA app upgrade "$TEST_APP_DOMAIN" \
|
||||
--no-input --no-converge-checks --chaos
|
||||
assert_failure
|
||||
assert_output --partial 'failed lint checks'
|
||||
}
|
||||
|
||||
# bats test_tags=slow
|
||||
@test "no upgrade if on latest version" {
|
||||
_deploy_app
|
||||
@ -185,3 +165,27 @@ teardown(){
|
||||
assert_output --partial 'release notes bar' # 0.1.1+1.20.2
|
||||
assert_output --partial 'release notes baz' # 0.2.0+1.21.0
|
||||
}
|
||||
|
||||
# bats test_tags=slow
|
||||
@test "upgrade chaos deployment" {
|
||||
tagHash=$(_get_tag_hash "0.1.0+1.20.0")
|
||||
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" checkout "$tagHash"
|
||||
assert_success
|
||||
|
||||
run $ABRA app deploy "$TEST_APP_DOMAIN" --no-input --no-converge-checks --chaos
|
||||
assert_success
|
||||
assert_output --partial "${tagHash:0:8}"
|
||||
|
||||
run $ABRA app upgrade "$TEST_APP_DOMAIN" "0.1.1+1.20.2" --no-input --no-converge-checks
|
||||
assert_success
|
||||
assert_output --partial "0.1.1+1.20.2"
|
||||
assert_output --partial "${tagHash:0:8}"
|
||||
|
||||
run $ABRA app upgrade "$TEST_APP_DOMAIN" "0.2.0+1.21.0" --no-input --no-converge-checks
|
||||
assert_success
|
||||
assert_output --partial "0.2.0+1.21.0"
|
||||
|
||||
tagHash=$(_get_tag_hash "0.1.1+1.20.2")
|
||||
refute_output --partial "${tagHash:0:8}"
|
||||
assert_output --partial "false"
|
||||
}
|
||||
|
Reference in New Issue
Block a user