2023-05-14 10:43:59 +00:00
|
|
|
import json
|
|
|
|
import logging
|
|
|
|
|
|
|
|
from neo3.wallet import wallet
|
|
|
|
|
2023-11-29 12:27:17 +00:00
|
|
|
from frostfs_testlib import reporter
|
2023-05-14 10:43:59 +00:00
|
|
|
from frostfs_testlib.shell import Shell
|
|
|
|
from frostfs_testlib.steps.cli.object import head_object
|
|
|
|
|
|
|
|
logger = logging.getLogger("NeoLogger")
|
|
|
|
|
|
|
|
|
2023-11-29 12:27:17 +00:00
|
|
|
@reporter.step("Verify Head Tombstone")
|
|
|
|
def verify_head_tombstone(wallet_path: str, cid: str, oid_ts: str, oid: str, shell: Shell, endpoint: str):
|
2023-05-14 10:43:59 +00:00
|
|
|
header = head_object(wallet_path, cid, oid_ts, shell=shell, endpoint=endpoint)["header"]
|
|
|
|
|
|
|
|
s_oid = header["sessionToken"]["body"]["object"]["target"]["objects"]
|
|
|
|
logger.info(f"Header Session OIDs is {s_oid}")
|
|
|
|
logger.info(f"OID is {oid}")
|
|
|
|
|
|
|
|
assert header["containerID"] == cid, "Tombstone Header CID is wrong"
|
|
|
|
|
|
|
|
with open(wallet_path, "r") as file:
|
|
|
|
wlt_data = json.loads(file.read())
|
|
|
|
wlt = wallet.Wallet.from_json(wlt_data, password="")
|
|
|
|
addr = wlt.accounts[0].address
|
|
|
|
|
|
|
|
assert header["ownerID"] == addr, "Tombstone Owner ID is wrong"
|
|
|
|
assert header["objectType"] == "TOMBSTONE", "Header Type isn't Tombstone"
|
2023-11-29 12:27:17 +00:00
|
|
|
assert header["sessionToken"]["body"]["object"]["verb"] == "DELETE", "Header Session Type isn't DELETE"
|
|
|
|
assert header["sessionToken"]["body"]["object"]["target"]["container"] == cid, "Header Session ID is wrong"
|
|
|
|
assert oid in header["sessionToken"]["body"]["object"]["target"]["objects"], "Header Session OID is wrong"
|