Quick fix test-salt-model-node.groovy

   * Pipeline should be refacrored

Change-Id: I912f9d16123c64e863c7370e60a65849ab26a33a
Closes-Bug: PROD-21240 (PROD:21240)
diff --git a/test-salt-model-node.groovy b/test-salt-model-node.groovy
index 3b6ee09..694f048 100644
--- a/test-salt-model-node.groovy
+++ b/test-salt-model-node.groovy
@@ -66,20 +66,20 @@
             try {
               def DockerCName = "${env.JOB_NAME.toLowerCase()}_${env.BUILD_TAG.toLowerCase()}"
 
-              saltModelTesting.setupAndTestNode(
-                      NODE_TARGET,
-                      CLUSTER_NAME,
-                      EXTRA_FORMULAS,
-                      workspace,
-                      FORMULAS_SOURCE,
-                      FORMULAS_REVISION,
-                      RECLASS_VERSION,
-                      MAX_CPU_PER_JOB.toInteger(),
-                      RECLASS_IGNORE_CLASS_NOTFOUND,
-                      LEGACY_TEST_MODE,
-                      APT_REPOSITORY,
-                      APT_REPOSITORY_GPG,
-                      DockerCName)
+              test_result = saltModelTesting.setupAndTestNode(
+                  NODE_TARGET,
+                  CLUSTER_NAME,
+                  EXTRA_FORMULAS,
+                  workspace,
+                  FORMULAS_SOURCE,
+                  FORMULAS_REVISION,
+                  RECLASS_VERSION,
+                  MAX_CPU_PER_JOB.toInteger(),
+                  RECLASS_IGNORE_CLASS_NOTFOUND,
+                  LEGACY_TEST_MODE,
+                  APT_REPOSITORY,
+                  APT_REPOSITORY_GPG,
+                  DockerCName)
             } catch (Exception e) {
               if (e.getMessage() == "script returned exit code 124") {
                 common.errorMsg("Impossible to test node due to timeout of salt-master, ABORTING BUILD")
@@ -88,13 +88,19 @@
                 throw e
               }
             }
+            if (test_result) {
+              common.infoMsg("Test finished: SUCCESS")
+            } else {
+              common.warningMsg("Test finished: FAILURE")
+              currentBuild.result = "FAILURE"
+            }
           }
         }
       } catch (Throwable e) {
-         // If there was an error or exception thrown, the build failed
-         currentBuild.result = "FAILURE"
-         currentBuild.description = currentBuild.description ? e.message + " " + currentBuild.description : e.message
-         throw e
+        // If there was an error or exception thrown, the build failed
+        currentBuild.result = "FAILURE"
+        currentBuild.description = currentBuild.description ? e.message + " " + currentBuild.description : e.message
+        throw e
       }
     }
   }