forked from TrueCloudLab/frostfs-testcases
fix password for node
Signed-off-by: Yulia Kovshova <y.kovshova@yadro.com>
This commit is contained in:
parent
bef01eec48
commit
56fcbe8b77
13 changed files with 99 additions and 71 deletions
|
@ -216,7 +216,7 @@ class TestStorageGroup:
|
||||||
|
|
||||||
@pytest.mark.skip
|
@pytest.mark.skip
|
||||||
@allure.title("Test to check Storage Group lifetime")
|
@allure.title("Test to check Storage Group lifetime")
|
||||||
def test_storagegroup_lifetime(self, client_shell, object_size):
|
def test_storagegroup_lifetime(self, client_shell, object_size, hosting):
|
||||||
cid = create_container(self.main_wallet, shell=client_shell)
|
cid = create_container(self.main_wallet, shell=client_shell)
|
||||||
file_path = generate_file(object_size)
|
file_path = generate_file(object_size)
|
||||||
oid = put_object(self.main_wallet, file_path, cid, shell=client_shell)
|
oid = put_object(self.main_wallet, file_path, cid, shell=client_shell)
|
||||||
|
@ -224,7 +224,7 @@ class TestStorageGroup:
|
||||||
storage_group = put_storagegroup(client_shell, self.main_wallet, cid, objects, lifetime=1)
|
storage_group = put_storagegroup(client_shell, self.main_wallet, cid, objects, lifetime=1)
|
||||||
with allure.step("Tick two epochs"):
|
with allure.step("Tick two epochs"):
|
||||||
for _ in range(2):
|
for _ in range(2):
|
||||||
tick_epoch(shell=client_shell)
|
tick_epoch(shell=client_shell, hosting=hosting)
|
||||||
with pytest.raises(Exception, match=OBJECT_NOT_FOUND):
|
with pytest.raises(Exception, match=OBJECT_NOT_FOUND):
|
||||||
get_storagegroup(
|
get_storagegroup(
|
||||||
shell=client_shell, wallet=self.main_wallet, cid=cid, gid=storage_group
|
shell=client_shell, wallet=self.main_wallet, cid=cid, gid=storage_group
|
||||||
|
|
|
@ -29,6 +29,7 @@ from python_keywords.object_access import (
|
||||||
can_put_object,
|
can_put_object,
|
||||||
can_search_object,
|
can_search_object,
|
||||||
)
|
)
|
||||||
|
from utility import create_wallet_config
|
||||||
from wellknown_acl import PUBLIC_ACL
|
from wellknown_acl import PUBLIC_ACL
|
||||||
|
|
||||||
|
|
||||||
|
@ -230,9 +231,15 @@ class TestEACLContainer:
|
||||||
drop_object(hosting, node_name=[*NEOFS_NETMAP_DICT][0], cid=cid, oid=oid)
|
drop_object(hosting, node_name=[*NEOFS_NETMAP_DICT][0], cid=cid, oid=oid)
|
||||||
|
|
||||||
storage_wallet_path = NEOFS_NETMAP_DICT[[*NEOFS_NETMAP_DICT][0]]["wallet_path"]
|
storage_wallet_path = NEOFS_NETMAP_DICT[[*NEOFS_NETMAP_DICT][0]]["wallet_path"]
|
||||||
|
storage_wallet_conf = create_wallet_config(hosting, [*NEOFS_NETMAP_DICT][0])
|
||||||
with allure.step("Wait for dropped object replicated"):
|
with allure.step("Wait for dropped object replicated"):
|
||||||
wait_object_replication_on_nodes(
|
wait_object_replication_on_nodes(
|
||||||
storage_wallet_path, cid, oid, self.NODE_COUNT, shell=client_shell
|
storage_wallet_path,
|
||||||
|
cid,
|
||||||
|
oid,
|
||||||
|
self.NODE_COUNT,
|
||||||
|
shell=client_shell,
|
||||||
|
wallet_config=storage_wallet_conf,
|
||||||
)
|
)
|
||||||
|
|
||||||
@allure.title("Testcase to validate NeoFS system operations with extended ACL")
|
@allure.title("Testcase to validate NeoFS system operations with extended ACL")
|
||||||
|
|
|
@ -3,6 +3,7 @@ import json
|
||||||
import allure
|
import allure
|
||||||
import pytest
|
import pytest
|
||||||
from epoch import tick_epoch
|
from epoch import tick_epoch
|
||||||
|
from neofs_testlib.hosting import Hosting
|
||||||
from python_keywords.container import (
|
from python_keywords.container import (
|
||||||
create_container,
|
create_container,
|
||||||
delete_container,
|
delete_container,
|
||||||
|
@ -18,7 +19,7 @@ from wellknown_acl import PRIVATE_ACL_F
|
||||||
@pytest.mark.parametrize("name", ["", "test-container"], ids=["No name", "Set particular name"])
|
@pytest.mark.parametrize("name", ["", "test-container"], ids=["No name", "Set particular name"])
|
||||||
@pytest.mark.sanity
|
@pytest.mark.sanity
|
||||||
@pytest.mark.container
|
@pytest.mark.container
|
||||||
def test_container_creation(client_shell, prepare_wallet_and_deposit, name):
|
def test_container_creation(client_shell, prepare_wallet_and_deposit, name, hosting):
|
||||||
scenario_title = f"with name {name}" if name else "without name"
|
scenario_title = f"with name {name}" if name else "without name"
|
||||||
allure.dynamic.title(f"User can create container {scenario_title}")
|
allure.dynamic.title(f"User can create container {scenario_title}")
|
||||||
|
|
||||||
|
@ -58,14 +59,14 @@ def test_container_creation(client_shell, prepare_wallet_and_deposit, name):
|
||||||
|
|
||||||
with allure.step("Delete container and check it was deleted"):
|
with allure.step("Delete container and check it was deleted"):
|
||||||
delete_container(wallet, cid, shell=client_shell)
|
delete_container(wallet, cid, shell=client_shell)
|
||||||
tick_epoch(shell=client_shell)
|
tick_epoch(shell=client_shell, hosting=hosting)
|
||||||
wait_for_container_deletion(wallet, cid, shell=client_shell)
|
wait_for_container_deletion(wallet, cid, shell=client_shell)
|
||||||
|
|
||||||
|
|
||||||
@allure.title("Parallel container creation and deletion")
|
@allure.title("Parallel container creation and deletion")
|
||||||
@pytest.mark.sanity
|
@pytest.mark.sanity
|
||||||
@pytest.mark.container
|
@pytest.mark.container
|
||||||
def test_container_creation_deletion_parallel(client_shell, prepare_wallet_and_deposit):
|
def test_container_creation_deletion_parallel(client_shell, prepare_wallet_and_deposit, hosting):
|
||||||
containers_count = 3
|
containers_count = 3
|
||||||
wallet = prepare_wallet_and_deposit
|
wallet = prepare_wallet_and_deposit
|
||||||
placement_rule = "REP 2 IN X CBF 1 SELECT 2 FROM * AS X"
|
placement_rule = "REP 2 IN X CBF 1 SELECT 2 FROM * AS X"
|
||||||
|
@ -92,5 +93,5 @@ def test_container_creation_deletion_parallel(client_shell, prepare_wallet_and_d
|
||||||
with allure.step("Delete containers and check they were deleted"):
|
with allure.step("Delete containers and check they were deleted"):
|
||||||
for cid in cids:
|
for cid in cids:
|
||||||
delete_container(wallet, cid, shell=client_shell)
|
delete_container(wallet, cid, shell=client_shell)
|
||||||
tick_epoch(shell=client_shell)
|
tick_epoch(shell=client_shell, hosting=hosting)
|
||||||
wait_for_container_deletion(wallet, cid, shell=client_shell)
|
wait_for_container_deletion(wallet, cid, shell=client_shell)
|
||||||
|
|
|
@ -11,7 +11,6 @@ from common import (
|
||||||
NEOFS_CONTRACT_CACHE_TIMEOUT,
|
NEOFS_CONTRACT_CACHE_TIMEOUT,
|
||||||
NEOFS_NETMAP_DICT,
|
NEOFS_NETMAP_DICT,
|
||||||
STORAGE_RPC_ENDPOINT_1,
|
STORAGE_RPC_ENDPOINT_1,
|
||||||
STORAGE_WALLET_PASS,
|
|
||||||
)
|
)
|
||||||
from data_formatters import get_wallet_public_key
|
from data_formatters import get_wallet_public_key
|
||||||
from epoch import tick_epoch
|
from epoch import tick_epoch
|
||||||
|
@ -38,7 +37,12 @@ from python_keywords.node_management import (
|
||||||
stop_nodes,
|
stop_nodes,
|
||||||
)
|
)
|
||||||
from storage_policy import get_nodes_with_object, get_simple_object_copies
|
from storage_policy import get_nodes_with_object, get_simple_object_copies
|
||||||
from utility import parse_time, placement_policy_from_container, wait_for_gc_pass_on_storage_nodes
|
from utility import (
|
||||||
|
get_wallet_password,
|
||||||
|
parse_time,
|
||||||
|
placement_policy_from_container,
|
||||||
|
wait_for_gc_pass_on_storage_nodes,
|
||||||
|
)
|
||||||
from wellknown_acl import PUBLIC_ACL
|
from wellknown_acl import PUBLIC_ACL
|
||||||
|
|
||||||
logger = logging.getLogger("NeoLogger")
|
logger = logging.getLogger("NeoLogger")
|
||||||
|
@ -109,12 +113,12 @@ def return_nodes(shell: Shell, hosting: Hosting, alive_node: Optional[str] = Non
|
||||||
sleep(parse_time(MORPH_BLOCK_TIME))
|
sleep(parse_time(MORPH_BLOCK_TIME))
|
||||||
for __attempt in range(3):
|
for __attempt in range(3):
|
||||||
try:
|
try:
|
||||||
tick_epoch(shell=shell)
|
tick_epoch(shell=shell, hosting=hosting)
|
||||||
break
|
break
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
sleep(3)
|
sleep(3)
|
||||||
|
|
||||||
check_node_in_map(node, shell=shell, alive_node=alive_node)
|
check_node_in_map(node, shell=shell, hosting=hosting, alive_node=alive_node)
|
||||||
|
|
||||||
|
|
||||||
@allure.title("Add one node to cluster")
|
@allure.title("Add one node to cluster")
|
||||||
|
@ -141,7 +145,7 @@ def test_add_nodes(
|
||||||
)
|
)
|
||||||
alive_node = choice([node for node in NEOFS_NETMAP_DICT if node != additional_node])
|
alive_node = choice([node for node in NEOFS_NETMAP_DICT if node != additional_node])
|
||||||
|
|
||||||
check_node_in_map(additional_node, shell=client_shell, alive_node=alive_node)
|
check_node_in_map(additional_node, shell=client_shell, hosting=hosting, alive_node=alive_node)
|
||||||
|
|
||||||
# Add node to recovery list before messing with it
|
# Add node to recovery list before messing with it
|
||||||
check_nodes.append(additional_node)
|
check_nodes.append(additional_node)
|
||||||
|
@ -197,10 +201,11 @@ def test_nodes_management(prepare_tmp_dir, client_shell, hosting: Hosting):
|
||||||
|
|
||||||
# Calculate public key that identifies node in netmap
|
# Calculate public key that identifies node in netmap
|
||||||
random_node_wallet_path = NEOFS_NETMAP_DICT[random_node]["wallet_path"]
|
random_node_wallet_path = NEOFS_NETMAP_DICT[random_node]["wallet_path"]
|
||||||
random_node_netmap_key = get_wallet_public_key(random_node_wallet_path, STORAGE_WALLET_PASS)
|
node_wallet_password = get_wallet_password(hosting=hosting, service_name=random_node)
|
||||||
|
random_node_netmap_key = get_wallet_public_key(random_node_wallet_path, node_wallet_password)
|
||||||
|
|
||||||
with allure.step("Check node {random_node} is in netmap"):
|
with allure.step("Check node {random_node} is in netmap"):
|
||||||
snapshot = get_netmap_snapshot(node_name=alive_node, shell=client_shell)
|
snapshot = get_netmap_snapshot(node_name=alive_node, shell=client_shell, hosting=hosting)
|
||||||
assert random_node_netmap_key in snapshot, f"Expected node {random_node} in netmap"
|
assert random_node_netmap_key in snapshot, f"Expected node {random_node} in netmap"
|
||||||
|
|
||||||
with allure.step("Run health check for all storage nodes"):
|
with allure.step("Run health check for all storage nodes"):
|
||||||
|
@ -212,24 +217,24 @@ def test_nodes_management(prepare_tmp_dir, client_shell, hosting: Hosting):
|
||||||
node_set_status(hosting, random_node, status="offline")
|
node_set_status(hosting, random_node, status="offline")
|
||||||
|
|
||||||
sleep(parse_time(MORPH_BLOCK_TIME))
|
sleep(parse_time(MORPH_BLOCK_TIME))
|
||||||
tick_epoch(shell=client_shell)
|
tick_epoch(shell=client_shell, hosting=hosting)
|
||||||
|
|
||||||
with allure.step(f"Check node {random_node} went to offline"):
|
with allure.step(f"Check node {random_node} went to offline"):
|
||||||
health_check = node_healthcheck(hosting, random_node)
|
health_check = node_healthcheck(hosting, random_node)
|
||||||
assert health_check.health_status == "READY" and health_check.network_status == "OFFLINE"
|
assert health_check.health_status == "READY" and health_check.network_status == "OFFLINE"
|
||||||
snapshot = get_netmap_snapshot(node_name=alive_node, shell=client_shell)
|
snapshot = get_netmap_snapshot(node_name=alive_node, shell=client_shell, hosting=hosting)
|
||||||
assert random_node_netmap_key not in snapshot, f"Expected node {random_node} not in netmap"
|
assert random_node_netmap_key not in snapshot, f"Expected node {random_node} not in netmap"
|
||||||
|
|
||||||
with allure.step(f"Check node {random_node} went to online"):
|
with allure.step(f"Check node {random_node} went to online"):
|
||||||
node_set_status(hosting, random_node, status="online")
|
node_set_status(hosting, random_node, status="online")
|
||||||
|
|
||||||
sleep(parse_time(MORPH_BLOCK_TIME))
|
sleep(parse_time(MORPH_BLOCK_TIME))
|
||||||
tick_epoch(shell=client_shell)
|
tick_epoch(shell=client_shell, hosting=hosting)
|
||||||
|
|
||||||
with allure.step(f"Check node {random_node} went to online"):
|
with allure.step(f"Check node {random_node} went to online"):
|
||||||
health_check = node_healthcheck(hosting, random_node)
|
health_check = node_healthcheck(hosting, random_node)
|
||||||
assert health_check.health_status == "READY" and health_check.network_status == "ONLINE"
|
assert health_check.health_status == "READY" and health_check.network_status == "ONLINE"
|
||||||
snapshot = get_netmap_snapshot(node_name=alive_node, shell=client_shell)
|
snapshot = get_netmap_snapshot(node_name=alive_node, shell=client_shell, hosting=hosting)
|
||||||
assert random_node_netmap_key in snapshot, f"Expected node {random_node} in netmap"
|
assert random_node_netmap_key in snapshot, f"Expected node {random_node} in netmap"
|
||||||
|
|
||||||
|
|
||||||
|
@ -372,7 +377,7 @@ def test_replication(
|
||||||
wait_for_expected_object_copies(client_shell, wallet, cid, oid)
|
wait_for_expected_object_copies(client_shell, wallet, cid, oid)
|
||||||
|
|
||||||
start_nodes(hosting, stopped_nodes)
|
start_nodes(hosting, stopped_nodes)
|
||||||
tick_epoch(shell=client_shell)
|
tick_epoch(shell=client_shell, hosting=hosting)
|
||||||
|
|
||||||
for node_name in node_names:
|
for node_name in node_names:
|
||||||
wait_for_node_go_online(hosting, node_name)
|
wait_for_node_go_online(hosting, node_name)
|
||||||
|
@ -508,13 +513,13 @@ def wait_for_node_to_be_ready(hosting: Hosting, node_name: str) -> None:
|
||||||
|
|
||||||
@allure.step("Wait for {expected_copies} object copies in the wallet")
|
@allure.step("Wait for {expected_copies} object copies in the wallet")
|
||||||
def wait_for_expected_object_copies(
|
def wait_for_expected_object_copies(
|
||||||
shell: Shell, wallet: str, cid: str, oid: str, expected_copies: int = 2
|
shell: Shell, wallet: str, cid: str, oid: str, hosting: Hosting, expected_copies: int = 2
|
||||||
) -> None:
|
) -> None:
|
||||||
for i in range(2):
|
for i in range(2):
|
||||||
copies = get_simple_object_copies(wallet, cid, oid)
|
copies = get_simple_object_copies(wallet, cid, oid)
|
||||||
if copies == expected_copies:
|
if copies == expected_copies:
|
||||||
break
|
break
|
||||||
tick_epoch(shell=shell)
|
tick_epoch(shell=shell, hosting=hosting)
|
||||||
sleep(parse_time(NEOFS_CONTRACT_CACHE_TIMEOUT))
|
sleep(parse_time(NEOFS_CONTRACT_CACHE_TIMEOUT))
|
||||||
else:
|
else:
|
||||||
raise AssertionError(f"There are no {expected_copies} copies during time")
|
raise AssertionError(f"There are no {expected_copies} copies during time")
|
||||||
|
|
|
@ -11,6 +11,7 @@ from container import create_container
|
||||||
from epoch import tick_epoch
|
from epoch import tick_epoch
|
||||||
from file_helper import generate_file, get_file_content, get_file_hash
|
from file_helper import generate_file, get_file_content, get_file_hash
|
||||||
from grpc_responses import OBJECT_ALREADY_REMOVED, OUT_OF_RANGE, error_matches_status
|
from grpc_responses import OBJECT_ALREADY_REMOVED, OUT_OF_RANGE, error_matches_status
|
||||||
|
from neofs_testlib.hosting import Hosting
|
||||||
from neofs_testlib.shell import Shell
|
from neofs_testlib.shell import Shell
|
||||||
from pytest import FixtureRequest
|
from pytest import FixtureRequest
|
||||||
from python_keywords.neofs_verbs import (
|
from python_keywords.neofs_verbs import (
|
||||||
|
@ -94,7 +95,7 @@ def generate_ranges(file_size: int, max_object_size: int) -> list[(int, int)]:
|
||||||
return file_ranges_to_test
|
return file_ranges_to_test
|
||||||
|
|
||||||
|
|
||||||
def delete_objects(storage_objects: list, client_shell: Shell) -> None:
|
def delete_objects(storage_objects: list, client_shell: Shell, hosting: Hosting) -> None:
|
||||||
with allure.step("Delete objects"):
|
with allure.step("Delete objects"):
|
||||||
for storage_object in storage_objects:
|
for storage_object in storage_objects:
|
||||||
storage_object.tombstone = delete_object(
|
storage_object.tombstone = delete_object(
|
||||||
|
@ -108,7 +109,7 @@ def delete_objects(storage_objects: list, client_shell: Shell) -> None:
|
||||||
shell=client_shell,
|
shell=client_shell,
|
||||||
)
|
)
|
||||||
|
|
||||||
tick_epoch(shell=client_shell)
|
tick_epoch(shell=client_shell, hosting=hosting)
|
||||||
sleep(CLEANUP_TIMEOUT)
|
sleep(CLEANUP_TIMEOUT)
|
||||||
|
|
||||||
with allure.step("Get objects and check errors"):
|
with allure.step("Get objects and check errors"):
|
||||||
|
@ -129,7 +130,7 @@ def delete_objects(storage_objects: list, client_shell: Shell) -> None:
|
||||||
scope="session",
|
scope="session",
|
||||||
)
|
)
|
||||||
def storage_objects(
|
def storage_objects(
|
||||||
prepare_wallet_and_deposit: str, client_shell: Shell, request: FixtureRequest
|
prepare_wallet_and_deposit: str, client_shell: Shell, request: FixtureRequest, hosting: Hosting
|
||||||
) -> list[StorageObjectInfo]:
|
) -> list[StorageObjectInfo]:
|
||||||
wallet = prepare_wallet_and_deposit
|
wallet = prepare_wallet_and_deposit
|
||||||
# Separate containers for complex/simple objects to avoid side-effects
|
# Separate containers for complex/simple objects to avoid side-effects
|
||||||
|
@ -163,7 +164,7 @@ def storage_objects(
|
||||||
yield storage_objects
|
yield storage_objects
|
||||||
|
|
||||||
# Teardown after all tests done with current param
|
# Teardown after all tests done with current param
|
||||||
delete_objects(storage_objects, client_shell)
|
delete_objects(storage_objects, client_shell, hosting)
|
||||||
|
|
||||||
|
|
||||||
@allure.title("Validate object storage policy by native API")
|
@allure.title("Validate object storage policy by native API")
|
||||||
|
@ -290,7 +291,11 @@ def test_search_object_api(
|
||||||
"object_size", [SIMPLE_OBJ_SIZE, COMPLEX_OBJ_SIZE], ids=["simple object", "complex object"]
|
"object_size", [SIMPLE_OBJ_SIZE, COMPLEX_OBJ_SIZE], ids=["simple object", "complex object"]
|
||||||
)
|
)
|
||||||
def test_object_search_should_return_tombstone_items(
|
def test_object_search_should_return_tombstone_items(
|
||||||
prepare_wallet_and_deposit: str, client_shell: Shell, request: FixtureRequest, object_size: int
|
prepare_wallet_and_deposit: str,
|
||||||
|
client_shell: Shell,
|
||||||
|
request: FixtureRequest,
|
||||||
|
object_size: int,
|
||||||
|
hosting: Hosting,
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Validate object search with removed items
|
Validate object search with removed items
|
||||||
|
@ -321,7 +326,7 @@ def test_object_search_should_return_tombstone_items(
|
||||||
assert result == [storage_object.oid]
|
assert result == [storage_object.oid]
|
||||||
|
|
||||||
with allure.step("Delete file"):
|
with allure.step("Delete file"):
|
||||||
delete_objects([storage_object], client_shell)
|
delete_objects([storage_object], client_shell, hosting)
|
||||||
|
|
||||||
with allure.step("Search deleted object with --root"):
|
with allure.step("Search deleted object with --root"):
|
||||||
# Root Search object should return nothing
|
# Root Search object should return nothing
|
||||||
|
|
|
@ -7,6 +7,7 @@ from container import create_container
|
||||||
from epoch import get_epoch, tick_epoch
|
from epoch import get_epoch, tick_epoch
|
||||||
from file_helper import generate_file, get_file_hash
|
from file_helper import generate_file, get_file_hash
|
||||||
from grpc_responses import OBJECT_NOT_FOUND
|
from grpc_responses import OBJECT_NOT_FOUND
|
||||||
|
from neofs_testlib.hosting import Hosting
|
||||||
from neofs_testlib.shell import Shell
|
from neofs_testlib.shell import Shell
|
||||||
from pytest import FixtureRequest
|
from pytest import FixtureRequest
|
||||||
from python_keywords.neofs_verbs import get_object, put_object
|
from python_keywords.neofs_verbs import get_object, put_object
|
||||||
|
@ -22,7 +23,11 @@ logger = logging.getLogger("NeoLogger")
|
||||||
"object_size", [SIMPLE_OBJ_SIZE, COMPLEX_OBJ_SIZE], ids=["simple object", "complex object"]
|
"object_size", [SIMPLE_OBJ_SIZE, COMPLEX_OBJ_SIZE], ids=["simple object", "complex object"]
|
||||||
)
|
)
|
||||||
def test_object_api_lifetime(
|
def test_object_api_lifetime(
|
||||||
prepare_wallet_and_deposit: str, client_shell: Shell, request: FixtureRequest, object_size: int
|
prepare_wallet_and_deposit: str,
|
||||||
|
client_shell: Shell,
|
||||||
|
request: FixtureRequest,
|
||||||
|
object_size: int,
|
||||||
|
hosting: Hosting,
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Test object deleted after expiration epoch.
|
Test object deleted after expiration epoch.
|
||||||
|
@ -42,7 +47,7 @@ def test_object_api_lifetime(
|
||||||
|
|
||||||
with allure.step("Tick two epochs"):
|
with allure.step("Tick two epochs"):
|
||||||
for _ in range(2):
|
for _ in range(2):
|
||||||
tick_epoch(shell=client_shell)
|
tick_epoch(shell=client_shell, hosting=hosting)
|
||||||
|
|
||||||
# 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()
|
||||||
|
|
|
@ -66,7 +66,7 @@ class TestS3Gate(TestS3GateBase):
|
||||||
s3_gate_bucket.delete_bucket_s3(self.s3_client, bucket)
|
s3_gate_bucket.delete_bucket_s3(self.s3_client, bucket)
|
||||||
|
|
||||||
@allure.title("Test S3 Bucket API")
|
@allure.title("Test S3 Bucket API")
|
||||||
def test_s3_buckets(self, client_shell):
|
def test_s3_buckets(self, client_shell, hosting):
|
||||||
"""
|
"""
|
||||||
Test base S3 Bucket API (Create/List/Head/Delete).
|
Test base S3 Bucket API (Create/List/Head/Delete).
|
||||||
"""
|
"""
|
||||||
|
@ -110,7 +110,7 @@ class TestS3Gate(TestS3GateBase):
|
||||||
|
|
||||||
with allure.step(f"Delete empty bucket {bucket_2}"):
|
with allure.step(f"Delete empty bucket {bucket_2}"):
|
||||||
s3_gate_bucket.delete_bucket_s3(self.s3_client, bucket_2)
|
s3_gate_bucket.delete_bucket_s3(self.s3_client, bucket_2)
|
||||||
tick_epoch(shell=client_shell)
|
tick_epoch(shell=client_shell, hosting=hosting)
|
||||||
|
|
||||||
with allure.step(f"Check bucket {bucket_2} deleted"):
|
with allure.step(f"Check bucket {bucket_2} deleted"):
|
||||||
with pytest.raises(Exception, match=r".*Not Found.*"):
|
with pytest.raises(Exception, match=r".*Not Found.*"):
|
||||||
|
@ -126,7 +126,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(shell=client_shell)
|
tick_epoch(shell=client_shell, hosting=hosting)
|
||||||
|
|
||||||
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.*"):
|
||||||
|
|
|
@ -9,6 +9,7 @@ from common import COMPLEX_OBJ_SIZE
|
||||||
from container import create_container
|
from container import create_container
|
||||||
from epoch import get_epoch, tick_epoch
|
from epoch import get_epoch, tick_epoch
|
||||||
from file_helper import generate_file, get_file_hash
|
from file_helper import generate_file, get_file_hash
|
||||||
|
from neofs_testlib.hosting import Hosting
|
||||||
from neofs_testlib.shell import Shell
|
from neofs_testlib.shell import Shell
|
||||||
from python_keywords.http_gate import (
|
from python_keywords.http_gate import (
|
||||||
get_via_http_curl,
|
get_via_http_curl,
|
||||||
|
@ -147,7 +148,7 @@ class TestHttpGate:
|
||||||
self.get_object_by_attr_and_verify_hashes(oid, file_path, cid, attributes)
|
self.get_object_by_attr_and_verify_hashes(oid, file_path, cid, attributes)
|
||||||
|
|
||||||
@allure.title("Test Expiration-Epoch in HTTP header")
|
@allure.title("Test Expiration-Epoch in HTTP header")
|
||||||
def test_expiration_epoch_in_http(self, client_shell):
|
def test_expiration_epoch_in_http(self, client_shell, hosting):
|
||||||
cid = create_container(
|
cid = create_container(
|
||||||
self.wallet, shell=client_shell, rule=self.PLACEMENT_RULE, basic_acl=PUBLIC_ACL
|
self.wallet, shell=client_shell, rule=self.PLACEMENT_RULE, basic_acl=PUBLIC_ACL
|
||||||
)
|
)
|
||||||
|
@ -170,7 +171,7 @@ class TestHttpGate:
|
||||||
get_via_http_gate(cid=cid, oid=oid)
|
get_via_http_gate(cid=cid, oid=oid)
|
||||||
|
|
||||||
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(shell=client_shell)
|
tick_epoch(shell=client_shell, hosting=hosting)
|
||||||
|
|
||||||
# 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()
|
||||||
|
|
|
@ -4,7 +4,6 @@ from time import sleep
|
||||||
|
|
||||||
import allure
|
import allure
|
||||||
from common import (
|
from common import (
|
||||||
IR_WALLET_PASS,
|
|
||||||
IR_WALLET_PATH,
|
IR_WALLET_PATH,
|
||||||
MAINNET_BLOCK_TIME,
|
MAINNET_BLOCK_TIME,
|
||||||
MORPH_ENDPOINT,
|
MORPH_ENDPOINT,
|
||||||
|
@ -13,10 +12,11 @@ from common import (
|
||||||
NEOGO_EXECUTABLE,
|
NEOGO_EXECUTABLE,
|
||||||
)
|
)
|
||||||
from neofs_testlib.cli import NeofsAdm, NeoGo
|
from neofs_testlib.cli import NeofsAdm, NeoGo
|
||||||
|
from neofs_testlib.hosting import Hosting
|
||||||
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
|
||||||
from utility import parse_time
|
from utility import get_wallet_password, parse_time
|
||||||
|
|
||||||
logger = logging.getLogger("NeoLogger")
|
logger = logging.getLogger("NeoLogger")
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ def get_epoch(shell: Shell):
|
||||||
|
|
||||||
|
|
||||||
@allure.step("Tick Epoch")
|
@allure.step("Tick Epoch")
|
||||||
def tick_epoch(shell: Shell):
|
def tick_epoch(shell: Shell, hosting: Hosting):
|
||||||
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(
|
||||||
|
@ -44,13 +44,13 @@ def tick_epoch(shell: Shell):
|
||||||
|
|
||||||
# Otherwise we tick epoch using transaction
|
# Otherwise we tick epoch using transaction
|
||||||
cur_epoch = get_epoch(shell)
|
cur_epoch = get_epoch(shell)
|
||||||
|
ir_wallet_password = get_wallet_password(hosting, "ir01")
|
||||||
ir_address = get_last_address_from_wallet(IR_WALLET_PATH, IR_WALLET_PASS)
|
ir_address = get_last_address_from_wallet(IR_WALLET_PATH, ir_wallet_password)
|
||||||
|
|
||||||
neogo = NeoGo(shell, neo_go_exec_path=NEOGO_EXECUTABLE)
|
neogo = NeoGo(shell, neo_go_exec_path=NEOGO_EXECUTABLE)
|
||||||
neogo.contract.invokefunction(
|
neogo.contract.invokefunction(
|
||||||
wallet=IR_WALLET_PATH,
|
wallet=IR_WALLET_PATH,
|
||||||
wallet_password=IR_WALLET_PASS,
|
wallet_password=ir_wallet_password,
|
||||||
scripthash=get_contract_hash("netmap.neofs", shell=shell),
|
scripthash=get_contract_hash("netmap.neofs", shell=shell),
|
||||||
method="newEpoch",
|
method="newEpoch",
|
||||||
arguments=f"int:{cur_epoch + 1}",
|
arguments=f"int:{cur_epoch + 1}",
|
||||||
|
|
|
@ -20,12 +20,15 @@ def wait_object_replication_on_nodes(
|
||||||
expected_copies: int,
|
expected_copies: int,
|
||||||
shell: Shell,
|
shell: Shell,
|
||||||
excluded_nodes: Optional[list[str]] = None,
|
excluded_nodes: Optional[list[str]] = None,
|
||||||
|
wallet_config: Optional[str] = None,
|
||||||
) -> list[str]:
|
) -> list[str]:
|
||||||
excluded_nodes = excluded_nodes or []
|
excluded_nodes = excluded_nodes or []
|
||||||
sleep_interval, attempts = 15, 20
|
sleep_interval, attempts = 15, 20
|
||||||
nodes = []
|
nodes = []
|
||||||
for __attempt in range(attempts):
|
for __attempt in range(attempts):
|
||||||
nodes = get_nodes_with_object(wallet, cid, oid, shell=shell, skip_nodes=excluded_nodes)
|
nodes = get_nodes_with_object(
|
||||||
|
wallet, cid, oid, shell=shell, skip_nodes=excluded_nodes, wallet_config=wallet_config
|
||||||
|
)
|
||||||
if len(nodes) >= expected_copies:
|
if len(nodes) >= expected_copies:
|
||||||
return nodes
|
return nodes
|
||||||
sleep(sleep_interval)
|
sleep(sleep_interval)
|
||||||
|
|
|
@ -6,19 +6,13 @@ from dataclasses import dataclass
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
import allure
|
import allure
|
||||||
from common import (
|
from common import MORPH_BLOCK_TIME, NEOFS_CLI_EXEC, NEOFS_NETMAP_DICT
|
||||||
MORPH_BLOCK_TIME,
|
|
||||||
NEOFS_CLI_EXEC,
|
|
||||||
NEOFS_NETMAP_DICT,
|
|
||||||
STORAGE_WALLET_CONFIG,
|
|
||||||
STORAGE_WALLET_PASS,
|
|
||||||
)
|
|
||||||
from data_formatters import get_wallet_public_key
|
from data_formatters import get_wallet_public_key
|
||||||
from epoch import tick_epoch
|
from epoch import tick_epoch
|
||||||
from neofs_testlib.cli import NeofsCli
|
from neofs_testlib.cli import NeofsCli
|
||||||
from neofs_testlib.hosting import Hosting
|
from neofs_testlib.hosting import Hosting
|
||||||
from neofs_testlib.shell import Shell
|
from neofs_testlib.shell import Shell
|
||||||
from utility import parse_time
|
from utility import create_wallet_config, get_wallet_password, parse_time
|
||||||
|
|
||||||
logger = logging.getLogger("NeoLogger")
|
logger = logging.getLogger("NeoLogger")
|
||||||
|
|
||||||
|
@ -104,7 +98,7 @@ def node_set_status(hosting: Hosting, node_name: str, status: str, retries: int
|
||||||
|
|
||||||
|
|
||||||
@allure.step("Get netmap snapshot")
|
@allure.step("Get netmap snapshot")
|
||||||
def get_netmap_snapshot(node_name: str, shell: Shell) -> str:
|
def get_netmap_snapshot(node_name: str, shell: Shell, hosting: Hosting) -> str:
|
||||||
"""
|
"""
|
||||||
The function returns string representation of netmap snapshot.
|
The function returns string representation of netmap snapshot.
|
||||||
Args:
|
Args:
|
||||||
|
@ -113,7 +107,8 @@ def get_netmap_snapshot(node_name: str, shell: Shell) -> str:
|
||||||
string representation of netmap
|
string representation of netmap
|
||||||
"""
|
"""
|
||||||
node_info = NEOFS_NETMAP_DICT[node_name]
|
node_info = NEOFS_NETMAP_DICT[node_name]
|
||||||
cli = NeofsCli(shell, NEOFS_CLI_EXEC, config_file=STORAGE_WALLET_CONFIG)
|
storage_wallet_config = create_wallet_config(hosting, node_name)
|
||||||
|
cli = NeofsCli(shell, NEOFS_CLI_EXEC, config_file=storage_wallet_config)
|
||||||
return cli.netmap.snapshot(
|
return cli.netmap.snapshot(
|
||||||
rpc_endpoint=node_info["rpc"],
|
rpc_endpoint=node_info["rpc"],
|
||||||
wallet=node_info["wallet_path"],
|
wallet=node_info["wallet_path"],
|
||||||
|
@ -169,14 +164,15 @@ def exclude_node_from_network_map(
|
||||||
hosting: Hosting, node_to_exclude: str, alive_node: str, shell: Shell
|
hosting: Hosting, node_to_exclude: str, alive_node: str, shell: Shell
|
||||||
) -> None:
|
) -> None:
|
||||||
node_wallet_path = NEOFS_NETMAP_DICT[node_to_exclude]["wallet_path"]
|
node_wallet_path = NEOFS_NETMAP_DICT[node_to_exclude]["wallet_path"]
|
||||||
node_netmap_key = get_wallet_public_key(node_wallet_path, STORAGE_WALLET_PASS)
|
node_wallet_password = get_wallet_password(hosting=hosting, service_name=node_to_exclude)
|
||||||
|
node_netmap_key = get_wallet_public_key(node_wallet_path, node_wallet_password)
|
||||||
|
|
||||||
node_set_status(hosting, node_to_exclude, status="offline")
|
node_set_status(hosting, node_to_exclude, status="offline")
|
||||||
|
|
||||||
time.sleep(parse_time(MORPH_BLOCK_TIME))
|
time.sleep(parse_time(MORPH_BLOCK_TIME))
|
||||||
tick_epoch(shell=shell)
|
tick_epoch(shell=shell, hosting=hosting)
|
||||||
|
|
||||||
snapshot = get_netmap_snapshot(node_name=alive_node, shell=shell)
|
snapshot = get_netmap_snapshot(node_name=alive_node, shell=shell, hosting=hosting)
|
||||||
assert (
|
assert (
|
||||||
node_netmap_key not in snapshot
|
node_netmap_key not in snapshot
|
||||||
), f"Expected node with key {node_netmap_key} not in network map"
|
), f"Expected node with key {node_netmap_key} not in network map"
|
||||||
|
@ -189,21 +185,24 @@ def include_node_to_network_map(
|
||||||
node_set_status(hosting, node_to_include, status="online")
|
node_set_status(hosting, node_to_include, status="online")
|
||||||
|
|
||||||
time.sleep(parse_time(MORPH_BLOCK_TIME) * 2)
|
time.sleep(parse_time(MORPH_BLOCK_TIME) * 2)
|
||||||
tick_epoch(shell=shell)
|
tick_epoch(shell=shell, hosting=hosting)
|
||||||
time.sleep(parse_time(MORPH_BLOCK_TIME) * 2)
|
time.sleep(parse_time(MORPH_BLOCK_TIME) * 2)
|
||||||
|
|
||||||
check_node_in_map(node_to_include, shell, alive_node)
|
check_node_in_map(node_to_include, shell, hosting, alive_node)
|
||||||
|
|
||||||
|
|
||||||
@allure.step("Check node {node_name} in network map")
|
@allure.step("Check node {node_name} in network map")
|
||||||
def check_node_in_map(node_name: str, shell: Shell, alive_node: Optional[str] = None) -> None:
|
def check_node_in_map(
|
||||||
|
node_name: str, shell: Shell, hosting: Hosting, alive_node: Optional[str] = None
|
||||||
|
) -> None:
|
||||||
alive_node = alive_node or node_name
|
alive_node = alive_node or node_name
|
||||||
node_wallet_path = NEOFS_NETMAP_DICT[node_name]["wallet_path"]
|
node_wallet_path = NEOFS_NETMAP_DICT[node_name]["wallet_path"]
|
||||||
node_netmap_key = get_wallet_public_key(node_wallet_path, STORAGE_WALLET_PASS)
|
node_wallet_password = get_wallet_password(hosting=hosting, service_name=node_name)
|
||||||
|
node_netmap_key = get_wallet_public_key(node_wallet_path, node_wallet_password)
|
||||||
|
|
||||||
logger.info(f"Node {node_name} netmap key: {node_netmap_key}")
|
logger.info(f"Node {node_name} netmap key: {node_netmap_key}")
|
||||||
|
|
||||||
snapshot = get_netmap_snapshot(node_name=alive_node, shell=shell)
|
snapshot = get_netmap_snapshot(node_name=alive_node, shell=shell, hosting=hosting)
|
||||||
assert node_netmap_key in snapshot, f"Expected node with key {node_netmap_key} in network map"
|
assert node_netmap_key in snapshot, f"Expected node with key {node_netmap_key} in network map"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,12 @@ def get_complex_object_copies(wallet: str, cid: str, oid: str, shell: Shell) ->
|
||||||
|
|
||||||
@allure.step("Get Nodes With Object")
|
@allure.step("Get Nodes With Object")
|
||||||
def get_nodes_with_object(
|
def get_nodes_with_object(
|
||||||
wallet: str, cid: str, oid: str, shell: Shell, skip_nodes: Optional[list[str]] = None
|
wallet: str,
|
||||||
|
cid: str,
|
||||||
|
oid: str,
|
||||||
|
shell: Shell,
|
||||||
|
skip_nodes: Optional[list[str]] = None,
|
||||||
|
wallet_config: Optional[str] = None,
|
||||||
) -> list[str]:
|
) -> list[str]:
|
||||||
"""
|
"""
|
||||||
The function returns list of nodes which store
|
The function returns list of nodes which store
|
||||||
|
@ -120,7 +125,13 @@ def get_nodes_with_object(
|
||||||
for node in nodes_to_search:
|
for node in nodes_to_search:
|
||||||
try:
|
try:
|
||||||
res = neofs_verbs.head_object(
|
res = neofs_verbs.head_object(
|
||||||
wallet, cid, oid, shell=shell, endpoint=node, is_direct=True
|
wallet,
|
||||||
|
cid,
|
||||||
|
oid,
|
||||||
|
shell=shell,
|
||||||
|
endpoint=node,
|
||||||
|
is_direct=True,
|
||||||
|
wallet_config=wallet_config,
|
||||||
)
|
)
|
||||||
if res is not None:
|
if res is not None:
|
||||||
logger.info(f"Found object {oid} on node {node}")
|
logger.info(f"Found object {oid} on node {node}")
|
||||||
|
|
|
@ -64,7 +64,7 @@ STORAGE_WALLET_PATH_4 = os.getenv(
|
||||||
"STORAGE_WALLET_PATH_4", os.path.join(DEVENV_PATH, "services", "storage", "wallet04.json")
|
"STORAGE_WALLET_PATH_4", os.path.join(DEVENV_PATH, "services", "storage", "wallet04.json")
|
||||||
)
|
)
|
||||||
STORAGE_WALLET_PATH = STORAGE_WALLET_PATH_1
|
STORAGE_WALLET_PATH = STORAGE_WALLET_PATH_1
|
||||||
STORAGE_WALLET_PASS = os.getenv("STORAGE_WALLET_PASS", "")
|
|
||||||
|
|
||||||
NEOFS_NETMAP_DICT = {
|
NEOFS_NETMAP_DICT = {
|
||||||
"s01": {
|
"s01": {
|
||||||
|
@ -107,7 +107,6 @@ MAINNET_SINGLE_ADDR = os.getenv("MAINNET_SINGLE_ADDR", "NfgHwwTi3wHAS8aFAN243C5v
|
||||||
MAINNET_WALLET_PASS = os.getenv("MAINNET_WALLET_PASS", "one")
|
MAINNET_WALLET_PASS = os.getenv("MAINNET_WALLET_PASS", "one")
|
||||||
|
|
||||||
IR_WALLET_PATH = os.getenv("IR_WALLET_PATH", os.path.join(DEVENV_PATH, "services", "ir", "az.json"))
|
IR_WALLET_PATH = os.getenv("IR_WALLET_PATH", os.path.join(DEVENV_PATH, "services", "ir", "az.json"))
|
||||||
IR_WALLET_PASS = os.getenv("IR_WALLET_PASS", "one")
|
|
||||||
|
|
||||||
S3_GATE_WALLET_PATH = os.getenv(
|
S3_GATE_WALLET_PATH = os.getenv(
|
||||||
"S3_GATE_WALLET_PATH", os.path.join(DEVENV_PATH, "services", "s3_gate", "wallet.json")
|
"S3_GATE_WALLET_PATH", os.path.join(DEVENV_PATH, "services", "s3_gate", "wallet.json")
|
||||||
|
@ -130,11 +129,3 @@ S3_GATE_SERVICE_NAME_REGEX = r"s3-gate\d\d"
|
||||||
WALLET_CONFIG = os.path.join(os.getcwd(), "wallet_config.yml")
|
WALLET_CONFIG = os.path.join(os.getcwd(), "wallet_config.yml")
|
||||||
with open(WALLET_CONFIG, "w") as file:
|
with open(WALLET_CONFIG, "w") as file:
|
||||||
yaml.dump({"password": WALLET_PASS}, file)
|
yaml.dump({"password": WALLET_PASS}, file)
|
||||||
|
|
||||||
STORAGE_WALLET_CONFIG = os.path.join(os.getcwd(), "storage_wallet_config.yml")
|
|
||||||
with open(STORAGE_WALLET_CONFIG, "w") as file:
|
|
||||||
yaml.dump({"password": STORAGE_WALLET_PASS}, file)
|
|
||||||
|
|
||||||
MAINNET_WALLET_CONFIG = os.path.join(os.getcwd(), "mainnet_wallet_config.yml")
|
|
||||||
with open(MAINNET_WALLET_CONFIG, "w") as file:
|
|
||||||
yaml.dump({"password": MAINNET_WALLET_PASS}, file)
|
|
||||||
|
|
Loading…
Reference in a new issue