forked from TrueCloudLab/frostfs-testcases
[#314] Fix tools config
Signed-off-by: Vladimir Domnich <v.domnich@yadro.com>
This commit is contained in:
parent
2452cccba0
commit
588292dfb5
18 changed files with 239 additions and 844 deletions
|
@ -13,8 +13,6 @@ import base64
|
|||
|
||||
import base58
|
||||
|
||||
ROBOT_AUTO_KEYWORDS = False
|
||||
|
||||
|
||||
def decode_simple_header(data: dict):
|
||||
"""
|
||||
|
@ -43,14 +41,8 @@ def decode_split_header(data: dict):
|
|||
"""
|
||||
try:
|
||||
data["splitId"] = json_reencode(data["splitId"])
|
||||
data["lastPart"] = (
|
||||
json_reencode(data["lastPart"]["value"])
|
||||
if data["lastPart"] else None
|
||||
)
|
||||
data["link"] = (
|
||||
json_reencode(data["link"]["value"])
|
||||
if data["link"] else None
|
||||
)
|
||||
data["lastPart"] = json_reencode(data["lastPart"]["value"]) if data["lastPart"] else None
|
||||
data["link"] = json_reencode(data["link"]["value"]) if data["link"] else None
|
||||
except Exception as exc:
|
||||
raise ValueError(f"failed to decode JSON output: {exc}") from exc
|
||||
|
||||
|
@ -66,16 +58,18 @@ def decode_linking_object(data: dict):
|
|||
data = decode_simple_header(data)
|
||||
# reencoding Child Object IDs
|
||||
# { 'value': <Base58 encoded OID> } -> <Base64 encoded OID>
|
||||
for ind, val in enumerate(data['header']['split']['children']):
|
||||
data['header']['split']['children'][ind] = json_reencode(val['value'])
|
||||
data['header']['split']['splitID'] = json_reencode(data['header']['split']['splitID'])
|
||||
data['header']['split']['previous'] = (
|
||||
json_reencode(data['header']['split']['previous']['value'])
|
||||
if data['header']['split']['previous'] else None
|
||||
for ind, val in enumerate(data["header"]["split"]["children"]):
|
||||
data["header"]["split"]["children"][ind] = json_reencode(val["value"])
|
||||
data["header"]["split"]["splitID"] = json_reencode(data["header"]["split"]["splitID"])
|
||||
data["header"]["split"]["previous"] = (
|
||||
json_reencode(data["header"]["split"]["previous"]["value"])
|
||||
if data["header"]["split"]["previous"]
|
||||
else None
|
||||
)
|
||||
data['header']['split']['parent'] = (
|
||||
json_reencode(data['header']['split']['parent']['value'])
|
||||
if data['header']['split']['parent'] else None
|
||||
data["header"]["split"]["parent"] = (
|
||||
json_reencode(data["header"]["split"]["parent"]["value"])
|
||||
if data["header"]["split"]["parent"]
|
||||
else None
|
||||
)
|
||||
except Exception as exc:
|
||||
raise ValueError(f"failed to decode JSON output: {exc}") from exc
|
||||
|
@ -101,8 +95,7 @@ def decode_tombstone(data: dict):
|
|||
"""
|
||||
try:
|
||||
data = decode_simple_header(data)
|
||||
data['header']['sessionToken'] = decode_session_token(
|
||||
data['header']['sessionToken'])
|
||||
data["header"]["sessionToken"] = decode_session_token(data["header"]["sessionToken"])
|
||||
except Exception as exc:
|
||||
raise ValueError(f"failed to decode JSON output: {exc}") from exc
|
||||
return data
|
||||
|
@ -113,10 +106,12 @@ def decode_session_token(data: dict):
|
|||
This function reencodes a fragment of header which contains
|
||||
information about session token.
|
||||
"""
|
||||
data['body']['object']['address']['containerID'] = json_reencode(
|
||||
data['body']['object']['address']['containerID']['value'])
|
||||
data['body']['object']['address']['objectID'] = json_reencode(
|
||||
data['body']['object']['address']['objectID']['value'])
|
||||
data["body"]["object"]["address"]["containerID"] = json_reencode(
|
||||
data["body"]["object"]["address"]["containerID"]["value"]
|
||||
)
|
||||
data["body"]["object"]["address"]["objectID"] = json_reencode(
|
||||
data["body"]["object"]["address"]["objectID"]["value"]
|
||||
)
|
||||
return data
|
||||
|
||||
|
||||
|
@ -135,7 +130,7 @@ def encode_for_json(data: str):
|
|||
This function encodes binary data for sending them as protobuf
|
||||
structures.
|
||||
"""
|
||||
return base64.b64encode(base58.b58decode(data)).decode('utf-8')
|
||||
return base64.b64encode(base58.b58decode(data)).decode("utf-8")
|
||||
|
||||
|
||||
def decode_common_fields(data: dict):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue