[#184] finally got rid of neofs.py
Signed-off-by: anastasia prasolova <anastasia@nspcc.ru>
This commit is contained in:
parent
d396118085
commit
7abb2761c9
17 changed files with 102 additions and 113 deletions
|
@ -1,86 +0,0 @@
|
||||||
#!/usr/bin/python3
|
|
||||||
|
|
||||||
import json
|
|
||||||
import os
|
|
||||||
import random
|
|
||||||
|
|
||||||
from neo3 import wallet
|
|
||||||
from robot.api import logger
|
|
||||||
from robot.api.deco import keyword
|
|
||||||
from robot.libraries.BuiltIn import BuiltIn
|
|
||||||
|
|
||||||
import neofs_verbs
|
|
||||||
from common import NEOFS_NETMAP_DICT
|
|
||||||
|
|
||||||
ROBOT_AUTO_KEYWORDS = False
|
|
||||||
|
|
||||||
# path to neofs-cli executable
|
|
||||||
NEOFS_CLI_EXEC = os.getenv('NEOFS_CLI_EXEC', 'neofs-cli')
|
|
||||||
|
|
||||||
|
|
||||||
@keyword('Verify Head Tombstone')
|
|
||||||
def verify_head_tombstone(wallet_path: str, cid: str, oid_ts: str, oid: str):
|
|
||||||
header = neofs_verbs.head_object(wallet_path, cid, oid_ts)
|
|
||||||
header = header['header']
|
|
||||||
|
|
||||||
BuiltIn().should_be_equal(header["containerID"], cid,
|
|
||||||
msg="Tombstone Header CID is wrong")
|
|
||||||
|
|
||||||
wlt_data = dict()
|
|
||||||
with open(wallet_path, 'r') as fout:
|
|
||||||
wlt_data = json.loads(fout.read())
|
|
||||||
wlt = wallet.Wallet.from_json(wlt_data, password='')
|
|
||||||
addr = wlt.accounts[0].address
|
|
||||||
|
|
||||||
BuiltIn().should_be_equal(header["ownerID"], addr,
|
|
||||||
msg="Tombstone Owner ID is wrong")
|
|
||||||
|
|
||||||
BuiltIn().should_be_equal(header["objectType"], 'TOMBSTONE',
|
|
||||||
msg="Header Type isn't Tombstone")
|
|
||||||
|
|
||||||
BuiltIn().should_be_equal(header["sessionToken"]["body"]["object"]["verb"], 'DELETE',
|
|
||||||
msg="Header Session Type isn't DELETE")
|
|
||||||
|
|
||||||
BuiltIn().should_be_equal(header["sessionToken"]["body"]["object"]["address"]["containerID"],
|
|
||||||
cid,
|
|
||||||
msg="Header Session ID is wrong")
|
|
||||||
|
|
||||||
BuiltIn().should_be_equal(header["sessionToken"]["body"]["object"]["address"]["objectID"],
|
|
||||||
oid,
|
|
||||||
msg="Header Session OID is wrong")
|
|
||||||
|
|
||||||
|
|
||||||
@keyword('Get control endpoint and wallet')
|
|
||||||
def get_control_endpoint_and_wallet(endpoint_number: str = ''):
|
|
||||||
"""
|
|
||||||
Gets control endpoint for a random or given node
|
|
||||||
|
|
||||||
Args:
|
|
||||||
endpoint_number (optional, str): the number of the node
|
|
||||||
in the form of 's01', 's02', etc.
|
|
||||||
given in NEOFS_NETMAP_DICT as keys
|
|
||||||
Returns:
|
|
||||||
(str): the number of the node
|
|
||||||
(str): endpoint control for the node
|
|
||||||
(str): the wallet of the respective node
|
|
||||||
"""
|
|
||||||
if endpoint_number == '':
|
|
||||||
endpoint_num = random.choice(list(NEOFS_NETMAP_DICT.keys()))
|
|
||||||
logger.info(f'Random node chosen: {endpoint_num}')
|
|
||||||
else:
|
|
||||||
endpoint_num = endpoint_number
|
|
||||||
|
|
||||||
endpoint_values = NEOFS_NETMAP_DICT[f'{endpoint_num}']
|
|
||||||
endpoint_control = endpoint_values['control']
|
|
||||||
wlt = endpoint_values['wallet_path']
|
|
||||||
|
|
||||||
return endpoint_num, endpoint_control, wlt
|
|
||||||
|
|
||||||
|
|
||||||
@keyword('Get Locode')
|
|
||||||
def get_locode():
|
|
||||||
endpoint_values = random.choice(list(NEOFS_NETMAP_DICT.values()))
|
|
||||||
locode = endpoint_values['UN-LOCODE']
|
|
||||||
logger.info(f'Random locode chosen: {locode}')
|
|
||||||
|
|
||||||
return locode
|
|
|
@ -8,6 +8,8 @@
|
||||||
import random
|
import random
|
||||||
|
|
||||||
import docker
|
import docker
|
||||||
|
from common import NEOFS_NETMAP_DICT
|
||||||
|
from robot.api import logger
|
||||||
from robot.api.deco import keyword
|
from robot.api.deco import keyword
|
||||||
|
|
||||||
ROBOT_AUTO_KEYWORDS = False
|
ROBOT_AUTO_KEYWORDS = False
|
||||||
|
@ -45,3 +47,39 @@ def start_nodes(nodes: list):
|
||||||
for node in nodes:
|
for node in nodes:
|
||||||
node = node.split('.')[0]
|
node = node.split('.')[0]
|
||||||
client.start(node)
|
client.start(node)
|
||||||
|
|
||||||
|
|
||||||
|
@keyword('Get control endpoint and wallet')
|
||||||
|
def get_control_endpoint_and_wallet(endpoint_number: str = ''):
|
||||||
|
"""
|
||||||
|
Gets control endpoint for a random or given node
|
||||||
|
|
||||||
|
Args:
|
||||||
|
endpoint_number (optional, str): the number of the node
|
||||||
|
in the form of 's01', 's02', etc.
|
||||||
|
given in NEOFS_NETMAP_DICT as keys
|
||||||
|
Returns:
|
||||||
|
(str): the number of the node
|
||||||
|
(str): endpoint control for the node
|
||||||
|
(str): the wallet of the respective node
|
||||||
|
"""
|
||||||
|
if endpoint_number == '':
|
||||||
|
endpoint_num = random.choice(list(NEOFS_NETMAP_DICT.keys()))
|
||||||
|
logger.info(f'Random node chosen: {endpoint_num}')
|
||||||
|
else:
|
||||||
|
endpoint_num = endpoint_number
|
||||||
|
|
||||||
|
endpoint_values = NEOFS_NETMAP_DICT[f'{endpoint_num}']
|
||||||
|
endpoint_control = endpoint_values['control']
|
||||||
|
wlt = endpoint_values['wallet_path']
|
||||||
|
|
||||||
|
return endpoint_num, endpoint_control, wlt
|
||||||
|
|
||||||
|
|
||||||
|
@keyword('Get Locode')
|
||||||
|
def get_locode():
|
||||||
|
endpoint_values = random.choice(list(NEOFS_NETMAP_DICT.values()))
|
||||||
|
locode = endpoint_values['UN-LOCODE']
|
||||||
|
logger.info(f'Random locode chosen: {locode}')
|
||||||
|
|
||||||
|
return locode
|
||||||
|
|
49
robot/resources/lib/python_keywords/tombstone.py
Normal file
49
robot/resources/lib/python_keywords/tombstone.py
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import json
|
||||||
|
|
||||||
|
from neo3 import wallet
|
||||||
|
from robot.api.deco import keyword
|
||||||
|
from robot.libraries.BuiltIn import BuiltIn
|
||||||
|
|
||||||
|
import neofs_verbs
|
||||||
|
|
||||||
|
ROBOT_AUTO_KEYWORDS = False
|
||||||
|
|
||||||
|
|
||||||
|
@keyword('Verify Head Tombstone')
|
||||||
|
def verify_head_tombstone(wallet_path: str, cid: str, oid_ts: str, oid: str):
|
||||||
|
header = neofs_verbs.head_object(wallet_path, cid, oid_ts)
|
||||||
|
header = header['header']
|
||||||
|
|
||||||
|
BuiltIn().should_be_equal(header["containerID"], cid,
|
||||||
|
msg="Tombstone Header CID is wrong")
|
||||||
|
|
||||||
|
wlt_data = dict()
|
||||||
|
with open(wallet_path, 'r') as fout:
|
||||||
|
wlt_data = json.loads(fout.read())
|
||||||
|
wlt = wallet.Wallet.from_json(wlt_data, password='')
|
||||||
|
addr = wlt.accounts[0].address
|
||||||
|
|
||||||
|
BuiltIn().should_be_equal(header["ownerID"], addr,
|
||||||
|
msg="Tombstone Owner ID is wrong")
|
||||||
|
|
||||||
|
BuiltIn().should_be_equal(header["objectType"], 'TOMBSTONE',
|
||||||
|
msg="Header Type isn't Tombstone")
|
||||||
|
|
||||||
|
BuiltIn().should_be_equal(
|
||||||
|
header["sessionToken"]["body"]["object"]["verb"], 'DELETE',
|
||||||
|
msg="Header Session Type isn't DELETE"
|
||||||
|
)
|
||||||
|
|
||||||
|
BuiltIn().should_be_equal(
|
||||||
|
header["sessionToken"]["body"]["object"]["address"]["containerID"],
|
||||||
|
cid,
|
||||||
|
msg="Header Session ID is wrong"
|
||||||
|
)
|
||||||
|
|
||||||
|
BuiltIn().should_be_equal(
|
||||||
|
header["sessionToken"]["body"]["object"]["address"]["objectID"],
|
||||||
|
oid,
|
||||||
|
msg="Header Session OID is wrong"
|
||||||
|
)
|
|
@ -4,7 +4,6 @@ Variables eacl_object_filters.py
|
||||||
|
|
||||||
Library acl.py
|
Library acl.py
|
||||||
Library container.py
|
Library container.py
|
||||||
Library neofs.py
|
|
||||||
Library neofs_verbs.py
|
Library neofs_verbs.py
|
||||||
|
|
||||||
Library Collections
|
Library Collections
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
Variables common.py
|
Variables common.py
|
||||||
|
|
||||||
Library epoch.py
|
Library epoch.py
|
||||||
Library neofs.py
|
Library tombstone.py
|
||||||
Library neofs_verbs.py
|
Library neofs_verbs.py
|
||||||
Library utility_keywords.py
|
Library utility_keywords.py
|
||||||
Library Collections
|
Library Collections
|
||||||
|
|
|
@ -4,7 +4,7 @@ Variables common.py
|
||||||
Library acl.py
|
Library acl.py
|
||||||
Library container.py
|
Library container.py
|
||||||
Library epoch.py
|
Library epoch.py
|
||||||
Library neofs.py
|
Library nodes_management.py
|
||||||
Library neofs_verbs.py
|
Library neofs_verbs.py
|
||||||
Library storage_policy.py
|
Library storage_policy.py
|
||||||
Library utility_keywords.py
|
Library utility_keywords.py
|
||||||
|
|
|
@ -3,7 +3,6 @@ Variables common.py
|
||||||
|
|
||||||
Library acl.py
|
Library acl.py
|
||||||
Library container.py
|
Library container.py
|
||||||
Library neofs.py
|
|
||||||
Library neofs_verbs.py
|
Library neofs_verbs.py
|
||||||
Library Collections
|
Library Collections
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ Variables common.py
|
||||||
Library Collections
|
Library Collections
|
||||||
Library acl.py
|
Library acl.py
|
||||||
Library container.py
|
Library container.py
|
||||||
Library neofs.py
|
|
||||||
Library neofs_verbs.py
|
Library neofs_verbs.py
|
||||||
Library utility_keywords.py
|
Library utility_keywords.py
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
Variables common.py
|
Variables common.py
|
||||||
|
|
||||||
Library container.py
|
Library container.py
|
||||||
Library neofs.py
|
|
||||||
Library payment_neogo.py
|
|
||||||
Library String
|
Library String
|
||||||
Library Collections
|
Library Collections
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ Variables common.py
|
||||||
|
|
||||||
Library Process
|
Library Process
|
||||||
Library epoch.py
|
Library epoch.py
|
||||||
Library neofs.py
|
Library nodes_management.py
|
||||||
Library String
|
Library String
|
||||||
Library acl.py
|
Library acl.py
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@ Resource payment_operations.robot
|
||||||
*** Test Cases ***
|
*** Test Cases ***
|
||||||
Control Operations with storage nodes
|
Control Operations with storage nodes
|
||||||
[Documentation] Testcase to check NetworkInfo control command.
|
[Documentation] Testcase to check NetworkInfo control command.
|
||||||
[Tags] NeoFSCLI NetworkInfo
|
|
||||||
[Timeout] 5 min
|
[Timeout] 5 min
|
||||||
|
|
||||||
[Setup] Setup
|
[Setup] Setup
|
||||||
|
|
|
@ -3,7 +3,7 @@ Variables common.py
|
||||||
Variables wellknown_acl.py
|
Variables wellknown_acl.py
|
||||||
|
|
||||||
Library container.py
|
Library container.py
|
||||||
Library neofs.py
|
Library nodes_management.py
|
||||||
Library neofs_verbs.py
|
Library neofs_verbs.py
|
||||||
Library utility_keywords.py
|
Library utility_keywords.py
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ Variables common.py
|
||||||
Library container.py
|
Library container.py
|
||||||
Library complex_object_actions.py
|
Library complex_object_actions.py
|
||||||
Library neofs_verbs.py
|
Library neofs_verbs.py
|
||||||
Library neofs.py
|
|
||||||
Library storage_policy.py
|
Library storage_policy.py
|
||||||
Library utility_keywords.py
|
Library utility_keywords.py
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
*** Settings ***
|
*** Settings ***
|
||||||
Variables common.py
|
Variables common.py
|
||||||
|
|
||||||
Library neofs.py
|
|
||||||
Library container.py
|
Library container.py
|
||||||
Library neofs_verbs.py
|
Library neofs_verbs.py
|
||||||
Library storage_group.py
|
Library storage_group.py
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
*** Settings ***
|
*** Settings ***
|
||||||
Variables common.py
|
Variables common.py
|
||||||
|
|
||||||
Library neofs.py
|
|
||||||
Library payment_neogo.py
|
Library payment_neogo.py
|
||||||
Library utility_keywords.py
|
Library utility_keywords.py
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ Variables common.py
|
||||||
Variables wellknown_acl.py
|
Variables wellknown_acl.py
|
||||||
|
|
||||||
Library container.py
|
Library container.py
|
||||||
Library neofs.py
|
|
||||||
Library neofs_verbs.py
|
Library neofs_verbs.py
|
||||||
Library http_gate.py
|
Library http_gate.py
|
||||||
Library storage_policy.py
|
Library storage_policy.py
|
||||||
|
@ -25,10 +24,10 @@ NeoFS HTTP Gateway
|
||||||
[Setup] Setup
|
[Setup] Setup
|
||||||
Make Up ${INCLUDE_SVC}
|
Make Up ${INCLUDE_SVC}
|
||||||
|
|
||||||
${WALLET} ${_} ${_} = Prepare Wallet And Deposit
|
${WALLET} ${_} ${_} = Prepare Wallet And Deposit
|
||||||
${CID} = Create container ${WALLET} rule=${PLACEMENT_RULE} basic_acl=${PUBLIC_ACL}
|
${CID} = Create container ${WALLET} rule=${PLACEMENT_RULE} basic_acl=${PUBLIC_ACL}
|
||||||
${FILE} ${HASH} = Generate file ${SIMPLE_OBJ_SIZE}
|
${FILE} ${HASH} = Generate file ${SIMPLE_OBJ_SIZE}
|
||||||
${FILE_L} ${L_HASH} = Generate file ${COMPLEX_OBJ_SIZE}
|
${FILE_L} ${L_HASH} = Generate file ${COMPLEX_OBJ_SIZE}
|
||||||
|
|
||||||
${S_OID} = Put object ${WALLET} ${FILE} ${CID}
|
${S_OID} = Put object ${WALLET} ${FILE} ${CID}
|
||||||
${L_OID} = Put object ${WALLET} ${FILE_L} ${CID}
|
${L_OID} = Put object ${WALLET} ${FILE_L} ${CID}
|
||||||
|
@ -38,8 +37,8 @@ NeoFS HTTP Gateway
|
||||||
@{GET_NODE_LIST} = Get nodes without object ${WALLET} ${CID} ${S_OID}
|
@{GET_NODE_LIST} = Get nodes without object ${WALLET} ${CID} ${S_OID}
|
||||||
${NODE} = Evaluate random.choice($GET_NODE_LIST) random
|
${NODE} = Evaluate random.choice($GET_NODE_LIST) random
|
||||||
|
|
||||||
${GET_OBJ_S} = Get object ${WALLET} ${CID} ${S_OID} ${EMPTY} s_file_read ${NODE}
|
${GET_OBJ_S} = Get object ${WALLET} ${CID} ${S_OID} ${EMPTY} s_file_read ${NODE}
|
||||||
${FILEPATH} = Get via HTTP Gate ${CID} ${S_OID}
|
${FILEPATH} = Get via HTTP Gate ${CID} ${S_OID}
|
||||||
|
|
||||||
${PLAIN_FILE_HASH} = Get file hash ${GET_OBJ_S}
|
${PLAIN_FILE_HASH} = Get file hash ${GET_OBJ_S}
|
||||||
${GATE_FILE_HASH} = Get file hash ${FILEPATH}
|
${GATE_FILE_HASH} = Get file hash ${FILEPATH}
|
||||||
|
@ -49,8 +48,8 @@ NeoFS HTTP Gateway
|
||||||
@{GET_NODE_LIST} = Get nodes without object ${WALLET} ${CID} ${L_OID}
|
@{GET_NODE_LIST} = Get nodes without object ${WALLET} ${CID} ${L_OID}
|
||||||
${NODE} = Evaluate random.choice($GET_NODE_LIST) random
|
${NODE} = Evaluate random.choice($GET_NODE_LIST) random
|
||||||
|
|
||||||
${GET_OBJ_L} = Get object ${WALLET} ${CID} ${L_OID} ${EMPTY} l_file_read ${NODE}
|
${GET_OBJ_L} = Get object ${WALLET} ${CID} ${L_OID} ${EMPTY} l_file_read ${NODE}
|
||||||
${FILEPATH} = Get via HTTP Gate ${CID} ${L_OID}
|
${FILEPATH} = Get via HTTP Gate ${CID} ${L_OID}
|
||||||
|
|
||||||
${PLAIN_FILE_HASH} = Get file hash ${GET_OBJ_L}
|
${PLAIN_FILE_HASH} = Get file hash ${GET_OBJ_L}
|
||||||
${GATE_FILE_HASH} = Get file hash ${FILEPATH}
|
${GATE_FILE_HASH} = Get file hash ${FILEPATH}
|
||||||
|
|
|
@ -4,7 +4,6 @@ Variables common.py
|
||||||
Library Collections
|
Library Collections
|
||||||
Library OperatingSystem
|
Library OperatingSystem
|
||||||
|
|
||||||
Library neofs.py
|
|
||||||
Library container.py
|
Library container.py
|
||||||
Library s3_gate.py
|
Library s3_gate.py
|
||||||
Library epoch.py
|
Library epoch.py
|
||||||
|
@ -24,9 +23,9 @@ Buckets in NeoFS S3 Gateway
|
||||||
[Setup] Setup
|
[Setup] Setup
|
||||||
Make Up ${INCLUDE_SVC}
|
Make Up ${INCLUDE_SVC}
|
||||||
|
|
||||||
${WALLET} ${_} ${_} = Prepare Wallet And Deposit
|
${WALLET} ${_} ${_} = Prepare Wallet And Deposit
|
||||||
${FILE_S3} ${_} = Generate file ${COMPLEX_OBJ_SIZE}
|
${FILE_S3} ${_} = Generate file ${COMPLEX_OBJ_SIZE}
|
||||||
${_} ${S3_OBJECT_KEY} = Split Path ${FILE_S3}
|
${_} ${S3_OBJECT_KEY} = Split Path ${FILE_S3}
|
||||||
|
|
||||||
${CID}
|
${CID}
|
||||||
... ${BUCKET}
|
... ${BUCKET}
|
||||||
|
|
|
@ -5,7 +5,6 @@ Library Collections
|
||||||
Library OperatingSystem
|
Library OperatingSystem
|
||||||
|
|
||||||
Library container.py
|
Library container.py
|
||||||
Library neofs.py
|
|
||||||
Library s3_gate.py
|
Library s3_gate.py
|
||||||
Library utility_keywords.py
|
Library utility_keywords.py
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue