This simplifies the deploy overview, to only show 3 version fields: - CURRENT DEPLOYMENT - CURRENT ENV - NEW DEPLOYMENT It also fixes a few errors around version detection Reviewed-on: #508 Co-authored-by: p4u1 <p4u1_f4u1@riseup.net> Co-committed-by: p4u1 <p4u1_f4u1@riseup.net>
93 lines
2.4 KiB
Bash
93 lines
2.4 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
setup_file(){
|
|
load "$PWD/tests/integration/helpers/common"
|
|
_common_setup
|
|
_add_server
|
|
_new_app
|
|
}
|
|
|
|
teardown_file(){
|
|
_rm_app
|
|
_rm_server
|
|
_reset_recipe
|
|
}
|
|
|
|
setup(){
|
|
load "$PWD/tests/integration/helpers/common"
|
|
_common_setup
|
|
_ensure_catalogue
|
|
}
|
|
|
|
teardown(){
|
|
_reset_recipe
|
|
_undeploy_app
|
|
_reset_app
|
|
}
|
|
|
|
@test "deploy and undeploy" {
|
|
run $ABRA app deploy "$TEST_APP_DOMAIN" "0.1.0+1.20.0" \
|
|
--no-input --no-converge-checks
|
|
assert_success
|
|
|
|
run $ABRA app undeploy "$TEST_APP_DOMAIN" --no-input
|
|
assert_success
|
|
|
|
assert_output --partial 'UNDEPLOY OVERVIEW'
|
|
assert_output --partial 'CURRENT DEPLOYMENT 0.1.0+1.20.0'
|
|
assert_output --partial 'ENV VERSION 0.1.0+1.20.0'
|
|
assert_output --partial 'NEW DEPLOYMENT N/A'
|
|
|
|
run grep -q "TYPE=$TEST_RECIPE:0.1.0+1.20.0" \
|
|
"$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env"
|
|
assert_success
|
|
}
|
|
|
|
@test "chaos deploy and undeploy" {
|
|
headHash=$(_get_head_hash)
|
|
latestRelease=$(_latest_release)
|
|
|
|
run $ABRA app deploy "$TEST_APP_DOMAIN" \
|
|
--no-input --no-converge-checks --chaos
|
|
assert_success
|
|
|
|
run $ABRA app undeploy "$TEST_APP_DOMAIN" --no-input
|
|
assert_success
|
|
|
|
assert_output --partial 'UNDEPLOY OVERVIEW'
|
|
assert_output --partial "CURRENT DEPLOYMENT ${headHash:0:8}"
|
|
assert_output --partial "ENV VERSION ${headHash:0:8}"
|
|
assert_output --partial 'NEW DEPLOYMENT N/A'
|
|
|
|
run grep -q "TYPE=$TEST_RECIPE:${headHash:0:8}" \
|
|
"$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env"
|
|
assert_success
|
|
}
|
|
|
|
@test "chaos deploy with unstaged commits and undeploy" {
|
|
headHash=$(_get_head_hash)
|
|
|
|
run bash -c 'echo "unstaged changes" >> "$ABRA_DIR/recipes/$TEST_RECIPE/foo"'
|
|
assert_success
|
|
assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
|
|
|
run $ABRA app deploy "$TEST_APP_DOMAIN" \
|
|
--no-input --no-converge-checks --chaos
|
|
assert_success
|
|
|
|
run $ABRA app undeploy "$TEST_APP_DOMAIN" --no-input
|
|
assert_success
|
|
|
|
assert_output --partial 'UNDEPLOY OVERVIEW'
|
|
assert_output --partial "CURRENT DEPLOYMENT ${headHash:0:8}+U"
|
|
assert_output --partial "ENV VERSION ${headHash:0:8}+U"
|
|
assert_output --partial 'NEW DEPLOYMENT N/A'
|
|
|
|
run grep -q "TYPE=$TEST_RECIPE:${headHash:0:8}" \
|
|
"$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env"
|
|
assert_success
|
|
|
|
run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
|
assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
|
}
|