forked from TrueCloudLab/frostfs-testcases
[#358] Do not rely on node id during price configuration
Signed-off-by: a.berezin <a.berezin@yadro.com>
This commit is contained in:
parent
67a42cae81
commit
44bb446847
1 changed files with 22 additions and 9 deletions
|
@ -9,12 +9,12 @@ from frostfs_testlib.steps.cli.container import delete_container
|
|||
from frostfs_testlib.steps.cli.object import delete_object, put_object_to_random_node
|
||||
from frostfs_testlib.steps.node_management import get_netmap_snapshot
|
||||
from frostfs_testlib.steps.storage_policy import get_nodes_with_object
|
||||
from frostfs_testlib.storage.cluster import Cluster
|
||||
from frostfs_testlib.storage.cluster import Cluster, ClusterNode
|
||||
from frostfs_testlib.storage.controllers.cluster_state_controller import ClusterStateController
|
||||
from frostfs_testlib.storage.controllers.state_managers.config_state_manager import ConfigStateManager
|
||||
from frostfs_testlib.storage.dataclasses.frostfs_services import StorageNode
|
||||
from frostfs_testlib.storage.dataclasses.object_size import ObjectSize
|
||||
from frostfs_testlib.storage.dataclasses.storage_object_info import Interfaces
|
||||
from frostfs_testlib.storage.dataclasses.storage_object_info import Interfaces, NodeNetmapInfo
|
||||
from frostfs_testlib.storage.dataclasses.wallet import WalletInfo
|
||||
from frostfs_testlib.testing import parallel
|
||||
from frostfs_testlib.testing.cluster_test_base import ClusterTestBase
|
||||
|
@ -41,17 +41,30 @@ class TestPolicyWithPrice(ClusterTestBase):
|
|||
return False
|
||||
return True
|
||||
|
||||
@reporter.step("Set Pirce field on {cluster_node}")
|
||||
def set_price_on_node(
|
||||
self, cluster_node: ClusterNode, locode_price_map: dict[str, str], netmap: list[NodeNetmapInfo], config_manager: ConfigStateManager
|
||||
):
|
||||
node_address = cluster_node.get_interface(Interfaces.MGMT)
|
||||
node_netmap = [netmap_entry for netmap_entry in netmap if netmap_entry.node == node_address]
|
||||
|
||||
assert node_netmap, f"No node found with address {node_address}: \n{netmap}"
|
||||
|
||||
price = locode_price_map[node_netmap[0].un_locode]
|
||||
config_manager.set_on_node(cluster_node, StorageNode, {"node:attribute_5": f"Price:{price}"})
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def fill_field_price(self, cluster: Cluster, cluster_state_controller_session: ClusterStateController):
|
||||
prices = ["15", "10", "65", "55"]
|
||||
locode_price_map = {
|
||||
"RU MOW": "15",
|
||||
"RU LED": "10",
|
||||
"SE STO": "65",
|
||||
"FI HEL": "55",
|
||||
}
|
||||
|
||||
netmap = parse_netmap_output(get_netmap_snapshot(node=self.cluster.storage_nodes[0], shell=self.shell))
|
||||
config_manager = cluster_state_controller_session.manager(ConfigStateManager)
|
||||
parallel(
|
||||
config_manager.set_on_node,
|
||||
cluster.cluster_nodes,
|
||||
StorageNode,
|
||||
itertools.cycle([{"node:attribute_5": f"Price:{price}"} for price in prices]),
|
||||
)
|
||||
parallel(self.set_price_on_node, cluster.cluster_nodes, locode_price_map, netmap, config_manager)
|
||||
cluster_state_controller_session.wait_after_storage_startup()
|
||||
|
||||
self.tick_epoch()
|
||||
|
|
Loading…
Reference in a new issue