From 9431f99949acbd1aa97fa13dc2df5ae8bc605b85 Mon Sep 17 00:00:00 2001 From: Ian Booth Date: Mon, 8 Aug 2022 12:52:41 +1000 Subject: [PATCH] Kill controller at end of ck test --- tests/includes/juju.sh | 6 +++++- tests/suites/ck/task.sh | 6 ++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/includes/juju.sh b/tests/includes/juju.sh index 70c4bc767ab..ee65935c4a9 100644 --- a/tests/includes/juju.sh +++ b/tests/includes/juju.sh @@ -376,7 +376,11 @@ destroy_controller() { output="${TEST_DIR}/${name}-destroy-controller.log" echo "====> Destroying juju ($(green "${name}"))" - echo "${name}" | xargs -I % juju destroy-controller --destroy-all-models -y % >"${output}" 2>&1 + if [[ ${KILL_CONTROLLER:-} != "true" ]]; then + echo "${name}" | xargs -I % juju destroy-controller --destroy-all-models -y % >"${output}" 2>&1 + else + echo "${name}" | xargs -I % juju kill-controller -t 0 -y % >"${output}" 2>&1 + fi set +e CHK=$(cat "${output}" | grep -i "ERROR" || true) diff --git a/tests/suites/ck/task.sh b/tests/suites/ck/task.sh index 3c48a46dd55..366d7b7d3cd 100644 --- a/tests/suites/ck/task.sh +++ b/tests/suites/ck/task.sh @@ -18,8 +18,6 @@ test_ck() { test_deploy_ck - if [[ ${BOOTSTRAP_REUSE:-} != "true" ]]; then - # CK takes too long to tear down (1h+), so forcibly destroy it - juju kill-controller -y -t 0 "${BOOTSTRAPPED_JUJU_CTRL_NAME}" || true - fi + # CK takes too long to tear down (1h+), so forcibly destroy it + export KILL_CONTROLLER=true }