Cleanup and fix code of test-salt-models

Change-Id: I73a029ff30ec3ab79cd8180acb8930cc16d62eb0
diff --git a/test-salt-models-pipeline.groovy b/test-salt-models-pipeline.groovy
index 1df659e..72966f5 100644
--- a/test-salt-models-pipeline.groovy
+++ b/test-salt-models-pipeline.groovy
@@ -76,32 +76,17 @@
         def workspace = common.getWorkspace()
         def nodes = sh(script: "find ./nodes -type f -name 'cfg*.yml'", returnStdout: true).tokenize()
         def buildSteps = [:]
-        if(nodes.size() > 1){
-            if(nodes.size() <= 3 && PARALLEL_NODE_GROUP_SIZE.toInteger() != 1) {
-              common.infoMsg("Found <=3  cfg nodes, running parallel test")
-               for(int i=0; i < nodes.size();i++){
-                 def basename = sh(script: "basename ${partition[k]} .yml", returnStdout: true).trim()
-                 buildSteps.put("node-${basename}", { saltModelTesting.setupAndTestNode(basename, EXTRA_FORMULAS, workspace) })
-               }
-               parallel buildSteps
-            }else{
-              common.infoMsg("Found more than 3 cfg nodes or debug enabled, running parallel group test with ${PARALLEL_NODE_GROUP_SIZE} nodes")
-              def partitions = common.partitionList(nodes, PARALLEL_NODE_GROUP_SIZE.toInteger())
-              for (int i=0; i < partitions.size();i++) {
-                def partition = partitions[i]
-                buildSteps.put("partition-${i}", new HashMap<String,org.jenkinsci.plugins.workflow.cps.CpsClosure2>())
-                for(int k=0; k < partition.size;k++){
-                    def basename = sh(script: "basename ${partition[k]} .yml", returnStdout: true).trim()
-                    buildSteps.get("partition-${i}").put(basename, { saltModelTesting.setupAndTestNode(basename, EXTRA_FORMULAS, workspace) })
-                }
-              }
-              common.serial(buildSteps)
-            }
-        }else{
-            common.infoMsg("Found one cfg node, running single test")
-            def basename = sh(script: "basename ${nodes[0]} .yml", returnStdout: true).trim()
-            saltModelTesting.setupAndTestNode(basename, EXTRA_FORMULAS, workspace)
+        def partitionSize = (nodes.size() <= PARALLEL_NODE_GROUP_SIZE.toInteger()) ? nodes.size() : PARALLEL_NODE_GROUP_SIZE.toInteger()
+        def partitions = common.partitionList(nodes, partitionSize)
+        for (int i =0; i < partitions.size();i++) {
+          def partition = partitions[i]
+          buildSteps.put("partition-${i}", new HashMap<String,org.jenkinsci.plugins.workflow.cps.CpsClosure2>())
+          for(int k=0; k < partition.size;k++){
+              def basename = sh(script: "basename ${partition[k]} .yml", returnStdout: true).trim()
+              buildSteps.get("partition-${i}").put(basename, { saltModelTesting.setupAndTestNode(basename, EXTRA_FORMULAS, workspace) })
+          }
         }
+        common.serial(buildSteps)
       }
     }
   } catch (Throwable e) {