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() |
| 20 | |
| 21 | // Define global variables |
| 22 | def saltMaster |
| 23 | |
| 24 | node("python") { |
| 25 | try { |
| 26 | |
| 27 | // |
| 28 | // Prepare connection |
| 29 | // |
| 30 | stage ('Connect to salt master') { |
| 31 | // Connect to Salt master |
| 32 | saltMaster = salt.connection(SALT_MASTER_URL, SALT_MASTER_CREDENTIALS) |
| 33 | } |
| 34 | |
| 35 | // |
| 36 | // Test |
| 37 | // |
| 38 | |
| 39 | stage('Run OpenStack Tempest tests') { |
| 40 | test.runTempestTests(saltMaster, IMAGE_LINK, TEST_TARGET, TEST_TEMPEST_PATTERN, "/home/rally/rally_reports/", |
| 41 | DO_CLEANUP_RESOURCES) |
| 42 | } |
| 43 | stage('Copy test reports') { |
| 44 | test.copyTempestResults(saltMaster, TEST_TARGET) |
| 45 | } |
| 46 | stage('Archiving test artifacts') { |
| 47 | test.archiveRallyArtifacts(saltMaster, 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(saltMaster, TEST_TARGET, "rally_reports", 'rally_reports.tar') |
| 56 | test.removeDockerContainer(saltMaster, TEST_TARGET, IMAGE_LINK) |
| 57 | } |
| 58 | } |
| 59 | } |
| 60 | } |