Refactored test salt formulas env pipeline
Change-Id: Ia3be263220912cf7e4294c3c8c50dea02ff6db7f
diff --git a/test-salt-formulas-env.groovy b/test-salt-formulas-env.groovy
index 64b089e..1f646b9 100644
--- a/test-salt-formulas-env.groovy
+++ b/test-salt-formulas-env.groovy
@@ -62,14 +62,10 @@
common.infoMsg("Running part of kitchen test")
if (KITCHEN_ENV != null && !KITCHEN_ENV.isEmpty() && KITCHEN_ENV != "") {
def cleanEnv = KITCHEN_ENV.replaceAll("\\s?SUITE=[^\\s]*", "")
- def suitePattern = java.util.regex.Pattern.compile("\\s?SUITE=([^\\s]*)")
- def suiteMatcher = suitePattern.matcher(KITCHEN_ENV)
- if (suiteMatcher.find()) {
- def suite = suiteMatcher.group(1)
- suiteMatcher = null
- def cleanSuite = suite.replaceAll("_", "-")
+ def suite = ruby.getSuiteName(KITCHEN_ENV)
+ if (suite && suite != "") {
common.infoMsg("Running kitchen test with environment:" + KITCHEN_ENV.trim())
- ruby.runKitchenTests(cleanEnv, cleanSuite)
+ ruby.runKitchenTests(cleanEnv, suite)
} else {
common.warningMsg("No SUITE was found. Running with all suites.")
ruby.runKitchenTests(cleanEnv, "")
@@ -93,4 +89,4 @@
println readFile(".kitchen/logs/kitchen.log")
}
}
-}
\ No newline at end of file
+}