Added jobs for running Tempest and Rally in DriveTrain
Added 2 jobs: for running Tempest and Rally in DriveTrain
* the corresponding patch set for mcp-ci/pipeline-library with
the functions that are used: https://gerrit.mcp.mirantis.net/#/c/9631/
* it is supposed that these pipelines are used with prebuild docker
container that contains: rally, tempest configs, rally scenarios,
run scripts, so the pipeline can download the Docker image to run the
tests.
Change-Id: Iec9f5472676810a3ad6c25cfb64c1531f82907b3
diff --git a/test-run-rally.groovy b/test-run-rally.groovy
new file mode 100644
index 0000000..4cf3bd3
--- /dev/null
+++ b/test-run-rally.groovy
@@ -0,0 +1,60 @@
+/**
+ *
+ * Service test pipeline
+ *
+ * Expected parameters:
+ * SALT_MASTER_URL URL of Salt master
+ * SALT_MASTER_CREDENTIALS Credentials to the Salt API
+ * Test settings:
+ * IMAGE_LINK Link to docker image with Rally
+ * RALLY_SCENARIO Rally test scenario
+ * TEST_TARGET Salt target for Rally node
+ * CLEANUP_REPORTS_AND_CONTAINER Cleanup reports from rally,tempest container, remove all containers started the IMAGE_LINK
+ * DO_CLEANUP_RESOURCES If "true": runs clean-up script for removing Rally and Tempest resources
+ */
+
+
+common = new com.mirantis.mk.Common()
+salt = new com.mirantis.mk.Salt()
+test = new com.mirantis.mk.Test()
+
+// Define global variables
+def saltMaster
+
+node("python") {
+ try {
+
+ //
+ // Prepare connection
+ //
+ stage ('Connect to salt master') {
+ // Connect to Salt master
+ saltMaster = salt.connection(SALT_MASTER_URL, SALT_MASTER_CREDENTIALS)
+ }
+
+ //
+ // Test
+ //
+
+ stage('Run OpenStack Rally scenario') {
+ test.runRallyScenarios(saltMaster, IMAGE_LINK, TEST_TARGET, RALLY_SCENARIO, "/home/rally/rally_reports/",
+ DO_CLEANUP_RESOURCES)
+ }
+ stage('Copy test reports') {
+ test.copyTempestResults(saltMaster, TEST_TARGET)
+ }
+ stage('Archiving test artifacts') {
+ test.archiveRallyArtifacts(saltMaster, TEST_TARGET)
+ }
+ } catch (Throwable e) {
+ currentBuild.result = 'FAILURE'
+ throw e
+ } finally {
+ if (CLEANUP_REPORTS_AND_CONTAINER.toBoolean()) {
+ stage('Cleanup reports and container') {
+ test.removeReports(saltMaster, TEST_TARGET, "rally_reports", 'rally_reports.tar')
+ test.removeDockerContainer(saltMaster, TEST_TARGET, IMAGE_LINK)
+ }
+ }
+ }
+}