[CI] Add upgrade tests to ci-build.sh
authorVarac <varac@leap.se>
Thu, 29 Jun 2017 15:14:45 +0000 (17:14 +0200)
committerVarac <varac@leap.se>
Fri, 30 Jun 2017 15:34:08 +0000 (17:34 +0200)
tests/platform-ci/ci-build.sh

index b02fe89..256164a 100755 (executable)
@@ -140,6 +140,29 @@ run() {
     test
 }
 
+upgrade_test() {
+  # Checkout stable branch containing last release
+  # and deploy this
+  cd "$PLATFORMDIR"
+  git remote add leap https://leap.se/git/leap_platform
+  git fetch leap
+  git checkout -b leap_stable remotes/leap/stable
+  cd "$PROVIDERDIR"
+  build_from_scratch
+  deploy
+  test
+
+  # Checkout HEAD of current branch and re-deploy
+  cd "$PLATFORMDIR"
+  git checkout "$CI_COMMIT_REF"
+  cd "$PROVIDERDIR"
+  deploy
+  test
+
+  cleanup
+
+}
+
 cleanup() {
   # if everything succeeds, destroy the vm
   LEAP_CMD vm rm "${TAG}"
@@ -184,6 +207,9 @@ case "$CI_JOB_NAME" in
     test
     cleanup
     ;;
+  upgrade_test)
+    upgrade_test
+    ;;
   *)
     fail "Don't know what to do for \$CI_JOB_NAME \"$CI_JOB_NAME\"!"
     ;;