Use non-blocking method to launch conformance tests
Change-Id: I2f24d99db4c2e83276111e2268d191b1b3afec26
diff --git a/src/com/mirantis/mk/Test.groovy b/src/com/mirantis/mk/Test.groovy
index 95a432e..15fd18e 100644
--- a/src/com/mirantis/mk/Test.groovy
+++ b/src/com/mirantis/mk/Test.groovy
@@ -11,11 +11,22 @@
*
* @param k8s_api Kubernetes api address
* @param image Docker image with tests
+ * @param timeout Timeout waiting for e2e conformance tests
*/
-def runConformanceTests(master, k8s_api, image) {
+def runConformanceTests(master, k8s_api, image, timeout=2400) {
def salt = new com.mirantis.mk.Salt()
+ def containerName = 'conformance_tests'
def outfile = "/tmp/" + image.replaceAll('/', '-') + '.output'
- salt.runSaltProcessStep(master, 'ctl01*', 'cmd.run', ["docker run --rm --net=host -e API_SERVER=${k8s_api} ${image} > ${outfile}"])
+ salt.cmdRun(master, 'ctl01*', "docker rm -f ${containerName}", false)
+ salt.cmdRun(master, 'ctl01*', "docker run -d --name ${containerName} --net=host -e API_SERVER=${k8s_api} ${image}")
+ sleep(10)
+
+ print("Waiting for tests to run...")
+ salt.runSaltProcessStep(master, 'ctl01*', 'cmd.run', ["docker wait ${containerName}"], null, false, timeout)
+
+ print("Writing test results to output file...")
+ salt.runSaltProcessStep(master, 'ctl01*', 'cmd.run', ["docker logs -t ${containerName} &> ${outfile}"])
+
print("Conformance test output saved in " + outfile)
}