From ce549d861da7984a565cc1c888dba9897f6261f6 Mon Sep 17 00:00:00 2001 From: Alexander Todorov Date: Mon, 8 Apr 2019 12:18:18 +0300 Subject: [PATCH] Add new sanity tests for blueprints - verify SemVer .patch number will be automatically updated when we push the blueprint a second time without changing version - verify show displays the content in TOML format and it matches what is on disk. Because of that also start with empty packages and groups fields in the initial toml. If they are missing they will be added automatically by lorax-composer and this simplifies the test - verify delete works (cherry picked from commit 7cbb324ae5c26ee7f878002e0b4839b2abea3981) --- 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 83143829..5c57944f 100755 --- a/tests/cli/test_blueprints_sanity.sh +++ b/tests/cli/test_blueprints_sanity.sh @@ -31,6 +31,8 @@ rlJournalStart name = "beakerlib" description = "Start building tests with beakerlib." version = "0.0.1" +modules = [] +groups = [] [[modules]] name = "beakerlib" @@ -41,5 +43,32 @@ __EOF__ rlAssertEquals "pushed bp is found via list" "`$CLI blueprints list | grep beakerlib`" "beakerlib" rlPhaseEnd + rlPhaseStartTest "blueprints show" + rlAssertEquals "show displays blueprint in TOML" "`$CLI blueprints show beakerlib`" "`cat beakerlib.toml`" + rlPhaseEnd + + rlPhaseStartTest "SemVer .patch version is incremented automatically" + # version is still 0.0.1 + rlAssertEquals "version is 0.0.1" "`$CLI blueprints show beakerlib | grep 0.0.1`" 'version = "0.0.1"' + # add a new package to the existing blueprint + cat >> beakerlib.toml << __EOF__ + +[[packages]] +name = "php" +version = "*" +__EOF__ + # push again + rlRun -t -c "$CLI blueprints push beakerlib.toml" + # official documentation says: + # If a new blueprint is uploaded with the same version the server will + # automatically bump the PATCH level of the version. If the version + # doesn't match it will be used as is. + rlAssertEquals "version is 0.0.2" "`$CLI blueprints show beakerlib | grep 0.0.2`" 'version = "0.0.2"' + rlPhaseEnd + + rlPhaseStartTest "blueprints delete" + rlRun -t -c "$CLI blueprints delete beakerlib" + rlAssertEquals "bp not found after delete" "`$CLI blueprints list | grep beakerlib`" "" + rlPhaseEnd rlJournalEnd rlJournalPrintText