2022-10-18 22:01:42 +00:00
|
|
|
import allure
|
|
|
|
import pytest
|
2022-12-06 19:57:29 +00:00
|
|
|
from cluster_test_base import ClusterTestBase
|
2022-10-28 00:09:24 +00:00
|
|
|
from common import (
|
2022-11-07 07:10:11 +00:00
|
|
|
HTTP_GATE_SERVICE_NAME_REGEX,
|
2022-11-13 22:17:50 +00:00
|
|
|
S3_GATE_SERVICE_NAME_REGEX,
|
2022-10-28 00:09:24 +00:00
|
|
|
STORAGE_NODE_SERVICE_NAME_REGEX,
|
|
|
|
)
|
2022-10-20 21:13:33 +00:00
|
|
|
from k6 import LoadParams
|
|
|
|
from load import (
|
2022-10-18 22:01:42 +00:00
|
|
|
clear_cache_and_data,
|
2022-10-28 00:09:24 +00:00
|
|
|
get_services_endpoints,
|
2022-11-13 22:17:50 +00:00
|
|
|
init_s3_client,
|
2022-10-18 22:01:42 +00:00
|
|
|
multi_node_k6_run,
|
|
|
|
prepare_k6_instances,
|
2022-12-06 19:57:29 +00:00
|
|
|
start_stopped_nodes,
|
|
|
|
stop_unused_nodes,
|
|
|
|
)
|
|
|
|
from load_params import (
|
2022-12-12 15:46:29 +00:00
|
|
|
CONTAINER_PLACEMENT_POLICY,
|
2022-12-06 19:57:29 +00:00
|
|
|
CONTAINERS_COUNT,
|
|
|
|
DELETERS,
|
|
|
|
LOAD_NODE_SSH_PRIVATE_KEY_PATH,
|
|
|
|
LOAD_NODE_SSH_USER,
|
|
|
|
LOAD_NODES,
|
|
|
|
LOAD_NODES_COUNT,
|
|
|
|
LOAD_TIME,
|
|
|
|
LOAD_TYPE,
|
|
|
|
OBJ_COUNT,
|
|
|
|
OBJ_SIZE,
|
|
|
|
OUT_FILE,
|
|
|
|
READERS,
|
|
|
|
STORAGE_NODE_COUNT,
|
|
|
|
WRITERS,
|
2022-10-18 22:01:42 +00:00
|
|
|
)
|
2022-11-07 07:10:11 +00:00
|
|
|
from neofs_testlib.hosting import Hosting
|
2022-10-18 22:01:42 +00:00
|
|
|
|
2022-12-06 19:57:29 +00:00
|
|
|
ENDPOINTS_ATTRIBUTES = {
|
|
|
|
"http": {"regex": HTTP_GATE_SERVICE_NAME_REGEX, "endpoint_attribute": "endpoint"},
|
|
|
|
"grpc": {"regex": STORAGE_NODE_SERVICE_NAME_REGEX, "endpoint_attribute": "rpc_endpoint"},
|
|
|
|
"s3": {"regex": S3_GATE_SERVICE_NAME_REGEX, "endpoint_attribute": "endpoint"},
|
|
|
|
}
|
2022-10-18 22:01:42 +00:00
|
|
|
|
|
|
|
|
2022-10-20 17:04:20 +00:00
|
|
|
@pytest.mark.load
|
2022-12-06 19:57:29 +00:00
|
|
|
class TestLoad(ClusterTestBase):
|
2022-10-18 22:01:42 +00:00
|
|
|
@pytest.fixture(autouse=True)
|
|
|
|
def clear_cache_and_data(self, hosting: Hosting):
|
|
|
|
clear_cache_and_data(hosting=hosting)
|
2022-12-06 19:57:29 +00:00
|
|
|
yield
|
|
|
|
start_stopped_nodes()
|
|
|
|
|
|
|
|
@pytest.fixture(scope="session", autouse=True)
|
|
|
|
def init_s3_client(self, hosting: Hosting):
|
2022-12-26 15:02:18 +00:00
|
|
|
if "s3" in list(map(lambda x: x.lower(), LOAD_TYPE)):
|
2022-12-06 19:57:29 +00:00
|
|
|
init_s3_client(
|
|
|
|
load_nodes=LOAD_NODES,
|
|
|
|
login=LOAD_NODE_SSH_USER,
|
|
|
|
pkey=LOAD_NODE_SSH_PRIVATE_KEY_PATH,
|
|
|
|
hosting=hosting,
|
2022-12-12 15:46:29 +00:00
|
|
|
container_placement_policy=CONTAINER_PLACEMENT_POLICY,
|
2022-12-06 19:57:29 +00:00
|
|
|
)
|
2022-10-18 22:01:42 +00:00
|
|
|
|
2022-12-06 19:57:29 +00:00
|
|
|
@pytest.mark.parametrize("obj_size, out_file", list(zip(OBJ_SIZE, OUT_FILE)))
|
|
|
|
@pytest.mark.parametrize("writers, readers, deleters", list(zip(WRITERS, READERS, DELETERS)))
|
|
|
|
@pytest.mark.parametrize("load_time", LOAD_TIME)
|
|
|
|
@pytest.mark.parametrize("node_count", STORAGE_NODE_COUNT)
|
|
|
|
@pytest.mark.parametrize("containers_count", CONTAINERS_COUNT)
|
|
|
|
@pytest.mark.parametrize("load_type", LOAD_TYPE)
|
|
|
|
@pytest.mark.parametrize("obj_count", OBJ_COUNT)
|
|
|
|
@pytest.mark.parametrize("load_nodes_count", LOAD_NODES_COUNT)
|
2022-10-28 00:09:24 +00:00
|
|
|
@pytest.mark.benchmark
|
|
|
|
@pytest.mark.grpc
|
2022-12-06 19:57:29 +00:00
|
|
|
def test_custom_load(
|
2022-10-18 22:01:42 +00:00
|
|
|
self,
|
|
|
|
obj_size,
|
|
|
|
out_file,
|
|
|
|
writers,
|
|
|
|
readers,
|
|
|
|
deleters,
|
|
|
|
load_time,
|
|
|
|
node_count,
|
2022-12-06 19:57:29 +00:00
|
|
|
obj_count,
|
|
|
|
load_type,
|
|
|
|
load_nodes_count,
|
|
|
|
containers_count,
|
2022-10-18 22:01:42 +00:00
|
|
|
hosting: Hosting,
|
|
|
|
):
|
|
|
|
allure.dynamic.title(
|
2022-12-06 19:57:29 +00:00
|
|
|
f"Load test - node_count = {node_count}, "
|
2022-10-18 22:01:42 +00:00
|
|
|
f"writers = {writers} readers = {readers}, "
|
|
|
|
f"deleters = {deleters}, obj_size = {obj_size}, "
|
|
|
|
f"load_time = {load_time}"
|
|
|
|
)
|
2022-12-06 19:57:29 +00:00
|
|
|
stop_unused_nodes(self.cluster.storage_nodes, node_count)
|
2022-10-18 22:01:42 +00:00
|
|
|
with allure.step("Get endpoints"):
|
2022-10-28 00:09:24 +00:00
|
|
|
endpoints_list = get_services_endpoints(
|
|
|
|
hosting=hosting,
|
2022-12-06 19:57:29 +00:00
|
|
|
service_name_regex=ENDPOINTS_ATTRIBUTES[LOAD_TYPE]["regex"],
|
|
|
|
endpoint_attribute=ENDPOINTS_ATTRIBUTES[LOAD_TYPE]["endpoint_attribute"],
|
2022-10-28 00:09:24 +00:00
|
|
|
)
|
2022-10-18 22:01:42 +00:00
|
|
|
endpoints = ",".join(endpoints_list[:node_count])
|
|
|
|
load_params = LoadParams(
|
|
|
|
endpoint=endpoints,
|
|
|
|
obj_size=obj_size,
|
2022-12-06 19:57:29 +00:00
|
|
|
containers_count=containers_count,
|
2022-10-18 22:01:42 +00:00
|
|
|
out_file=out_file,
|
2022-12-06 19:57:29 +00:00
|
|
|
obj_count=obj_count,
|
2022-10-18 22:01:42 +00:00
|
|
|
writers=writers,
|
|
|
|
readers=readers,
|
|
|
|
deleters=deleters,
|
|
|
|
load_time=load_time,
|
2022-12-06 19:57:29 +00:00
|
|
|
load_type=load_type,
|
2022-11-13 22:17:50 +00:00
|
|
|
)
|
2022-12-06 19:57:29 +00:00
|
|
|
load_nodes_list = LOAD_NODES[:load_nodes_count]
|
2022-11-13 22:17:50 +00:00
|
|
|
k6_load_instances = prepare_k6_instances(
|
2022-12-06 19:57:29 +00:00
|
|
|
load_nodes=load_nodes_list,
|
2022-11-13 22:17:50 +00:00
|
|
|
login=LOAD_NODE_SSH_USER,
|
|
|
|
pkey=LOAD_NODE_SSH_PRIVATE_KEY_PATH,
|
|
|
|
load_params=load_params,
|
|
|
|
)
|
|
|
|
with allure.step("Run load"):
|
|
|
|
multi_node_k6_run(k6_load_instances)
|