bf2343b7e4
Integration Tests - MySQL + Elasticsearch / Detect Changes (push) Has been cancelled
Integration Tests - MySQL + Elasticsearch / integration-tests-mysql-elasticsearch (push) Has been cancelled
Integration Tests - PostgreSQL + Elasticsearch + Redis / Detect Changes (push) Has been cancelled
Integration Tests - PostgreSQL + Elasticsearch + Redis / integration-tests-postgres-elasticsearch-redis (push) Has been cancelled
Integration Tests - PostgreSQL + OpenSearch / Detect Changes (push) Has been cancelled
Integration Tests - PostgreSQL + OpenSearch / integration-tests-postgres-opensearch (push) Has been cancelled
Java Checkstyle / java-checkstyle (push) Has been cancelled
Maven Collate Tests / maven-collate-ci (push) Has been cancelled
OpenMetadata Service Unit Tests / openmetadata-service-unit-tests-status (push) Has been cancelled
Publish Package to Maven Central Repository / publish-maven-packages (push) Has been cancelled
OpenMetadata Service Unit Tests / Detect Changes (push) Has been cancelled
OpenMetadata Service Unit Tests / openmetadata-service-unit-tests (push) Has been cancelled
OpenMetadata Service Unit Tests / k8s_operator-unit-tests (push) Has been cancelled
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 # noqa: UP035
|
|
|
|
from locust import HttpUser, TaskSet, constant
|
|
|
|
TASKS_DIR = "tasks"
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
def get_all_tasks_set() -> List: # noqa: UP006
|
|
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] # noqa: RUF012
|