From efc5f271bfd4219c2f17ebf2b717793d59b3620f Mon Sep 17 00:00:00 2001
From: "a.lipay" <a.lipay@yadro.com>
Date: Mon, 12 Dec 2022 18:46:29 +0300
Subject: [PATCH] Add load_param file, delete old tests, new universal,
 parametrized test, add stop unused nodes function.

Signed-off-by: a.lipay <a.lipay@yadro.com>
---
 pytest_tests/resources/load_params.py     | 3 +++
 pytest_tests/steps/load.py                | 6 ++++--
 pytest_tests/testsuites/load/test_load.py | 2 ++
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/pytest_tests/resources/load_params.py b/pytest_tests/resources/load_params.py
index 5a23742d..85b54723 100644
--- a/pytest_tests/resources/load_params.py
+++ b/pytest_tests/resources/load_params.py
@@ -22,3 +22,6 @@ LOAD_TIME = os.getenv("LOAD_TIME", "200").split(",")
 LOAD_TYPE = os.getenv("LOAD_TYPE", "grpc").split(",")
 LOAD_NODES_COUNT = os.getenv("LOAD_NODES_COUNT", "1").split(",")
 STORAGE_NODE_COUNT = os.getenv("STORAGE_NODE_COUNT", "4").split(",")
+CONTAINER_PLACEMENT_POLICY = os.getenv(
+    "STORAGE_NODE_COUNT", "REP 1 IN X CBF 1 SELECT 1  FROM * AS X"
+)
diff --git a/pytest_tests/steps/load.py b/pytest_tests/steps/load.py
index cd9ce318..a4e656e6 100644
--- a/pytest_tests/steps/load.py
+++ b/pytest_tests/steps/load.py
@@ -39,7 +39,9 @@ def start_stopped_nodes():
 
 
 @allure.title("Init s3 client")
-def init_s3_client(load_nodes: list, login: str, pkey: str, hosting: Hosting):
+def init_s3_client(
+    load_nodes: list, login: str, pkey: str, container_placement_policy: str, hosting: Hosting
+):
     service_configs = hosting.find_service_configs(STORAGE_NODE_SERVICE_NAME_REGEX)
     host = hosting.get_host_by_service(service_configs[0].name)
     wallet_path = service_configs[0].attributes["wallet_path"]
@@ -60,7 +62,7 @@ def init_s3_client(load_nodes: list, login: str, pkey: str, hosting: Hosting):
             peer=node_endpoint,
             bearer_rules=f"{path}/scenarios/files/rules.json",
             gate_public_key=public_key,
-            container_placement_policy="REP 1 IN X CBF 1 SELECT 1  FROM * AS X",
+            container_placement_policy=container_placement_policy,
             container_policy=f"{path}/scenarios/files/policy.json",
             wallet_password="",
         ).stdout
diff --git a/pytest_tests/testsuites/load/test_load.py b/pytest_tests/testsuites/load/test_load.py
index 6e749949..08cbd320 100644
--- a/pytest_tests/testsuites/load/test_load.py
+++ b/pytest_tests/testsuites/load/test_load.py
@@ -17,6 +17,7 @@ from load import (
     stop_unused_nodes,
 )
 from load_params import (
+    CONTAINER_PLACEMENT_POLICY,
     CONTAINERS_COUNT,
     DELETERS,
     LOAD_NODE_SSH_PRIVATE_KEY_PATH,
@@ -57,6 +58,7 @@ class TestLoad(ClusterTestBase):
                 login=LOAD_NODE_SSH_USER,
                 pkey=LOAD_NODE_SSH_PRIVATE_KEY_PATH,
                 hosting=hosting,
+                container_placement_policy=CONTAINER_PLACEMENT_POLICY,
             )
 
     @pytest.mark.parametrize("obj_size, out_file", list(zip(OBJ_SIZE, OUT_FILE)))