forked from TrueCloudLab/frostfs-testcases
Add support data and internal ips
Signed-off-by: Yulia Kovshova <y.kovshova@yadro.com>
This commit is contained in:
parent
6bf672c203
commit
4b59c1f327
8 changed files with 68 additions and 43 deletions
|
@ -11,7 +11,7 @@ hosts:
|
||||||
local_wallet_path: ../neofs-dev-env/services/storage/wallet01.json
|
local_wallet_path: ../neofs-dev-env/services/storage/wallet01.json
|
||||||
wallet_password: ""
|
wallet_password: ""
|
||||||
volume_name: storage_storage_s01
|
volume_name: storage_storage_s01
|
||||||
rpc_endpoint: s01.neofs.devenv:8080
|
endpoint_data0: s01.neofs.devenv:8080
|
||||||
control_endpoint: s01.neofs.devenv:8081
|
control_endpoint: s01.neofs.devenv:8081
|
||||||
un_locode: "RU MOW"
|
un_locode: "RU MOW"
|
||||||
- name: s02
|
- name: s02
|
||||||
|
@ -23,7 +23,7 @@ hosts:
|
||||||
local_wallet_path: ../neofs-dev-env/services/storage/wallet02.json
|
local_wallet_path: ../neofs-dev-env/services/storage/wallet02.json
|
||||||
wallet_password: ""
|
wallet_password: ""
|
||||||
volume_name: storage_storage_s02
|
volume_name: storage_storage_s02
|
||||||
rpc_endpoint: s02.neofs.devenv:8080
|
endpoint_data0: s02.neofs.devenv:8080
|
||||||
control_endpoint: s02.neofs.devenv:8081
|
control_endpoint: s02.neofs.devenv:8081
|
||||||
un_locode: "RU LED"
|
un_locode: "RU LED"
|
||||||
- name: s03
|
- name: s03
|
||||||
|
@ -35,7 +35,7 @@ hosts:
|
||||||
local_wallet_path: ../neofs-dev-env/services/storage/wallet03.json
|
local_wallet_path: ../neofs-dev-env/services/storage/wallet03.json
|
||||||
wallet_password: ""
|
wallet_password: ""
|
||||||
volume_name: storage_storage_s03
|
volume_name: storage_storage_s03
|
||||||
rpc_endpoint: s03.neofs.devenv:8080
|
endpoint_data0: s03.neofs.devenv:8080
|
||||||
control_endpoint: s03.neofs.devenv:8081
|
control_endpoint: s03.neofs.devenv:8081
|
||||||
un_locode: "SE STO"
|
un_locode: "SE STO"
|
||||||
- name: s04
|
- name: s04
|
||||||
|
@ -47,7 +47,7 @@ hosts:
|
||||||
local_wallet_path: ../neofs-dev-env/services/storage/wallet04.json
|
local_wallet_path: ../neofs-dev-env/services/storage/wallet04.json
|
||||||
wallet_password: ""
|
wallet_password: ""
|
||||||
volume_name: storage_storage_s04
|
volume_name: storage_storage_s04
|
||||||
rpc_endpoint: s04.neofs.devenv:8080
|
endpoint_data0: s04.neofs.devenv:8080
|
||||||
control_endpoint: s04.neofs.devenv:8081
|
control_endpoint: s04.neofs.devenv:8081
|
||||||
un_locode: "FI HEL"
|
un_locode: "FI HEL"
|
||||||
- name: s3-gate01
|
- name: s3-gate01
|
||||||
|
@ -58,7 +58,7 @@ hosts:
|
||||||
local_config_path: ./TemporaryDir/password-s3.yml
|
local_config_path: ./TemporaryDir/password-s3.yml
|
||||||
local_wallet_path: ../neofs-dev-env/services/s3_gate/wallet.json
|
local_wallet_path: ../neofs-dev-env/services/s3_gate/wallet.json
|
||||||
wallet_password: "s3"
|
wallet_password: "s3"
|
||||||
endpoint: https://s3.neofs.devenv:8080
|
endpoint_data0: https://s3.neofs.devenv:8080
|
||||||
- name: http-gate01
|
- name: http-gate01
|
||||||
attributes:
|
attributes:
|
||||||
container_name: http_gate
|
container_name: http_gate
|
||||||
|
@ -67,7 +67,7 @@ hosts:
|
||||||
local_config_path: ./TemporaryDir/password-other.yml
|
local_config_path: ./TemporaryDir/password-other.yml
|
||||||
local_wallet_path: ../neofs-dev-env/services/http_gate/wallet.json
|
local_wallet_path: ../neofs-dev-env/services/http_gate/wallet.json
|
||||||
wallet_password: "one"
|
wallet_password: "one"
|
||||||
endpoint: http://http.neofs.devenv
|
endpoint_data0: http://http.neofs.devenv
|
||||||
- name: ir01
|
- name: ir01
|
||||||
attributes:
|
attributes:
|
||||||
container_name: ir01
|
container_name: ir01
|
||||||
|
@ -84,7 +84,7 @@ hosts:
|
||||||
local_config_path: ./TemporaryDir/password-other.yml
|
local_config_path: ./TemporaryDir/password-other.yml
|
||||||
local_wallet_path: ../neofs-dev-env/services/morph_chain/node-wallet.json
|
local_wallet_path: ../neofs-dev-env/services/morph_chain/node-wallet.json
|
||||||
wallet_password: "one"
|
wallet_password: "one"
|
||||||
endpoint: http://morph-chain.neofs.devenv:30333
|
endpoint_internal0: http://morph-chain.neofs.devenv:30333
|
||||||
- name: main-chain01
|
- name: main-chain01
|
||||||
attributes:
|
attributes:
|
||||||
container_name: main_chain
|
container_name: main_chain
|
||||||
|
@ -93,7 +93,7 @@ hosts:
|
||||||
local_config_path: ./TemporaryDir/password-other.yml
|
local_config_path: ./TemporaryDir/password-other.yml
|
||||||
local_wallet_path: ../neofs-dev-env/services/chain/node-wallet.json
|
local_wallet_path: ../neofs-dev-env/services/chain/node-wallet.json
|
||||||
wallet_password: "one"
|
wallet_password: "one"
|
||||||
endpoint: http://main-chain.neofs.devenv:30333
|
endpoint_internal0: http://main-chain.neofs.devenv:30333
|
||||||
- name: coredns01
|
- name: coredns01
|
||||||
attributes:
|
attributes:
|
||||||
container_name: coredns
|
container_name: coredns
|
||||||
|
|
|
@ -122,7 +122,7 @@ class S3Gate(NodeBase):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def get_endpoint(self) -> str:
|
def get_endpoint(self) -> str:
|
||||||
return self._get_attribute(_ConfigAttributes.ENDPOINT)
|
return self._get_attribute(_ConfigAttributes.ENDPOINT_DATA)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def label(self) -> str:
|
def label(self) -> str:
|
||||||
|
@ -135,7 +135,7 @@ class HTTPGate(NodeBase):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def get_endpoint(self) -> str:
|
def get_endpoint(self) -> str:
|
||||||
return self._get_attribute(_ConfigAttributes.ENDPOINT)
|
return self._get_attribute(_ConfigAttributes.ENDPOINT_DATA)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def label(self) -> str:
|
def label(self) -> str:
|
||||||
|
@ -158,7 +158,7 @@ class MorphChain(NodeBase):
|
||||||
self.rpc_client = RPCClient(self.get_endpoint())
|
self.rpc_client = RPCClient(self.get_endpoint())
|
||||||
|
|
||||||
def get_endpoint(self) -> str:
|
def get_endpoint(self) -> str:
|
||||||
return self._get_attribute(_ConfigAttributes.ENDPOINT)
|
return self._get_attribute(_ConfigAttributes.ENDPOINT_INTERNAL)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def label(self) -> str:
|
def label(self) -> str:
|
||||||
|
@ -181,7 +181,7 @@ class MainChain(NodeBase):
|
||||||
self.rpc_client = RPCClient(self.get_endpoint())
|
self.rpc_client = RPCClient(self.get_endpoint())
|
||||||
|
|
||||||
def get_endpoint(self) -> str:
|
def get_endpoint(self) -> str:
|
||||||
return self._get_attribute(_ConfigAttributes.ENDPOINT)
|
return self._get_attribute(_ConfigAttributes.ENDPOINT_INTERNAL)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def label(self) -> str:
|
def label(self) -> str:
|
||||||
|
@ -199,7 +199,7 @@ class StorageNode(NodeBase):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def get_rpc_endpoint(self) -> str:
|
def get_rpc_endpoint(self) -> str:
|
||||||
return self._get_attribute(_ConfigAttributes.RPC_ENDPOINT)
|
return self._get_attribute(_ConfigAttributes.ENDPOINT_DATA)
|
||||||
|
|
||||||
def get_control_endpoint(self) -> str:
|
def get_control_endpoint(self) -> str:
|
||||||
return self._get_attribute(_ConfigAttributes.CONTROL_ENDPOINT)
|
return self._get_attribute(_ConfigAttributes.CONTROL_ENDPOINT)
|
||||||
|
@ -331,10 +331,17 @@ class Cluster:
|
||||||
def get_random_storage_rpc_endpoint(self) -> str:
|
def get_random_storage_rpc_endpoint(self) -> str:
|
||||||
return random.choice(self.get_storage_rpc_endpoints())
|
return random.choice(self.get_storage_rpc_endpoints())
|
||||||
|
|
||||||
|
def get_random_storage_rpc_endpoint_mgmt(self) -> str:
|
||||||
|
return random.choice(self.get_storage_rpc_endpoints_mgmt())
|
||||||
|
|
||||||
def get_storage_rpc_endpoints(self) -> list[str]:
|
def get_storage_rpc_endpoints(self) -> list[str]:
|
||||||
nodes = self.storage_nodes
|
nodes = self.storage_nodes
|
||||||
return [node.get_rpc_endpoint() for node in nodes]
|
return [node.get_rpc_endpoint() for node in nodes]
|
||||||
|
|
||||||
|
def get_storage_rpc_endpoints_mgmt(self) -> list[str]:
|
||||||
|
nodes = self.storage_nodes
|
||||||
|
return [node.get_rpc_endpoint_mgmt() for node in nodes]
|
||||||
|
|
||||||
def get_morph_endpoints(self) -> list[str]:
|
def get_morph_endpoints(self) -> list[str]:
|
||||||
nodes = self.morph_chain_nodes
|
nodes = self.morph_chain_nodes
|
||||||
return [node.get_endpoint() for node in nodes]
|
return [node.get_endpoint() for node in nodes]
|
||||||
|
@ -356,7 +363,7 @@ class _ConfigAttributes:
|
||||||
CONFIG_PATH = "config_path"
|
CONFIG_PATH = "config_path"
|
||||||
LOCAL_WALLET_PATH = "local_wallet_path"
|
LOCAL_WALLET_PATH = "local_wallet_path"
|
||||||
LOCAL_WALLET_CONFIG = "local_config_path"
|
LOCAL_WALLET_CONFIG = "local_config_path"
|
||||||
RPC_ENDPOINT = "rpc_endpoint"
|
ENDPOINT_DATA = "endpoint_data0"
|
||||||
ENDPOINT = "endpoint"
|
ENDPOINT_INTERNAL = "endpoint_internal0"
|
||||||
CONTROL_ENDPOINT = "control_endpoint"
|
CONTROL_ENDPOINT = "control_endpoint"
|
||||||
UN_LOCODE = "un_locode"
|
UN_LOCODE = "un_locode"
|
||||||
|
|
|
@ -81,7 +81,7 @@ class TestContainer(ClusterTestBase):
|
||||||
delete_container(
|
delete_container(
|
||||||
wallet, cid, shell=self.shell, endpoint=self.cluster.default_rpc_endpoint
|
wallet, cid, shell=self.shell, endpoint=self.cluster.default_rpc_endpoint
|
||||||
)
|
)
|
||||||
tick_epoch(self.shell, self.cluster)
|
self.tick_epoch()
|
||||||
wait_for_container_deletion(
|
wait_for_container_deletion(
|
||||||
wallet, cid, shell=self.shell, endpoint=self.cluster.default_rpc_endpoint
|
wallet, cid, shell=self.shell, endpoint=self.cluster.default_rpc_endpoint
|
||||||
)
|
)
|
||||||
|
@ -121,7 +121,7 @@ class TestContainer(ClusterTestBase):
|
||||||
delete_container(
|
delete_container(
|
||||||
wallet, cid, shell=self.shell, endpoint=self.cluster.default_rpc_endpoint
|
wallet, cid, shell=self.shell, endpoint=self.cluster.default_rpc_endpoint
|
||||||
)
|
)
|
||||||
tick_epoch(self.shell, self.cluster)
|
self.tick_epoch()
|
||||||
wait_for_container_deletion(
|
wait_for_container_deletion(
|
||||||
wallet, cid, shell=self.shell, endpoint=self.cluster.default_rpc_endpoint
|
wallet, cid, shell=self.shell, endpoint=self.cluster.default_rpc_endpoint
|
||||||
)
|
)
|
||||||
|
|
|
@ -49,7 +49,7 @@ class TestObjectApiLifetime(ClusterTestBase):
|
||||||
|
|
||||||
with allure.step("Tick two epochs"):
|
with allure.step("Tick two epochs"):
|
||||||
for _ in range(2):
|
for _ in range(2):
|
||||||
tick_epoch(self.shell, self.cluster)
|
self.tick_epoch()
|
||||||
|
|
||||||
# Wait for GC, because object with expiration is counted as alive until GC removes it
|
# Wait for GC, because object with expiration is counted as alive until GC removes it
|
||||||
wait_for_gc_pass_on_storage_nodes()
|
wait_for_gc_pass_on_storage_nodes()
|
||||||
|
|
|
@ -231,7 +231,7 @@ class TestHttpGate(ClusterTestBase):
|
||||||
get_via_http_gate(cid=cid, oid=oid, endpoint=http_endpoint)
|
get_via_http_gate(cid=cid, oid=oid, endpoint=http_endpoint)
|
||||||
|
|
||||||
for expired_objects, not_expired_objects in [(oids[:1], oids[1:]), (oids[:2], oids[2:])]:
|
for expired_objects, not_expired_objects in [(oids[:1], oids[1:]), (oids[:2], oids[2:])]:
|
||||||
tick_epoch(self.shell, self.cluster)
|
self.tick_epoch()
|
||||||
|
|
||||||
# Wait for GC, because object with expiration is counted as alive until GC removes it
|
# Wait for GC, because object with expiration is counted as alive until GC removes it
|
||||||
wait_for_gc_pass_on_storage_nodes()
|
wait_for_gc_pass_on_storage_nodes()
|
||||||
|
|
|
@ -204,7 +204,7 @@ class Test_http_headers(ClusterTestBase):
|
||||||
shell=self.shell,
|
shell=self.shell,
|
||||||
endpoint=self.cluster.default_rpc_endpoint,
|
endpoint=self.cluster.default_rpc_endpoint,
|
||||||
)
|
)
|
||||||
tick_epoch(self.shell, self.cluster)
|
self.tick_epoch()
|
||||||
wait_for_container_deletion(
|
wait_for_container_deletion(
|
||||||
self.wallet,
|
self.wallet,
|
||||||
storage_object_1.cid,
|
storage_object_1.cid,
|
||||||
|
|
|
@ -99,7 +99,7 @@ class TestS3Gate(TestS3GateBase):
|
||||||
|
|
||||||
with allure.step(f"Delete bucket {bucket_1}"):
|
with allure.step(f"Delete bucket {bucket_1}"):
|
||||||
s3_gate_bucket.delete_bucket_s3(self.s3_client, bucket_1)
|
s3_gate_bucket.delete_bucket_s3(self.s3_client, bucket_1)
|
||||||
tick_epoch(self.shell, self.cluster)
|
self.tick_epoch()
|
||||||
|
|
||||||
with allure.step(f"Check bucket {bucket_1} deleted"):
|
with allure.step(f"Check bucket {bucket_1} deleted"):
|
||||||
with pytest.raises(Exception, match=r".*Not Found.*"):
|
with pytest.raises(Exception, match=r".*Not Found.*"):
|
||||||
|
|
|
@ -1,11 +1,17 @@
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
import allure
|
import allure
|
||||||
from cluster import Cluster
|
from cluster import Cluster, StorageNode
|
||||||
from common import MAINNET_BLOCK_TIME, NEOFS_ADM_CONFIG_PATH, NEOFS_ADM_EXEC, NEOGO_EXECUTABLE
|
from common import (
|
||||||
from neofs_testlib.cli import NeofsAdm, NeoGo
|
MAINNET_BLOCK_TIME,
|
||||||
|
NEOFS_ADM_CONFIG_PATH,
|
||||||
|
NEOFS_ADM_EXEC,
|
||||||
|
NEOFS_CLI_EXEC,
|
||||||
|
NEOGO_EXECUTABLE,
|
||||||
|
)
|
||||||
|
from neofs_testlib.cli import NeofsAdm, NeofsCli, NeoGo
|
||||||
from neofs_testlib.shell import Shell
|
from neofs_testlib.shell import Shell
|
||||||
from neofs_testlib.utils.wallet import get_last_address_from_wallet
|
from neofs_testlib.utils.wallet import get_last_address_from_wallet
|
||||||
from payment_neogo import get_contract_hash
|
from payment_neogo import get_contract_hash
|
||||||
|
@ -15,45 +21,57 @@ logger = logging.getLogger("NeoLogger")
|
||||||
|
|
||||||
|
|
||||||
@allure.step("Ensure fresh epoch")
|
@allure.step("Ensure fresh epoch")
|
||||||
def ensure_fresh_epoch(shell: Shell, cluster: Cluster) -> int:
|
def ensure_fresh_epoch(
|
||||||
|
shell: Shell, cluster: Cluster, alive_node: Optional[StorageNode] = None
|
||||||
|
) -> int:
|
||||||
# ensure new fresh epoch to avoid epoch switch during test session
|
# ensure new fresh epoch to avoid epoch switch during test session
|
||||||
current_epoch = get_epoch(shell, cluster)
|
alive_node = alive_node if alive_node else cluster.storage_nodes[0]
|
||||||
tick_epoch(shell, cluster)
|
current_epoch = get_epoch(shell, cluster, alive_node)
|
||||||
epoch = get_epoch(shell, cluster)
|
tick_epoch(shell, cluster, alive_node)
|
||||||
|
epoch = get_epoch(shell, cluster, alive_node)
|
||||||
assert epoch > current_epoch, "Epoch wasn't ticked"
|
assert epoch > current_epoch, "Epoch wasn't ticked"
|
||||||
return epoch
|
return epoch
|
||||||
|
|
||||||
|
|
||||||
@allure.step("Get Epoch")
|
@allure.step("Get Epoch")
|
||||||
def get_epoch(shell: Shell, cluster: Cluster):
|
def get_epoch(shell: Shell, cluster: Cluster, alive_node: Optional[StorageNode] = None):
|
||||||
morph_chain = cluster.morph_chain_nodes[0]
|
alive_node = alive_node if alive_node else cluster.storage_nodes[0]
|
||||||
morph_endpoint = morph_chain.get_endpoint()
|
wallet_path = alive_node.get_wallet_path()
|
||||||
|
wallet_config = alive_node.get_wallet_config_path()
|
||||||
|
|
||||||
neogo = NeoGo(shell=shell, neo_go_exec_path=NEOGO_EXECUTABLE)
|
cli = NeofsCli(shell=shell, neofs_cli_exec_path=NEOFS_CLI_EXEC, config_file=wallet_config)
|
||||||
out = neogo.contract.testinvokefunction(
|
|
||||||
scripthash=get_contract_hash(morph_chain, "netmap.neofs", shell=shell),
|
epoch = cli.netmap.epoch(cluster.default_rpc_endpoint, wallet_path)
|
||||||
method="epoch",
|
return int(epoch.stdout)
|
||||||
rpc_endpoint=morph_endpoint,
|
|
||||||
)
|
|
||||||
return int(json.loads(out.stdout.replace("\n", ""))["stack"][0]["value"])
|
|
||||||
|
|
||||||
|
|
||||||
@allure.step("Tick Epoch")
|
@allure.step("Tick Epoch")
|
||||||
def tick_epoch(shell: Shell, cluster: Cluster):
|
def tick_epoch(shell: Shell, cluster: Cluster, alive_node: Optional[StorageNode] = None):
|
||||||
|
"""
|
||||||
|
Tick epoch using neofs-adm or NeoGo if neofs-adm is not available (DevEnv)
|
||||||
|
Args:
|
||||||
|
shell: local shell to make queries about current epoch. Remote shell will be used to tick new one
|
||||||
|
cluster: cluster instance under test
|
||||||
|
alive_node: node to send requests to (first node in cluster by default)
|
||||||
|
"""
|
||||||
|
|
||||||
|
alive_node = alive_node if alive_node else cluster.storage_nodes[0]
|
||||||
|
remote_shell = alive_node.host.get_shell()
|
||||||
|
|
||||||
if NEOFS_ADM_EXEC and NEOFS_ADM_CONFIG_PATH:
|
if NEOFS_ADM_EXEC and NEOFS_ADM_CONFIG_PATH:
|
||||||
# If neofs-adm is available, then we tick epoch with it (to be consistent with UAT tests)
|
# If neofs-adm is available, then we tick epoch with it (to be consistent with UAT tests)
|
||||||
neofsadm = NeofsAdm(
|
neofsadm = NeofsAdm(
|
||||||
shell=shell, neofs_adm_exec_path=NEOFS_ADM_EXEC, config_file=NEOFS_ADM_CONFIG_PATH
|
shell=remote_shell,
|
||||||
|
neofs_adm_exec_path=NEOFS_ADM_EXEC,
|
||||||
|
config_file=NEOFS_ADM_CONFIG_PATH,
|
||||||
)
|
)
|
||||||
neofsadm.morph.force_new_epoch()
|
neofsadm.morph.force_new_epoch()
|
||||||
return
|
return
|
||||||
|
|
||||||
# Use first node by default
|
|
||||||
|
|
||||||
# Otherwise we tick epoch using transaction
|
# Otherwise we tick epoch using transaction
|
||||||
cur_epoch = get_epoch(shell, cluster)
|
cur_epoch = get_epoch(shell, cluster)
|
||||||
|
|
||||||
|
# Use first node by default
|
||||||
ir_node = cluster.ir_nodes[0]
|
ir_node = cluster.ir_nodes[0]
|
||||||
# In case if no local_wallet_path is provided, we use wallet_path
|
# In case if no local_wallet_path is provided, we use wallet_path
|
||||||
ir_wallet_path = ir_node.get_wallet_path()
|
ir_wallet_path = ir_node.get_wallet_path()
|
||||||
|
|
Loading…
Reference in a new issue