From 21e141a84ca4f80020d5bcff7074b25b02a4baee Mon Sep 17 00:00:00 2001 From: Jiri Kortus Date: Fri, 12 Apr 2019 13:43:55 +0200 Subject: [PATCH] Add test for starting compose with deleted blueprint --- tests/cli/test_blueprints_sanity.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tests/cli/test_blueprints_sanity.sh b/tests/cli/test_blueprints_sanity.sh index a1701b5f..b62eacd8 100755 --- a/tests/cli/test_blueprints_sanity.sh +++ b/tests/cli/test_blueprints_sanity.sh @@ -70,5 +70,34 @@ __EOF__ rlRun -t -c "$CLI blueprints delete beakerlib" rlAssertEquals "bp not found after delete" "`$CLI blueprints list | grep beakerlib`" "" rlPhaseEnd + + rlPhaseStartTest "start a compose with deleted blueprint" + cat > to-be-deleted.toml << __EOF__ +name = "to-be-deleted" +description = "Dummy blueprint for testing compose start with a deleted blueprint" +version = "0.0.1" +__EOF__ + + rlRun -t -c "$CLI blueprints push to-be-deleted.toml" + rlRun -t -c "$CLI blueprints delete to-be-deleted" + rlRun -t -c "$CLI compose list | grep to-be-deleted" 1 + rlRun -t -c "$CLI blueprints list | grep to-be-deleted" 1 + compose_id=$($CLI compose start to-be-deleted tar) + rlAssertEquals "composer-cli exited with 1 when starting a compose using a deleted blueprint" "$?" "1" + compose_id=$(echo $compose_id | cut -f 2 -d' ') + + if [ -z "$compose_id" ]; then + rlPass "It wasn't possible to start a compose using a deleted blueprint." + else + rlFail "It was possible to start a compose using a deleted blueprint!" + # don't wait for the compose to finish if it started unexpectedly, and do cleanup + rlRun -t -c "$CLI compose cancel $compose_id" + rlRun -t -c "$CLI compose delete $compose_id" + fi + + rlRun -t -c "rm -f to-be-deleted.toml" + unset compose_id + rlPhaseEnd + rlJournalEnd rlJournalPrintText