Extend reclass-system test to test cookiecutter

Change-Id: Ia6b6a803ad65655faf321af6d7842746e63b574f
diff --git a/test-cookiecutter-reclass.groovy b/test-cookiecutter-reclass.groovy
index f22a79e..abdecf9 100644
--- a/test-cookiecutter-reclass.groovy
+++ b/test-cookiecutter-reclass.groovy
@@ -82,7 +82,15 @@
     def templateContext = readYaml text: content
     def clusterName = templateContext.default_context.cluster_name
     def clusterDomain = templateContext.default_context.cluster_domain
-    git.checkoutGitRepository("${testEnv}/classes/system", RECLASS_MODEL_URL, RECLASS_MODEL_BRANCH, CREDENTIALS_ID)
+    if (SYSTEM_GIT_URL == "") {
+        git.checkoutGitRepository("${testEnv}/classes/system", RECLASS_MODEL_URL, RECLASS_MODEL_BRANCH, CREDENTIALS_ID)
+    } else {
+        dir("${testEnv}/classes/system") {
+            if (!gerrit.gerritPatchsetCheckout(SYSTEM_GIT_URL, SYSTEM_GIT_REF, "HEAD", CREDENTIALS_ID)) {
+              common.errorMsg("Failed to obtain system reclass with url: ${SYSTEM_GIT_URL} and ${SYSTEM_GIT_REF}")
+            }
+        }
+    }
 
     def nbTry = 0
     while (nbTry < 5) {