From 602de43bffe5e22d6a20ce720b986acbc54bcf67 Mon Sep 17 00:00:00 2001
From: Andrey Berezin <a.berezin@yadro.com>
Date: Tue, 19 Sep 2023 18:14:32 +0300
Subject: [PATCH] Use all nodes for s3 creds

---
 src/frostfs_testlib/load/interfaces.py                     | 1 +
 src/frostfs_testlib/load/runners.py                        | 4 +++-
 .../storage/controllers/background_load_controller.py      | 7 ++++++-
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/frostfs_testlib/load/interfaces.py b/src/frostfs_testlib/load/interfaces.py
index 6f29868..98c9d62 100644
--- a/src/frostfs_testlib/load/interfaces.py
+++ b/src/frostfs_testlib/load/interfaces.py
@@ -22,6 +22,7 @@ class ScenarioRunner(ABC):
     def prepare(
         self,
         load_params: LoadParams,
+        cluster_nodes: list[ClusterNode],
         nodes_under_load: list[ClusterNode],
         k6_dir: str,
     ):
diff --git a/src/frostfs_testlib/load/runners.py b/src/frostfs_testlib/load/runners.py
index 428cd7d..a7fa787 100644
--- a/src/frostfs_testlib/load/runners.py
+++ b/src/frostfs_testlib/load/runners.py
@@ -72,6 +72,7 @@ class DefaultRunner(RunnerBase):
     def prepare(
         self,
         load_params: LoadParams,
+        cluster_nodes: list[ClusterNode],
         nodes_under_load: list[ClusterNode],
         k6_dir: str,
     ):
@@ -81,7 +82,7 @@ class DefaultRunner(RunnerBase):
         with reporter.step("Init s3 client on loaders"):
             storage_node = nodes_under_load[0].service(StorageNode)
             s3_public_keys = [
-                node.service(S3Gate).get_wallet_public_key() for node in nodes_under_load
+                node.service(S3Gate).get_wallet_public_key() for node in cluster_nodes
             ]
             grpc_peer = storage_node.get_rpc_endpoint()
 
@@ -290,6 +291,7 @@ class LocalRunner(RunnerBase):
     def prepare(
         self,
         load_params: LoadParams,
+        cluster_nodes: list[ClusterNode],
         nodes_under_load: list[ClusterNode],
         k6_dir: str,
     ):
diff --git a/src/frostfs_testlib/storage/controllers/background_load_controller.py b/src/frostfs_testlib/storage/controllers/background_load_controller.py
index aa17f4e..c309b65 100644
--- a/src/frostfs_testlib/storage/controllers/background_load_controller.py
+++ b/src/frostfs_testlib/storage/controllers/background_load_controller.py
@@ -26,6 +26,7 @@ class BackgroundLoadController:
     load_params: LoadParams
     original_load_params: LoadParams
     verification_params: LoadParams
+    cluster_nodes: list[ClusterNode]
     nodes_under_load: list[ClusterNode]
     load_counter: int
     loaders_wallet: WalletInfo
@@ -39,12 +40,14 @@ class BackgroundLoadController:
         k6_dir: str,
         load_params: LoadParams,
         loaders_wallet: WalletInfo,
+        cluster_nodes: list[ClusterNode],
         nodes_under_load: list[ClusterNode],
         runner: ScenarioRunner,
     ) -> None:
         self.k6_dir = k6_dir
         self.original_load_params = load_params
         self.load_params = copy.deepcopy(self.original_load_params)
+        self.cluster_nodes = cluster_nodes
         self.nodes_under_load = nodes_under_load
         self.load_counter = 1
         self.loaders_wallet = loaders_wallet
@@ -99,7 +102,9 @@ class BackgroundLoadController:
         self.endpoints = self._get_endpoints(
             self.load_params.load_type, self.load_params.endpoint_selection_strategy
         )
-        self.runner.prepare(self.load_params, self.nodes_under_load, self.k6_dir)
+        self.runner.prepare(
+            self.load_params, self.cluster_nodes, self.nodes_under_load, self.k6_dir
+        )
         self.runner.init_k6_instances(self.load_params, self.endpoints, self.k6_dir)
 
     @run_optionally(optionals.OPTIONAL_BACKGROUND_LOAD_ENABLED)
-- 
2.45.2