Cleanup previous run output files 14/71914/1
authorVincent Mahe <v.mahe@orange.com>
Tue, 15 Sep 2020 15:41:38 +0000 (17:41 +0200)
committerCédric Ollivier <cedric.ollivier@orange.com>
Tue, 9 Feb 2021 18:30:12 +0000 (19:30 +0100)
Signed-off-by: Vincent Mahe <v.mahe@orange.com>
Change-Id: I9ec39012457ae1a5f7017d41d79237d7a1e300d4
(cherry picked from commit 43d5772accb16742f09ddbc3d89ff5c315a2c0a4)

docker/mts/Dockerfile
xtesting/ci/testcases.yaml
xtesting/core/mts.py

index e7c3d5e..4d22ffb 100644 (file)
@@ -20,5 +20,5 @@ RUN apk --no-cache add --update openjdk8-jre && \
         java -jar target/mts-${MTS_TAG}-installer.jar -options /src/mts-installer.properties) && \
     rm -rf /root/.m2/ ${APP_FOLDER}/tutorial /src/mts-installer.properties /src/git-mts && \
     apk del .build-deps
-COPY testcases.yaml /usr/lib/python3.8/site-packages/xtesting/ci/testcases.yaml
+COPY testcases.yaml /usr/lib/python2.7/site-packages/xtesting/ci/testcases.yaml
 CMD ["run_tests", "-t", "all"]
index f987ee5..bc7203b 100644 (file)
@@ -77,7 +77,7 @@ tiers:
                     name: 'behaveframework'
                     args:
                         suites:
-                            - /usr/lib/python3.6/site-packages/xtesting/samples/features/
+                            - /usr/lib/python2.7/site-packages/xtesting/samples/features/
                         tags:
                             - foo
 
index 0c861e9..a7ec9d2 100644 (file)
@@ -18,6 +18,7 @@ helpers to run any python method or any bash command.
 import csv
 import logging
 import os
+import shutil
 import subprocess
 import sys
 import time
@@ -209,10 +210,18 @@ class MTSLauncher(testcase.TestCase):
                                              self.mts_logs_dir)
 
             # Make sure to create the necessary output sub-folders for MTS
-            if not os.path.isdir(self.mts_stats_dir):
-                os.makedirs(self.mts_stats_dir)
-            if not os.path.isdir(self.mts_logs_dir):
-                os.makedirs(self.mts_logs_dir)
+            # and cleanup output files from previous run.
+            if os.path.exists(self.mts_result_csv_file):
+                os.remove(self.mts_result_csv_file)
+
+            if os.path.isdir(self.mts_stats_dir):
+                shutil.rmtree(self.mts_stats_dir)
+            os.makedirs(self.mts_stats_dir)
+
+            if os.path.isdir(self.mts_logs_dir):
+                shutil.rmtree(self.mts_logs_dir)
+            os.makedirs(self.mts_logs_dir)
+
             self.__logger.info(
                 "MTS statistics output dir: %s ", self.mts_stats_dir)
             self.__logger.info("MTS logs output dir: %s ", self.mts_logs_dir)