File tree Expand file tree Collapse file tree 3 files changed +15
-5
lines changed
cardano_node_tests/cluster_management Expand file tree Collapse file tree 3 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -440,14 +440,14 @@ def _update_marked_tests(
440440
441441 def _resolve_resources_availability (self , cget_status : _ClusterGetStatus ) -> bool :
442442 """Resolve availability of required "use" and "lock" resources."""
443- resources_locked = common ._get_resources_from_paths (
443+ resources_locked = common .get_resources_from_path (
444444 paths = cget_status .instance_dir .glob (f"{ common .RESOURCE_LOCKED_GLOB } _*" )
445445 )
446446
447447 # This test wants to lock some resources, check if these are not in use
448448 res_lockable = []
449449 if cget_status .lock_resources :
450- resources_used = common ._get_resources_from_paths (
450+ resources_used = common .get_resources_from_path (
451451 paths = cget_status .instance_dir .glob (f"{ common .RESOURCE_IN_USE_GLOB } _*" )
452452 )
453453 unlockable_resources = {* resources_locked , * resources_used }
Original file line number Diff line number Diff line change 2424
2525ADDRS_DATA_DIRNAME = "addrs_data"
2626
27+ RE_RESNAME = re .compile ("_@@(.+)@@_" )
2728
28- def _get_resources_from_paths (paths : tp .Iterator [pl .Path ]) -> tp .List [str ]:
29+
30+ def _get_res (path : pl .Path ) -> str :
31+ out = RE_RESNAME .search (str (path ))
32+ if out is None :
33+ err = f"Resource name not found in path: { path } "
34+ raise ValueError (err )
35+ return out .group (1 )
36+
37+
38+ def get_resources_from_path (paths : tp .Iterator [pl .Path ]) -> tp .List [str ]:
2939 """Get resources names from status files path."""
30- resources = [re . search ( "_@@(.+)@@_" , str ( r )). group ( 1 ) for r in paths ] # type: ignore
40+ resources = [_get_res ( p ) for p in paths ]
3141 return resources
Original file line number Diff line number Diff line change @@ -296,7 +296,7 @@ def _get_resources_by_glob(
296296 msg = "`from_set` cannot be a string"
297297 raise AssertionError (msg )
298298
299- resources_locked = set (common ._get_resources_from_paths (paths = self .instance_dir .glob (glob )))
299+ resources_locked = set (common .get_resources_from_path (paths = self .instance_dir .glob (glob )))
300300
301301 if from_set is not None :
302302 return list (resources_locked .intersection (from_set ))
You can’t perform that action at this time.
0 commit comments