blob: 4ef8b107dcc5881cd67d8e8330ed2fb5a67c9b6d [file] [log] [blame]
Jakub Josef79ecec32017-02-17 14:36:28 +01001package 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 */
15def runConformanceTests(master, k8s_api, image) {
16 def salt = new com.mirantis.mk.Salt()
Tomáš Kukrála7318f52017-04-21 16:15:29 +020017 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ál798b3f52017-04-28 13:19:32 +020019 print("Conformance test output saved in " + outfile)
Tatyana Leontovichc73d63c2017-02-28 14:41:38 +020020}
21
22/**
23 * Copy test output to cfg node
24 *
25 * @param image Docker image with tests
26 */
27def 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 Ryzhenkinc5b30292017-02-21 19:26:24 +040032/**
33 * Execute tempest tests
34 *
35 * @param tempestLink Docker image link with rally and tempest
36 */
37def 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 */
50def 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 Leontovich01704b32017-03-06 12:26:33 +020057/** Store tests results on host
Victor Ryzhenkinc5b30292017-02-21 19:26:24 +040058 *
Tatyana Leontovich01704b32017-03-06 12:26:33 +020059 * @param image Docker image name
60 */
61def catTestsOutput(master, image) {
62 def salt = new com.mirantis.mk.Salt()
63 salt.runSaltProcessStep(master, 'cfg01*', 'cmd.run', ["cat /home/ubuntu/${image}.output"])
64}