blob: 7d0065d48222ed91dbd7ed0da77decde7990b0e1 [file] [log] [blame]
asledzinskiy69307da2017-01-19 16:37:16 +02001package com.mirantis.mcp_qa
asledzinskiye0948fd2017-01-06 16:23:54 +02002
3/**
4 * Run mcp-qa test by specified group
5 * @param testGroup defines what tests to run, options are '-m test_mark', '-k test_expression'
6 * @param jobSetParameters is additional params needed to run mcp-qa test
7 */
8
9def runTest(testGroup, jobSetParameters) {
10 def testArgs = [ '-s', '-ra' ]
11 testArgs.add(testGroup)
12 jobSetParameters.add("TEST_ARGS=${testArgs.join(' ')}")
13 echo("The current tags, args, which were set by job: ${jobSetParameters.join(' ')}")
14 withEnv(jobSetParameters) {
15 sh '''\
16 . ${VENV_PATH}/bin/activate
17 exit_code=0
18 export IMAGE_PATH=$(readlink -f "${IMAGE_PATH}")
19 if ! py.test ${TEST_ARGS}; then
20 exit_code=1
21 fi
asledzinskiye0948fd2017-01-06 16:23:54 +020022 if [ ${exit_code} -gt 0 ]; then
23 echo "Tests failed!"
24 exit 1
25 fi
26 '''.stripIndent()
27 }
28}