blob: 9da8b1603a23e8cfd5ae951c900f75420c5e226b [file] [log] [blame]
Ievgeniia Zadorozhna14c20f32017-08-31 13:35:57 +03001/**
2 *
3 * Service test pipeline
4 *
5 * Expected parameters:
6 * SALT_MASTER_URL URL of Salt master
7 * SALT_MASTER_CREDENTIALS Credentials to the Salt API
8 * Test settings:
9 * IMAGE_LINK Link to docker image with Rally and Tempest
10 * TEST_TEMPEST_PATTERN If not false, run tests matched to pattern only
11 * TEST_TARGET Salt target for tempest node
12 * CLEANUP_REPORTS_AND_CONTAINER Cleanup reports from rally,tempest container, remove all containers started the IMAGE_LINK
13 * DO_CLEANUP_RESOURCES If "true": runs clean-up script for removing Rally and Tempest resources
14 */
15
16
17common = new com.mirantis.mk.Common()
18salt = new com.mirantis.mk.Salt()
19test = new com.mirantis.mk.Test()
chnyda625f4b42017-10-11 14:10:31 +020020def python = new com.mirantis.mk.Python()
Ievgeniia Zadorozhna14c20f32017-08-31 13:35:57 +030021
chnyda625f4b42017-10-11 14:10:31 +020022def pepperEnv = "pepperEnv"
Ievgeniia Zadorozhna14c20f32017-08-31 13:35:57 +030023
24node("python") {
25 try {
26
chnyda625f4b42017-10-11 14:10:31 +020027 stage('Setup virtualenv for Pepper') {
28 python.setupPepperVirtualenv(venvPepper, SALT_MASTER_URL, SALT_MASTER_CREDENTIALS)
Ievgeniia Zadorozhna14c20f32017-08-31 13:35:57 +030029 }
30
31 //
32 // Test
33 //
34
35 stage('Run OpenStack Tempest tests') {
chnyda625f4b42017-10-11 14:10:31 +020036 test.runTempestTests(pepperEnv, IMAGE_LINK, TEST_TARGET, TEST_TEMPEST_PATTERN, "/home/rally/rally_reports/",
Ievgeniia Zadorozhna14c20f32017-08-31 13:35:57 +030037 DO_CLEANUP_RESOURCES)
38 }
39 stage('Copy test reports') {
chnyda625f4b42017-10-11 14:10:31 +020040 test.copyTempestResults(pepperEnv, TEST_TARGET)
Ievgeniia Zadorozhna14c20f32017-08-31 13:35:57 +030041 }
42 stage('Archiving test artifacts') {
chnyda625f4b42017-10-11 14:10:31 +020043 test.archiveRallyArtifacts(pepperEnv, TEST_TARGET)
Ievgeniia Zadorozhna14c20f32017-08-31 13:35:57 +030044 }
45 } catch (Throwable e) {
46 currentBuild.result = 'FAILURE'
47 throw e
48 } finally {
49 if (CLEANUP_REPORTS_AND_CONTAINER.toBoolean()) {
50 stage('Cleanup reports and container') {
chnyda625f4b42017-10-11 14:10:31 +020051 test.removeReports(pepperEnv, TEST_TARGET, "rally_reports", 'rally_reports.tar')
52 test.removeDockerContainer(pepperEnv, TEST_TARGET, IMAGE_LINK)
Ievgeniia Zadorozhna14c20f32017-08-31 13:35:57 +030053 }
54 }
55 }
56}