Run 3rd-party test suites without excess dependences

- each test method is parametrized with ENV_NAME to
  get unique names in JUnit reports for different
  configurations

Change-Id: I8db671d1687f287dc8ca97782cd7bbdf0eaef988
diff --git a/jobs/pipelines/deploy-cicd-and-run-tests.groovy b/jobs/pipelines/deploy-cicd-and-run-tests.groovy
index 27dbfd7..3e96c84 100644
--- a/jobs/pipelines/deploy-cicd-and-run-tests.groovy
+++ b/jobs/pipelines/deploy-cicd-and-run-tests.groovy
@@ -24,7 +24,7 @@
             shared.swarm_deploy_cicd(env.DRIVETRAIN_STACK_INSTALL)
         }
 
-        stage("Install core infrastructure and deploy CICD nodes") {
+        stage("Deploy platform components") {
             // steps: env.PLATFORM_STACK_INSTALL
             shared.swarm_deploy_platform(env.PLATFORM_STACK_INSTALL)
         }
@@ -40,8 +40,6 @@
         if ("${env.SHUTDOWN_ENV_ON_TEARDOWN}" == "false") {
             shared.run_cmd("""\
                 dos.py resume ${ENV_NAME} || true
-                sleep 20    # Wait for I/O on the host calms down
-                dos.py time-sync ${ENV_NAME} || true
             """)
         } else {
             shared.run_cmd("""\
@@ -72,8 +70,6 @@
         if ("${env.SHUTDOWN_ENV_ON_TEARDOWN}" == "false") {
             shared.run_cmd("""\
                 dos.py resume ${ENV_NAME} || true
-                sleep 20    # Wait for I/O on the host calms down
-                dos.py time-sync ${ENV_NAME} || true
             """)
         } else {
             shared.run_cmd("""\
diff --git a/jobs/pipelines/swarm-run-pytest.groovy b/jobs/pipelines/swarm-run-pytest.groovy
index 52dd25d..553b8a2 100644
--- a/jobs/pipelines/swarm-run-pytest.groovy
+++ b/jobs/pipelines/swarm-run-pytest.groovy
@@ -53,6 +53,7 @@
                     export ${it}_installed=true"""}.join("\n")
 
                 shared.run_cmd(sources + installed + """
+                    export TESTS_CONFIGS=${ENV_NAME}_salt_deployed.ini
                     export MANAGER=devops  # use 'hardware' fixture to manage fuel-devops environment
                     export salt_master_host=\$SALT_MASTER_IP  # skip salt_deployed fixture
                     export salt_master_port=6969
diff --git a/jobs/pipelines/swarm-testrail-report.groovy b/jobs/pipelines/swarm-testrail-report.groovy
index 7d2ce53..333547a 100644
--- a/jobs/pipelines/swarm-testrail-report.groovy
+++ b/jobs/pipelines/swarm-testrail-report.groovy
@@ -37,55 +37,76 @@
             def testrail_name_template = ''
             def reporter_extra_options = []
 
-            //stage("Archive all xml reports") {
-            //    archiveArtifacts artifacts: "${PARENT_WORKSPACE}/*.xml"
-            //}
-
-            stage("Deployment report") {
-                report_name = "deployment_${ENV_NAME}.xml"
-                testSuiteName = "[MCP] Integration automation"
-                methodname = '{methodname}'
-                testrail_name_template = '{title}'
-                reporter_extra_options = [
-                  "--testrail-add-missing-cases",
-                  "--testrail-case-custom-fields {\\\"custom_qa_team\\\":\\\"9\\\"}",
-                  "--testrail-case-section-name \'All\'",
-                ]
-                shared.upload_results_to_testrail(report_name, testSuiteName, methodname, testrail_name_template, reporter_extra_options)
+            stage("Archive all xml reports") {
+                archiveArtifacts artifacts: "**/*.xml"
             }
 
-            stage("tcp-qa cases report") {
-                report_name = "nosetests.xml"
-                testSuiteName = "[MCP_X] integration cases"
-                methodname = "{methodname}"
-                testrail_name_template = "{title}"
-                shared.upload_results_to_testrail(report_name, testSuiteName, methodname, testrail_name_template)
-            }
+            def deployment_report_name = sh(script: "find ${PARENT_WORKSPACE} -name \"deployment_${ENV_NAME}.xml\"", returnStdout: true)
+            def tcpqa_report_name = sh(script: "find ${PARENT_WORKSPACE} -name \"nosetests.xml\"", returnStdout: true)
+            def tempest_report_name = sh(script: "find ${PARENT_WORKSPACE} -name \"report_*.xml\"", returnStdout: true)
+            def k8s_conformance_report_name = sh(script: "find ${PARENT_WORKSPACE} -name \"conformance_result.xml\"", returnStdout: true)
+            def stacklight_report_name = sh(script: "find ${PARENT_WORKSPACE} -name \"stacklight_report.xml\"", returnStdout: true)
+            common.printMsg(deployment_report_name ? "Found deployment report: ${deployment_report_name}" : "Deployment report not found", deployment_report_name ? "blue" : "red")
+            common.printMsg(tcpqa_report_name ? "Found tcp-qa report: ${tcpqa_report_name}" : "tcp-qa report not found", tcpqa_report_name ? "blue" : "red")
+            common.printMsg(tempest_report_name ? "Found tempest report: ${tempest_report_name}" : "tempest report not found", tempest_report_name ? "blue" : "red")
+            common.printMsg(k8s_conformance_report_name ? "Found k8s conformance report: ${k8s_conformance_report_name}" : "k8s conformance report not found", k8s_conformance_report_name ? "blue" : "red")
+            common.printMsg(stacklight_report_name ? "Found stacklight-pytest report: ${stacklight_report_name}" : "stacklight-pytest report not found", stacklight_report_name ? "blue" : "red")
 
-            if ('openstack' in stacks) {
-                stage("Tempest report") {
-                    report_name = "report_*.xml"
-                    testSuiteName = "[MCP1.1_PIKE]Tempest"
-                    methodname = "{classname}.{methodname}"
-                    testrail_name_template = "{title}"
-                    shared.upload_results_to_testrail(report_name, testSuiteName, methodname, testrail_name_template)
+
+            if (deployment_report_name) {
+                stage("Deployment report") {
+//                    report_name = "deployment_${ENV_NAME}.xml"
+                    testSuiteName = "[MCP] Integration automation"
+                    methodname = '{methodname}'
+                    testrail_name_template = '{title}'
+                    reporter_extra_options = [
+                      "--testrail-add-missing-cases",
+                      "--testrail-case-custom-fields {\\\"custom_qa_team\\\":\\\"9\\\"}",
+                      "--testrail-case-section-name \'All\'",
+                    ]
+                    shared.upload_results_to_testrail(deployment_report_name, testSuiteName, methodname, testrail_name_template, reporter_extra_options)
                 }
             }
 
-            if ('k8s' in stacks) {
+            if (tcpqa_report_name) {
+                stage("tcp-qa cases report") {
+//                    report_name = "nosetests.xml"
+                    testSuiteName = "[MCP_X] integration cases"
+                    methodname = "{methodname}"
+                    testrail_name_template = "{title}"
+                    reporter_extra_options = [
+                      "--testrail-add-missing-cases",
+                      "--testrail-case-custom-fields {\\\"custom_qa_team\\\":\\\"9\\\"}",
+                      "--testrail-case-section-name \'All\'",
+                    ]
+                    shared.upload_results_to_testrail(tcpqa_report_name, testSuiteName, methodname, testrail_name_template, reporter_extra_options)
+                }
+            }
+
+            if ('openstack' in stacks && tempest_report_name) {
                 stage("Tempest report") {
+//                    report_name = "report_*.xml"
+                    testSuiteName = "[MCP1.1_PIKE]Tempest"
+                    methodname = "{classname}.{methodname}"
+                    testrail_name_template = "{title}"
+                    shared.upload_results_to_testrail(tempest_report_name, testSuiteName, methodname, testrail_name_template)
+                }
+            }
+
+            if ('k8s' in stacks && k8s_conformance_report_name) {
+                stage("K8s conformance report") {
                     println "TBD"
                     // K8s conformance report
                 }
             }
 
-            if ('stacklight' in stacks) {
+            if ('stacklight' in stacks && stacklight_report_name) {
                 stage("stacklight-pytest report") {
-                    report_name = "report.xml"
+//                    report_name = "stacklight_report.xml"
                     testSuiteName = "LMA2.0_Automated"
                     methodname = "{methodname}"
                     testrail_name_template = "{title}"
-                    shared.upload_results_to_testrail(report_name, testSuiteName, methodname, testrail_name_template)
+                    shared.upload_results_to_testrail(stacklight_report_name, testSuiteName, methodname, testrail_name_template)
                 }
             }