mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-07-06 16:47:29 +00:00

* feat: implemented load test logic * style: ran python linting * fix: added locust dependency in test * fix: skip locust in 3.8 as not supported * fix: update gcsfs version * fix: revert gcsfs versionning * fix: fix gcsf version to 2023.10 * fix: dagster graphql and gx versions * fix: dagster version to 1.8 for py8 compatibility * fix: fix clickhouse to 0.2 as 0.3 requires SQA 2+ * fix: revert changes from main * fix: revert changes compared to main
51 lines
1.4 KiB
Python
51 lines
1.4 KiB
Python
"""Test class to run all resources load test"""
|
|
|
|
import importlib.util
|
|
import inspect
|
|
import logging
|
|
from pathlib import Path
|
|
from typing import List
|
|
|
|
from locust import HttpUser, TaskSet, constant
|
|
|
|
TASKS_DIR = "tasks"
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
def get_all_tasks_set() -> List:
|
|
resource_classes = []
|
|
wd = Path(__file__).parent.joinpath(TASKS_DIR)
|
|
for file_path in wd.glob("*.py"):
|
|
if not str(file_path).startswith("base_"):
|
|
module_path = str(file_path)
|
|
module_name = file_path.stem
|
|
spec = importlib.util.spec_from_file_location(module_name, module_path)
|
|
if not spec:
|
|
logger.error(f"Could not load module {module_name}")
|
|
continue
|
|
module = importlib.util.module_from_spec(spec)
|
|
spec.loader.exec_module(module) # type: ignore
|
|
|
|
for _, obj in inspect.getmembers(module, inspect.isclass):
|
|
if obj.__module__ == module_name:
|
|
resource_classes.append(obj)
|
|
|
|
return resource_classes
|
|
|
|
|
|
class AllResources(TaskSet):
|
|
"""Execute tasks for all resources"""
|
|
|
|
@classmethod
|
|
def set_tasks(cls):
|
|
tasks = get_all_tasks_set()
|
|
cls.tasks = set(tasks)
|
|
|
|
|
|
class All(HttpUser):
|
|
host = "http://localhost:8585"
|
|
wait_time = constant(1) # closed workload
|
|
AllResources.set_tasks()
|
|
tasks = [AllResources]
|