File indexing completed on 2026-12-02 10:29:13
0001 """register-evgen-rucio.py's DID and PFN for a door path: the deterministic
0002 form EIC-XRD expects (prefix //cache/eic/EPIC), so add_replicas accepts it."""
0003 import importlib.util
0004 from pathlib import Path
0005 import unittest
0006
0007 SCRIPTS = Path(__file__).resolve().parents[3] / 'scripts'
0008 spec = importlib.util.spec_from_file_location('register_evgen_rucio',
0009 SCRIPTS / 'register-evgen-rucio.py')
0010 reg = importlib.util.module_from_spec(spec)
0011 spec.loader.exec_module(reg)
0012
0013 DIR = '/EVGEN/EW_BSM/ALP/madgraph5-3.7.0-1.0/aem-axem/10x110/ma_1.0'
0014 FILE = DIR + '/madgraph5-3.7.0-1.0_aem-axem_10x110_ma_1.0_run000.hepmc3.tree.root'
0015
0016
0017 class PlanDatasetsTests(unittest.TestCase):
0018 def test_base_is_the_cache_area(self):
0019 self.assertEqual(reg.XRD_BASE, '/cache/eic/EPIC')
0020
0021 def test_name_and_pfn_from_a_cache_door_path(self):
0022 datasets = reg.plan_datasets([(reg.XRD_BASE + FILE, 10956266)],
0023 {reg.XRD_BASE + FILE: '0a1b2c3d'})
0024 self.assertEqual(list(datasets), [DIR])
0025 entry, = datasets[DIR]
0026 self.assertEqual(entry['name'], FILE)
0027 self.assertEqual((entry['scope'], entry['bytes'], entry['adler32']),
0028 ('epic', 10956266, '0a1b2c3d'))
0029 self.assertEqual(entry['pfn'],
0030 f'{reg.XRD_DOOR}//cache/eic/EPIC/{FILE}')
0031 self.assertTrue(entry['pfn'].startswith(
0032 'root://dtn-rucio.jlab.org:1094//cache/eic/EPIC//EVGEN/'))
0033
0034
0035 if __name__ == '__main__':
0036 unittest.main()