2022-07-05 21:35:32 +00:00
|
|
|
import json
|
2022-10-31 08:03:06 +00:00
|
|
|
import logging
|
2022-07-05 21:35:32 +00:00
|
|
|
|
2022-09-20 15:03:52 +00:00
|
|
|
import allure
|
2023-01-09 12:46:03 +00:00
|
|
|
from frostfs_testlib.shell import Shell
|
2023-02-10 08:29:31 +00:00
|
|
|
from neo3.wallet import wallet
|
2022-10-13 18:53:44 +00:00
|
|
|
|
2023-02-27 16:54:27 +00:00
|
|
|
from pytest_tests.helpers.frostfs_verbs import head_object
|
|
|
|
|
2022-10-31 08:03:06 +00:00
|
|
|
logger = logging.getLogger("NeoLogger")
|
|
|
|
|
2022-07-05 21:35:32 +00:00
|
|
|
|
2022-09-20 15:03:52 +00:00
|
|
|
@allure.step("Verify Head Tombstone")
|
2022-12-05 22:31:45 +00:00
|
|
|
def verify_head_tombstone(
|
|
|
|
wallet_path: str, cid: str, oid_ts: str, oid: str, shell: Shell, endpoint: str
|
|
|
|
):
|
|
|
|
header = head_object(wallet_path, cid, oid_ts, shell=shell, endpoint=endpoint)["header"]
|
2022-10-31 08:03:06 +00:00
|
|
|
|
|
|
|
s_oid = header["sessionToken"]["body"]["object"]["target"]["objects"]
|
|
|
|
logger.info(f"Header Session OIDs is {s_oid}")
|
|
|
|
logger.info(f"OID is {oid}")
|
|
|
|
|
2022-09-20 15:03:52 +00:00
|
|
|
assert header["containerID"] == cid, "Tombstone Header CID is wrong"
|
2022-07-05 21:35:32 +00:00
|
|
|
|
2022-10-19 06:26:14 +00:00
|
|
|
with open(wallet_path, "r") as file:
|
|
|
|
wlt_data = json.loads(file.read())
|
2022-09-20 15:03:52 +00:00
|
|
|
wlt = wallet.Wallet.from_json(wlt_data, password="")
|
2022-07-05 21:35:32 +00:00
|
|
|
addr = wlt.accounts[0].address
|
|
|
|
|
2022-09-20 15:03:52 +00:00
|
|
|
assert header["ownerID"] == addr, "Tombstone Owner ID is wrong"
|
|
|
|
assert header["objectType"] == "TOMBSTONE", "Header Type isn't Tombstone"
|
|
|
|
assert (
|
|
|
|
header["sessionToken"]["body"]["object"]["verb"] == "DELETE"
|
|
|
|
), "Header Session Type isn't DELETE"
|
|
|
|
assert (
|
2022-10-11 12:02:53 +00:00
|
|
|
header["sessionToken"]["body"]["object"]["target"]["container"] == cid
|
2022-09-20 15:03:52 +00:00
|
|
|
), "Header Session ID is wrong"
|
|
|
|
assert (
|
2022-10-31 08:03:06 +00:00
|
|
|
oid in header["sessionToken"]["body"]["object"]["target"]["objects"]
|
2022-09-20 15:03:52 +00:00
|
|
|
), "Header Session OID is wrong"
|