Add support for Openstack Kitchen tests
Change-Id: I45e09afcf0160ade12fb163ac34b7ddc1c8ebd58
diff --git a/test-salt-formulas-env.groovy b/test-salt-formulas-env.groovy
index e2dbf83..608182e 100644
--- a/test-salt-formulas-env.groovy
+++ b/test-salt-formulas-env.groovy
@@ -18,6 +18,7 @@
}
def checkouted = false
+def openstackTest = false
throttle(['test-formula']) {
timeout(time: 1, unit: 'HOURS') {
@@ -37,8 +38,16 @@
}
stage("kitchen") {
if (checkouted) {
- if (fileExists(".kitchen.yml")) {
- common.infoMsg(".kitchen.yml found, running kitchen tests")
+ if (fileExists(".kitchen.yml") || fileExists(".kitchen.openstack.yml")) {
+ if (fileExists(".kitchen.openstack.yml")) {
+ common.infoMsg("Openstack Kitchen test configuration found, running Openstack kitchen tests.")
+ if (fileExists(".kitchen.yml")) {
+ common.infoMsg("Ignoring the docker Kitchen test configuration file.")
+ }
+ openstackTest = true
+ } else {
+ common.infoMsg("Docker Kitchen test configuration found, running Docker kitchen tests.")
+ }
ruby.ensureRubyEnv()
if (fileExists(".travis.yml")) {
common.infoMsg(".travis.yml found, running custom kitchen init")
@@ -46,11 +55,21 @@
def kitchenInit = kitchenConfigYML["install"]
def kitchenInstalled = false
if (kitchenInit && !kitchenInit.isEmpty()) {
- for (int i = 0; i < kitchenInit.size(); i++) {
- if (kitchenInit[i].trim().startsWith("test -e Gemfile")) { //found Gemfile config
- common.infoMsg("Custom Gemfile configuration found, using them")
- ruby.installKitchen(kitchenInit[i].trim())
- kitchenInstalled = true
+ if (!openstackTest) {
+ for (int i = 0; i < kitchenInit.size(); i++) {
+ if (kitchenInit[i].trim().startsWith("test -e Gemfile")) { //found Gemfile config
+ common.infoMsg("Custom Gemfile configuration found, using them")
+ ruby.installKitchen(kitchenInit[i].trim())
+ kitchenInstalled = true
+ }
+ }
+ } else {
+ for (int i = 0; i < kitchenInit.size(); i++) {
+ if (kitchenInit[i].trim().startsWith("git clone")) { //found Gemfile config TODO: Change keywords ??
+ common.infoMsg("Custom Gemfile configuration found, using them")
+ sh(kitchenInit[i].trim())
+ kitchenInstalled = true
+ }
}
}
}