File: test_jenkins_matrix.py

package info (click to toggle)
python-jenkinsapi 0.3.17-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,500 kB
  • sloc: python: 10,001; xml: 50; makefile: 31; sh: 26
file content (31 lines) | stat: -rw-r--r-- 911 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""
System tests for `jenkinsapi.jenkins` module.
"""

import re
import time
from jenkinsapi_tests.systests.job_configs import MATRIX_JOB
from jenkinsapi_tests.test_utils.random_strings import random_string


def test_invoke_matrix_job(jenkins):
    job_name = "create_%s" % random_string()
    job = jenkins.create_job(job_name, MATRIX_JOB)
    queueItem = job.invoke()
    queueItem.block_until_complete()

    build = job.get_last_build()

    while build.is_running():
        time.sleep(1)

    set_of_groups = set()
    for run in build.get_matrix_runs():
        assert run.get_number() == build.get_number()
        assert run.get_upstream_build() == build
        match_result = re.search("\xbb (.*) #\\d+$", run.name)
        assert match_result is not None
        set_of_groups.add(match_result.group(1))
        build.get_master_job_name()

    assert set_of_groups == set(["one", "two", "three"])