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 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 | |
| 17 | common = new com.mirantis.mk.Common() |
| 18 | salt = new com.mirantis.mk.Salt() |
| 19 | test = new com.mirantis.mk.Test() |
chnyda | 625f4b4 | 2017-10-11 14:10:31 +0200 | [diff] [blame^] | 20 | def python = new com.mirantis.mk.Python() |
Ievgeniia Zadorozhna | 14c20f3 | 2017-08-31 13:35:57 +0300 | [diff] [blame] | 21 | |
chnyda | 625f4b4 | 2017-10-11 14:10:31 +0200 | [diff] [blame^] | 22 | def pepperEnv = "pepperEnv" |
Ievgeniia Zadorozhna | 14c20f3 | 2017-08-31 13:35:57 +0300 | [diff] [blame] | 23 | |
| 24 | node("python") { |
| 25 | try { |
| 26 | |
chnyda | 625f4b4 | 2017-10-11 14:10:31 +0200 | [diff] [blame^] | 27 | stage('Setup virtualenv for Pepper') { |
| 28 | python.setupPepperVirtualenv(venvPepper, SALT_MASTER_URL, SALT_MASTER_CREDENTIALS) |
Ievgeniia Zadorozhna | 14c20f3 | 2017-08-31 13:35:57 +0300 | [diff] [blame] | 29 | } |
| 30 | |
| 31 | // |
| 32 | // Test |
| 33 | // |
| 34 | |
| 35 | stage('Run OpenStack Tempest tests') { |
chnyda | 625f4b4 | 2017-10-11 14:10:31 +0200 | [diff] [blame^] | 36 | test.runTempestTests(pepperEnv, IMAGE_LINK, TEST_TARGET, TEST_TEMPEST_PATTERN, "/home/rally/rally_reports/", |
Ievgeniia Zadorozhna | 14c20f3 | 2017-08-31 13:35:57 +0300 | [diff] [blame] | 37 | DO_CLEANUP_RESOURCES) |
| 38 | } |
| 39 | stage('Copy test reports') { |
chnyda | 625f4b4 | 2017-10-11 14:10:31 +0200 | [diff] [blame^] | 40 | test.copyTempestResults(pepperEnv, TEST_TARGET) |
Ievgeniia Zadorozhna | 14c20f3 | 2017-08-31 13:35:57 +0300 | [diff] [blame] | 41 | } |
| 42 | stage('Archiving test artifacts') { |
chnyda | 625f4b4 | 2017-10-11 14:10:31 +0200 | [diff] [blame^] | 43 | test.archiveRallyArtifacts(pepperEnv, TEST_TARGET) |
Ievgeniia Zadorozhna | 14c20f3 | 2017-08-31 13:35:57 +0300 | [diff] [blame] | 44 | } |
| 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') { |
chnyda | 625f4b4 | 2017-10-11 14:10:31 +0200 | [diff] [blame^] | 51 | test.removeReports(pepperEnv, TEST_TARGET, "rally_reports", 'rally_reports.tar') |
| 52 | test.removeDockerContainer(pepperEnv, TEST_TARGET, IMAGE_LINK) |
Ievgeniia Zadorozhna | 14c20f3 | 2017-08-31 13:35:57 +0300 | [diff] [blame] | 53 | } |
| 54 | } |
| 55 | } |
| 56 | } |