blob: 71e5f8b0f72af62f67d82a83d72d2d34e0d5d547 [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
10 * RALLY_SCENARIO Rally test scenario
11 * TEST_TARGET Salt target for Rally node
Ievgeniia Zadorozhna0d09cf42017-10-31 16:30:38 +030012 * CONTAINER_NAME Name of the Docker container which runs Rally
Ievgeniia Zadorozhna14c20f32017-08-31 13:35:57 +030013 * CLEANUP_REPORTS_AND_CONTAINER Cleanup reports from rally,tempest container, remove all containers started the IMAGE_LINK
14 * DO_CLEANUP_RESOURCES If "true": runs clean-up script for removing Rally and Tempest resources
15 */
16
17
18common = new com.mirantis.mk.Common()
19salt = new com.mirantis.mk.Salt()
20test = new com.mirantis.mk.Test()
chnyda625f4b42017-10-11 14:10:31 +020021def python = new com.mirantis.mk.Python()
Ievgeniia Zadorozhna14c20f32017-08-31 13:35:57 +030022
chnyda625f4b42017-10-11 14:10:31 +020023def pepperEnv = "pepperEnv"
Ievgeniia Zadorozhna14c20f32017-08-31 13:35:57 +030024
25node("python") {
26 try {
27
28 //
29 // Prepare connection
30 //
chnyda625f4b42017-10-11 14:10:31 +020031 stage('Setup virtualenv for Pepper') {
Dmitrii Kabanovf31c8962017-10-12 21:00:30 -070032 python.setupPepperVirtualenv(pepperEnv, SALT_MASTER_URL, SALT_MASTER_CREDENTIALS)
Ievgeniia Zadorozhna14c20f32017-08-31 13:35:57 +030033 }
34
35 //
36 // Test
37 //
38
39 stage('Run OpenStack Rally scenario') {
chnyda625f4b42017-10-11 14:10:31 +020040 test.runRallyScenarios(pepperEnv, IMAGE_LINK, TEST_TARGET, RALLY_SCENARIO, "/home/rally/rally_reports/",
Ievgeniia Zadorozhna14c20f32017-08-31 13:35:57 +030041 DO_CLEANUP_RESOURCES)
42 }
43 stage('Copy test reports') {
chnyda625f4b42017-10-11 14:10:31 +020044 test.copyTempestResults(pepperEnv, TEST_TARGET)
Ievgeniia Zadorozhna14c20f32017-08-31 13:35:57 +030045 }
46 stage('Archiving test artifacts') {
chnyda625f4b42017-10-11 14:10:31 +020047 test.archiveRallyArtifacts(pepperEnv, TEST_TARGET)
Ievgeniia Zadorozhna14c20f32017-08-31 13:35:57 +030048 }
49 } catch (Throwable e) {
50 currentBuild.result = 'FAILURE'
51 throw e
52 } finally {
53 if (CLEANUP_REPORTS_AND_CONTAINER.toBoolean()) {
54 stage('Cleanup reports and container') {
chnyda625f4b42017-10-11 14:10:31 +020055 test.removeReports(pepperEnv, TEST_TARGET, "rally_reports", 'rally_reports.tar')
Ievgeniia Zadorozhna0d09cf42017-10-31 16:30:38 +030056 test.removeDockerContainer(pepperEnv, TEST_TARGET, CONTAINER_NAME)
Ievgeniia Zadorozhna14c20f32017-08-31 13:35:57 +030057 }
58 }
59 }
60}