forked from nathan-weinberg/jeeves
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_functions.py
executable file
·98 lines (72 loc) · 3.33 KB
/
test_functions.py
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
from functions import *
def test_generate_header():
pass
def test_generate_html_file():
pass
def get_bugs_dict():
pass
def test_get_bugs_set():
mockers = {
'job1': {'bz': [0]},
'job2': {'bz': [123456]},
'job3': {'bz': [123456, 789123]}
}
assert get_bugs_set(mockers) == {123456, 789123}
def test_get_jenkins_job_info():
pass
def test_get_jenkins_jobs():
pass
def test_get_jira_dict():
pass
def test_get_jira_set():
mockers = {
'job1': {'jira': [0]},
'job2': {'jira': ['RHOSINFRA-123']},
'job3': {'jira': ['RHOSINFRA-123', 'RHOSENTDFG-456']}
}
assert get_jira_set(mockers) == {'RHOSINFRA-123', 'RHOSENTDFG-456'}
def test_get_osp_version():
assert get_osp_version('DFG-all-unified-16_director-rhel-virthost-3cont_2comp_3ceph-ipv4-geneve-ceph-native-default') == '16'
assert get_osp_version('DFG-backup-restore-overcloud-OSP-16-3cont_2comp_3ceph-ipv4-monolithic-broken-node') == '16'
assert get_osp_version('DFG-ceph-rhos-16_director-rhel-virthost-3cont_2comp_3ceph-ipv4-geneve-monolithic') == '16'
assert get_osp_version('DFG-ceph-rhos-16.1_director-rhel-virthost-3cont_2comp_3ceph-ipv4-geneve-monolithic') == '16.1'
assert get_osp_version('DFG-compute-nova-16_director-rhel-virthost-1cont_2comp_1ipa-ipv4-geneve-tls-everywhere') == '16'
assert get_osp_version('DFG-enterprise-backup_restore-undercloud-controllers-16-3cont_2comp_3ceph-ipv4-rear') == '16'
assert get_osp_version('DFG-enterprise-baremetal-16.2_director-3control_2compute_externalceph-titancluster') == '16.2'
assert get_osp_version('DFG-df-deployment-16-virthost-3cont_2comp_3ceph-ceph-ipv4-geneve-overcloud-ssl-enable') == '16'
assert get_osp_version('DFG-hardware_provisioning-rqci-16_director-rhel-8.1-spineleaf-provision-network-20191205-2116') == '16'
assert get_osp_version('DFG-network-networking-ovn-16_director-rhel-virthost-3cont_2comp-ipv6-geneve') == '16'
assert get_osp_version('DFG-osasinfra-shiftstack_on_vms-16_director-rhel-virthost-3cont_1comp-ipv4-geneve-hybrid_flat_4.3_3master_3worker-ovn') == '16'
assert get_osp_version('DFG-pidone-sanity-16_director-rhel-virthost-3cont_2comp-ipv4-geneve-tobiko_faults-sanity') == '16'
assert get_osp_version('DFG-security-keystone-16_director-rhel-virthost-1cont_1comp-ipv4-geneve-lvm-containers') == '16'
assert get_osp_version('DFG-upgrades-updates-16-from-passed_phase1-HA-ipv4') == '16'
assert get_osp_version('DFG-all-unified-weekly-multijob') is None
def test_get_other_blockers():
pass
def test_has_blockers():
mockers = {
'job1': {'bz': [123456]},
'job2': {'jira': ['RHOSINFRA-123']},
'job3': {'other': {'name': 'this is a test name'}},
'job4': {'bz': [0]},
'job5': {'jira': [0]},
'job6': {'other': [0]},
'job7': {'owners': '[email protected]'},
'job8': {'owners': '[email protected]', 'bz': [123456], 'jira': ['RHOSINFRA-123']},
'job9': {}
}
assert has_blockers(mockers, 'job1') == True
assert has_blockers(mockers, 'job2') == True
assert has_blockers(mockers, 'job3') == True
assert has_blockers(mockers, 'job4') == False
assert has_blockers(mockers, 'job5') == False
assert has_blockers(mockers, 'job6') == False
assert has_blockers(mockers, 'job7') == False
assert has_blockers(mockers, 'job8') == True
assert has_blockers(mockers, 'job9') == False
def test_percent_func():
assert percent(0, 1) == 0.0
assert percent(1, 2) == 50.0
assert percent(1, 1) == 100.0
def test_validate_config():
pass