Ievgeniia Zadorozhna | 14c20f3 | 2017-08-31 13:35:57 +0300 | [diff] [blame] | 1 | /** |
| 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 Zadorozhna | 0d09cf4 | 2017-10-31 16:30:38 +0300 | [diff] [blame] | 12 | * CONTAINER_NAME Name of the Docker container which runs Rally |
Ievgeniia Zadorozhna | 14c20f3 | 2017-08-31 13:35:57 +0300 | [diff] [blame] | 13 | * 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 | |
| 18 | common = new com.mirantis.mk.Common() |
| 19 | salt = new com.mirantis.mk.Salt() |
| 20 | test = new com.mirantis.mk.Test() |
chnyda | 625f4b4 | 2017-10-11 14:10:31 +0200 | [diff] [blame] | 21 | def python = new com.mirantis.mk.Python() |
Ievgeniia Zadorozhna | 14c20f3 | 2017-08-31 13:35:57 +0300 | [diff] [blame] | 22 | |
chnyda | 625f4b4 | 2017-10-11 14:10:31 +0200 | [diff] [blame] | 23 | def pepperEnv = "pepperEnv" |
Jakub Josef | a63f986 | 2018-01-11 17:58:38 +0100 | [diff] [blame] | 24 | timeout(time: 12, unit: 'HOURS') { |
| 25 | node("python") { |
| 26 | try { |
Ievgeniia Zadorozhna | 14c20f3 | 2017-08-31 13:35:57 +0300 | [diff] [blame] | 27 | |
Jakub Josef | a63f986 | 2018-01-11 17:58:38 +0100 | [diff] [blame] | 28 | // |
| 29 | // Prepare connection |
| 30 | // |
| 31 | stage('Setup virtualenv for Pepper') { |
| 32 | python.setupPepperVirtualenv(pepperEnv, SALT_MASTER_URL, SALT_MASTER_CREDENTIALS) |
| 33 | } |
Ievgeniia Zadorozhna | 14c20f3 | 2017-08-31 13:35:57 +0300 | [diff] [blame] | 34 | |
Jakub Josef | a63f986 | 2018-01-11 17:58:38 +0100 | [diff] [blame] | 35 | // |
| 36 | // Test |
| 37 | // |
Ievgeniia Zadorozhna | 14c20f3 | 2017-08-31 13:35:57 +0300 | [diff] [blame] | 38 | |
Jakub Josef | a63f986 | 2018-01-11 17:58:38 +0100 | [diff] [blame] | 39 | stage('Run OpenStack Rally scenario') { |
| 40 | test.runRallyScenarios(pepperEnv, IMAGE_LINK, TEST_TARGET, RALLY_SCENARIO, "/home/rally/rally_reports/", |
| 41 | DO_CLEANUP_RESOURCES) |
| 42 | } |
| 43 | stage('Copy test reports') { |
| 44 | test.copyTempestResults(pepperEnv, TEST_TARGET) |
| 45 | } |
| 46 | stage('Archiving test artifacts') { |
| 47 | test.archiveRallyArtifacts(pepperEnv, TEST_TARGET) |
| 48 | } |
| 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') { |
| 55 | test.removeReports(pepperEnv, TEST_TARGET, "rally_reports", 'rally_reports.tar') |
| 56 | test.removeDockerContainer(pepperEnv, TEST_TARGET, CONTAINER_NAME) |
| 57 | } |
Ievgeniia Zadorozhna | 14c20f3 | 2017-08-31 13:35:57 +0300 | [diff] [blame] | 58 | } |
| 59 | } |
| 60 | } |
| 61 | } |