Bugfix: pre_condition cmds is just executed once 25/39925/2
authorxudan <xudan16@huawei.com>
Wed, 23 Aug 2017 01:24:09 +0000 (21:24 -0400)
committerxudan <xudan16@huawei.com>
Thu, 24 Aug 2017 02:28:53 +0000 (22:28 -0400)
JIRA: DOVETAIL-489

1. All the cmds defined in pre_condition is just executed once for each type
   i.e. functest, yardstick, bottlenecks...
2. The copy cmds defined in each functest test cases are just executed for the
   first test case rather than all test cases.
3. Make the cmds to be executed for each test case.

Change-Id: I571f0eb9dd3cab77fc8597e5a9b5246398804d3e
Signed-off-by: xudan <xudan16@huawei.com>
dovetail/test_runner.py

index 603156f..d6e910d 100644 (file)
@@ -82,17 +82,13 @@ class DockerRunner(object):
                                  exist_file_name):
                 return
 
-        if not self.testcase.prepared():
-            prepare_failed = False
-            cmds = self.testcase.pre_condition()
-            if cmds:
-                for cmd in cmds:
-                    ret, msg = Container.exec_cmd(container_id, cmd)
-                    if ret != 0:
-                        prepare_failed = True
-                        break
-            if not prepare_failed:
-                self.testcase.prepared(True)
+        cmds = self.testcase.pre_condition()
+        if cmds:
+            for cmd in cmds:
+                ret, msg = Container.exec_cmd(container_id, cmd)
+                if ret != 0:
+                    self.logger.error("Failed to exec all pre_condition cmds.")
+                    break
 
         if not self.testcase.prepare_cmd(self.type):
             self.logger.error(