Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 1 | package com.mirantis.mk |
| 2 | |
| 3 | /** |
| 4 | * |
| 5 | * Tests providing functions |
| 6 | * |
| 7 | */ |
| 8 | |
| 9 | /** |
| 10 | * Run e2e conformance tests |
| 11 | * |
| 12 | * @param k8s_api Kubernetes api address |
| 13 | * @param image Docker image with tests |
| 14 | */ |
| 15 | def runConformanceTests(master, k8s_api, image) { |
| 16 | def salt = new com.mirantis.mk.Salt() |
Tomáš Kukrál | a7318f5 | 2017-04-21 16:15:29 +0200 | [diff] [blame] | 17 | def outfile = "/tmp/" + image.replaceAll('/', '-') + '.output' |
| 18 | salt.runSaltProcessStep(master, 'ctl01*', 'cmd.run', ["docker run --rm --net=host -e API_SERVER=${k8s_api} ${image} > ${outfile}"]) |
Tomáš Kukrál | 798b3f5 | 2017-04-28 13:19:32 +0200 | [diff] [blame^] | 19 | print("Conformance test output saved in " + outfile) |
Tatyana Leontovich | c73d63c | 2017-02-28 14:41:38 +0200 | [diff] [blame] | 20 | } |
| 21 | |
| 22 | /** |
| 23 | * Copy test output to cfg node |
| 24 | * |
| 25 | * @param image Docker image with tests |
| 26 | */ |
| 27 | def copyTestsOutput(master, image) { |
| 28 | def salt = new com.mirantis.mk.Salt() |
| 29 | salt.runSaltProcessStep(master, 'cfg01*', 'cmd.run', ["scp ctl01:/root/${image}.output /home/ubuntu/"]) |
| 30 | } |
| 31 | |
Victor Ryzhenkin | c5b3029 | 2017-02-21 19:26:24 +0400 | [diff] [blame] | 32 | /** |
| 33 | * Execute tempest tests |
| 34 | * |
| 35 | * @param tempestLink Docker image link with rally and tempest |
| 36 | */ |
| 37 | def runTempestTests(master, tempestLink) { |
| 38 | def salt = new com.mirantis.mk.Salt() |
| 39 | salt.runSaltProcessStep(master, 'ctl01*', 'cmd.run', ["docker run --rm --net=host " + |
| 40 | "-e TEMPEST_CONF=mcp.conf " + |
| 41 | "-e SKIP_LIST=mcp_skip.list " + |
| 42 | "-e SOURCE_FILE=keystonercv3 " + |
| 43 | "-v /root/:/home/rally ${tempestLink} >> docker-tempest.log"]) |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * Upload results to worker |
| 48 | * |
| 49 | */ |
| 50 | def copyTempestResults(master) { |
| 51 | def salt = new com.mirantis.mk.Salt() |
| 52 | salt.runSaltProcessStep(master, 'ctl01*', 'cmd.run', ["scp /root/docker-tempest.log cfg01:/home/ubuntu/ && " + |
| 53 | "find /root -name result.xml -exec scp {} cfg01:/home/ubuntu \\;"]) |
| 54 | } |
| 55 | |
| 56 | |
Tatyana Leontovich | 01704b3 | 2017-03-06 12:26:33 +0200 | [diff] [blame] | 57 | /** Store tests results on host |
Victor Ryzhenkin | c5b3029 | 2017-02-21 19:26:24 +0400 | [diff] [blame] | 58 | * |
Tatyana Leontovich | 01704b3 | 2017-03-06 12:26:33 +0200 | [diff] [blame] | 59 | * @param image Docker image name |
| 60 | */ |
| 61 | def catTestsOutput(master, image) { |
| 62 | def salt = new com.mirantis.mk.Salt() |
| 63 | salt.runSaltProcessStep(master, 'cfg01*', 'cmd.run', ["cat /home/ubuntu/${image}.output"]) |
| 64 | } |