parent
dc4c6784cb
commit
353b87e1fd
@ -21,7 +21,7 @@ var AppUndeployCommand = &cobra.Command{
|
|||||||
Use: "undeploy <app> [flags]",
|
Use: "undeploy <app> [flags]",
|
||||||
Aliases: []string{"un"},
|
Aliases: []string{"un"},
|
||||||
Short: "Undeploy an app",
|
Short: "Undeploy an app",
|
||||||
Long: `This does not destroy any of the application data.
|
Long: `This does not destroy any application data.
|
||||||
|
|
||||||
However, you should remain vigilant, as your swarm installation will consider
|
However, you should remain vigilant, as your swarm installation will consider
|
||||||
any previously attached volumes as eligible for pruning once undeployed.
|
any previously attached volumes as eligible for pruning once undeployed.
|
||||||
@ -79,6 +79,11 @@ Passing "--prune/-p" does not remove those volumes.`,
|
|||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Debugf("choosing %s as version to save to env file", deployMeta.Version)
|
||||||
|
if err := app.WriteRecipeVersion(deployMeta.Version, false); err != nil {
|
||||||
|
log.Fatalf("writing undeployed recipe version in env file: %s", err)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,10 +107,10 @@ teardown(){
|
|||||||
|
|
||||||
# bats test_tags=slow
|
# bats test_tags=slow
|
||||||
@test "undeploy chaos deployment" {
|
@test "undeploy chaos deployment" {
|
||||||
run $ABRA app deploy "$TEST_APP_DOMAIN" \
|
run $ABRA app deploy "$TEST_APP_DOMAIN" --no-input --chaos
|
||||||
--no-input --no-converge-checks --chaos
|
|
||||||
|
|
||||||
_undeploy_app
|
run $ABRA app undeploy "$TEST_APP_DOMAIN" --no-input
|
||||||
|
assert_success
|
||||||
|
|
||||||
# NOTE(d1): ensure chaos undeploy
|
# NOTE(d1): ensure chaos undeploy
|
||||||
assert_output --partial ${_get_current_hash:0:8}
|
assert_output --partial ${_get_current_hash:0:8}
|
||||||
|
60
tests/integration/app_undeploy_env_version.bats
Normal file
60
tests/integration/app_undeploy_env_version.bats
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
#!/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
|
||||||
|
}
|
||||||
|
|
||||||
|
# bats test_tags=slow
|
||||||
|
@test "undeploy version written to env" {
|
||||||
|
run $ABRA app deploy "$TEST_APP_DOMAIN" "0.1.0+1.20.0" \
|
||||||
|
--no-input --no-converge-checks
|
||||||
|
assert_success
|
||||||
|
|
||||||
|
run grep -q "TYPE=$TEST_RECIPE:0.1.0+1.20.0" \
|
||||||
|
"$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env"
|
||||||
|
assert_success
|
||||||
|
|
||||||
|
run sed -i "s/TYPE=$TEST_RECIPE:.*/TYPE=$TEST_RECIPE/g" \
|
||||||
|
"$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env"
|
||||||
|
assert_success
|
||||||
|
|
||||||
|
run $ABRA app undeploy "$TEST_APP_DOMAIN" --no-input
|
||||||
|
assert_success
|
||||||
|
|
||||||
|
run grep -q "TYPE=$TEST_RECIPE:0.1.0+1.20.0" \
|
||||||
|
"$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env"
|
||||||
|
assert_success
|
||||||
|
}
|
||||||
|
|
||||||
|
# bats test_tags=slow
|
||||||
|
@test "chaos commit written to env" {
|
||||||
|
run $ABRA app deploy "$TEST_APP_DOMAIN" --no-input --chaos
|
||||||
|
|
||||||
|
run $ABRA app undeploy "$TEST_APP_DOMAIN" --no-input
|
||||||
|
assert_success
|
||||||
|
|
||||||
|
run grep -q "TYPE=$TEST_RECIPE:${_get_current_hash:0:8}" \
|
||||||
|
"$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env"
|
||||||
|
assert_success
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user