Belle II Software light-2406-ragdoll
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 conditions_db as cdb
19
20
21if __name__ == '__main__':
22
23 tags = ['main_tag_merge_test_1', 'main_tag_merge_test_2', 'main_tag_merge_test_3']
24 final_tag = 'main_tag_merge_test_0'
25
26 db = cdb.ConditionsDB()
27
28 for tag in tags:
29 payloads = db.get_all_iovs(globalTag=tag)
30 payloads.sort(key=lambda p: p.iov)
31
32 for payload in payloads:
33 print(f' {payload.name} r{payload.revision} {payload.iov}')
34
35 subprocess.check_call(['b2conditionsdb-tag-merge', '-o', final_tag, '--dry-run'] + tags)
36
37 subprocess.check_call(['b2conditionsdb-tag-merge', '-o', final_tag, '--dry-run', '--run-range', '5', '0', '5', '300'] + tags)