Remove env erase from runTest

- Env erase shouldn't be part of runTest because it erases
envs between stages and so that all starts from scratch.
- Env erase moved to separate function

Change-Id: I49ed4ca05606486f5d4955d99cfa4e42f6cd9663
diff --git a/src/com/mirantis/mcp_qa/EnvActions.groovy b/src/com/mirantis/mcp_qa/EnvActions.groovy
index d95c411..4df4f64 100644
--- a/src/com/mirantis/mcp_qa/EnvActions.groovy
+++ b/src/com/mirantis/mcp_qa/EnvActions.groovy
@@ -32,3 +32,14 @@
         '''
     }
 }
+
+/**
+ * Erase running environment
+ */
+def eraseEnv() {
+        sh '''
+            . ${VENV_PATH}/bin/activate
+            dos.py erase ${ENV_NAME} || true
+        '''
+}
+
diff --git a/src/com/mirantis/mcp_qa/RunTest.groovy b/src/com/mirantis/mcp_qa/RunTest.groovy
index 0048ee5..7d0065d 100644
--- a/src/com/mirantis/mcp_qa/RunTest.groovy
+++ b/src/com/mirantis/mcp_qa/RunTest.groovy
@@ -19,12 +19,6 @@
             if ! py.test ${TEST_ARGS}; then
             exit_code=1
             fi
-            # erase environment if test passed and KEEP_AFTER isn't set to 'yes' or 'true'
-            if [ ${exit_code} -eq 0 ]; then
-            if ! [[ "${KEEP_AFTER}" == "yes" || "${KEEP_AFTER}" == "true" ]]; then
-            dos.py erase "${ENV_NAME}" || true
-            fi
-            fi
             if [ ${exit_code} -gt 0 ]; then
             echo "Tests failed!"
             exit 1