Belle II Software development
test_tag_merge.py
1
8
9'''
10Test for checking if b2conditionsdb-tag-merge behaves as expted:
11- highest priority to the first tag in the list;
12- within the same tag, highest priority to the payloads with the highest revision number.
13'''
14
15
16import subprocess
17
18import b2test_utils as b2tu
19import conditions_db as cdb
20
21
22if __name__ == '__main__':
23
24 if b2tu.is_cdb_down():
25 b2tu.skip_test('Test currently disabled due to CDB troubles')
26
27 tags = ['main_tag_merge_test_1', 'main_tag_merge_test_2', 'main_tag_merge_test_3']
28 final_tag = 'main_tag_merge_test_0'
29
30 db = cdb.ConditionsDB()
31
32 for tag in tags:
33 payloads = db.get_all_iovs(globalTag=tag)
34 payloads.sort(key=lambda p: p.iov)
35
36 for payload in payloads:
37 print(f' {payload.name} r{payload.revision} {payload.iov}')
38
39 subprocess.check_call(['b2conditionsdb-tag-merge', '-o', final_tag, '--dry-run'] + tags)
40
41 subprocess.check_call(['b2conditionsdb-tag-merge', '-o', final_tag, '--dry-run', '--run-range', '5', '0', '5', '300'] + tags)