test(performance): Added resources performance tests

This commit is contained in:
sumit_chaturvedi
2025-06-03 10:21:06 +05:30
parent 5c1a47d108
commit 4156033183
2 changed files with 54 additions and 0 deletions
+21
View File
@@ -166,3 +166,24 @@ def get_sort_value(sort_values: list) -> str:
str: A formatted sort query string (e.g., "sort=created_at,-severity").
"""
return f"sort={','.join(sort_values)}"
def get_random_resource_id(resource_list):
"""
Selects and returns a random resource ID from the provided list.
Args:
resource_list (list): A list of resource IDs.
Returns:
Any: A randomly selected resource ID from the list.
Raises:
ValueError: If the provided list is empty.
Example:
resource_id = get_random_resource_id(GLOBAL["resource_ids"])
"""
if not resource_list:
raise ValueError("The resource list is empty.")
return random.choice(resource_list)