Merged in feature/add-acl-testcase (pull request #5)
Add basic acl testcase
This commit is contained in:
commit
fe91d5da31
7 changed files with 391 additions and 112 deletions
4
Makefile
4
Makefile
|
@ -27,7 +27,7 @@ run_docker:
|
|||
@mkdir artifacts_$(NAME)
|
||||
@docker run --privileged=true \
|
||||
--name $(NAME) \
|
||||
robot:$(VERSION)$(PREFIX) ./dockerd.sh &
|
||||
robot:$(VERSION)$(PREFIX) ./dockerd.sh &
|
||||
@sleep 10;
|
||||
@docker wait $(NAME);
|
||||
@echo "${B}${G}⇒ Testsuite has been completed. ${R}";
|
||||
|
@ -37,7 +37,7 @@ run_docker:
|
|||
|
||||
run:
|
||||
@echo "${B}${G}⇒ Test Run ${R}"
|
||||
@robot --timestampoutputs --outputdir artifacts/ robot/testsuites/integration/object_suite.robot
|
||||
@robot --timestampoutputs --outputdir artifacts/ robot/testsuites/integration/*.robot
|
||||
|
||||
help:
|
||||
@echo "${B}${G}⇒ build Build image ${R}"
|
||||
|
|
|
@ -15,23 +15,77 @@ ROBOT_AUTO_KEYWORDS = False
|
|||
NEOFS_ENDPOINT = "192.168.123.71:8080"
|
||||
CLI_PREFIX = "docker exec neofs-cli "
|
||||
|
||||
@keyword('Form Privkey from String')
|
||||
def form_privkey_from_string(private_key: str):
|
||||
return bytes.fromhex(private_key)
|
||||
|
||||
|
||||
@keyword('Get nodes with object')
|
||||
def get_nodes_with_object(private_key: bytes, cid, oid):
|
||||
storage_nodes = _get_storage_nodes(private_key)
|
||||
copies = 0
|
||||
|
||||
nodes_list = []
|
||||
|
||||
for node in storage_nodes:
|
||||
if re.search(r'(%s: %s)' % (cid, oid), _search_object(node, private_key, cid, oid)):
|
||||
nodes_list.append(node)
|
||||
|
||||
logger.info("Nodes with object: %s" % nodes_list)
|
||||
|
||||
|
||||
@keyword('Get nodes without object')
|
||||
def get_nodes_without_object(private_key: bytes, cid, oid):
|
||||
storage_nodes = _get_storage_nodes(private_key)
|
||||
copies = 0
|
||||
|
||||
nodes_list = []
|
||||
|
||||
for node in storage_nodes:
|
||||
if not re.search(r'(%s: %s)' % (cid, oid), _search_object(node, private_key, cid, oid)):
|
||||
nodes_list.append(node)
|
||||
|
||||
logger.info("Nodes with object: %s" % nodes_list)
|
||||
|
||||
|
||||
@keyword('Validate storage policy for object')
|
||||
def validate_storage_policy_for_object(private_key: bytes, expected_copies, cid, oid):
|
||||
def validate_storage_policy_for_object(private_key: bytes, expected_copies: int, cid, oid):
|
||||
storage_nodes = _get_storage_nodes(private_key)
|
||||
copies = 0
|
||||
for node in storage_nodes:
|
||||
if re.search(r'(%s: %s)' % (cid, oid), _search_object(node, private_key, cid, oid)):
|
||||
copies += 1
|
||||
|
||||
logger.info("Copies: %s" % copies)
|
||||
|
||||
if copies < expected_copies:
|
||||
raise Exception("Not enough object copies to match storage policyю Found: %s, expexted: %s." % (copies, expected_copies))
|
||||
|
||||
|
||||
|
||||
#docker exec neofs-cli neofs-cli --host 192.168.123.71:8080 --key 22b2f3faea9383e27262364c96d8e5ef7e893abf7a6ad7bf31ee1f2c2b3cfc42
|
||||
# object get-range --cid 4H9iChvzYdBg6qntfYUWGWCzsJFBDdo99KegefsD721Q --oid a101d078-b3d4-4325-8fe8-41dce6917097 0:10
|
||||
#fead193c1f6f488255f7
|
||||
|
||||
@keyword('Get Range')
|
||||
def get_range(private_key: bytes, cid: str, oid: str, range_cut: str):
|
||||
|
||||
Cmd = f'{CLI_PREFIX}neofs-cli --host {NEOFS_ENDPOINT} --key {binascii.hexlify(private_key).decode()} object get-range --cid {cid} --oid {oid} {range_cut}'
|
||||
logger.info("Cmd: %s" % Cmd)
|
||||
complProc = subprocess.run(Cmd, check=True, universal_newlines=True,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=150, shell=True)
|
||||
output = complProc.stdout
|
||||
logger.info("Output: %s" % output)
|
||||
|
||||
|
||||
@keyword('Create container')
|
||||
def create_container(private_key: bytes):
|
||||
def create_container(private_key: bytes, basic_acl:str=""):
|
||||
rule = "RF 2 SELECT 2 Node"
|
||||
createContainerCmd = f'{CLI_PREFIX}neofs-cli --host {NEOFS_ENDPOINT} --key {binascii.hexlify(private_key).decode()} container put --rule "{rule}"'
|
||||
|
||||
if basic_acl != "":
|
||||
basic_acl = "--acl " + basic_acl
|
||||
|
||||
createContainerCmd = f'{CLI_PREFIX}neofs-cli --host {NEOFS_ENDPOINT} --key {binascii.hexlify(private_key).decode()} container put --rule "{rule}" {basic_acl}'
|
||||
logger.info("Cmd: %s" % createContainerCmd)
|
||||
complProc = subprocess.run(createContainerCmd, check=True, universal_newlines=True,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=150, shell=True)
|
||||
output = complProc.stdout
|
||||
|
@ -432,7 +486,7 @@ def _get_storage_nodes(private_key: bytes):
|
|||
|
||||
|
||||
def _search_object(node:str, private_key: bytes, cid:str, oid: str):
|
||||
Cmd = f'{CLI_PREFIX}neofs-cli --host {node} --key {binascii.hexlify(private_key).decode()} object search --root --cid {cid} ID {oid} --ttl 1'
|
||||
Cmd = f'{CLI_PREFIX}neofs-cli --host {node} --ttl 1 --key {binascii.hexlify(private_key).decode()} object search --root --cid {cid} ID {oid}'
|
||||
complProc = subprocess.run(Cmd, check=True, universal_newlines=True,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=15, shell=True)
|
||||
logger.info(Cmd)
|
||||
|
|
229
robot/testsuites/integration/acl_basic.robot
Normal file
229
robot/testsuites/integration/acl_basic.robot
Normal file
|
@ -0,0 +1,229 @@
|
|||
*** Settings ***
|
||||
Variables ../../variables/common.py
|
||||
|
||||
|
||||
Library ${RESOURCES}/environment.py
|
||||
Library ${RESOURCES}/neo.py
|
||||
Library ${RESOURCES}/neofs.py
|
||||
Library ${RESOURCES}/payment.py
|
||||
Library ${RESOURCES}/assertions.py
|
||||
Library ${RESOURCES}/neo.py
|
||||
|
||||
|
||||
*** Test cases ***
|
||||
Basic ACL Operations
|
||||
[Documentation] Testcase to validate NeoFS operations with ACL.
|
||||
[Tags] ACL NeoFS NeoCLI
|
||||
[Timeout] 20 min
|
||||
|
||||
Generate Keys
|
||||
Create Containers
|
||||
Generate file
|
||||
Check Private Container
|
||||
Check Public Container
|
||||
Check Read-Only Container
|
||||
|
||||
|
||||
|
||||
*** Keywords ***
|
||||
|
||||
Generate Keys
|
||||
${USER_KEY_GEN} = Generate Neo private key
|
||||
${OTHER_KEY_GEN} = Generate Neo private key
|
||||
${SYSTEM_KEY_GEN} = Form Privkey from String c428b4a06f166fde9f8afcf918194acdde35aa2612ecf42fe0c94273425ded21
|
||||
|
||||
Set Global Variable ${USER_KEY} ${USER_KEY_GEN}
|
||||
Set Global Variable ${OTHER_KEY} ${OTHER_KEY_GEN}
|
||||
Set Global Variable ${SYSTEM_KEY} ${SYSTEM_KEY_GEN}
|
||||
|
||||
# Basic ACL manual page: https://neospcc.atlassian.net/wiki/spaces/NEOF/pages/362348545/NeoFS+ACL
|
||||
# TODO: X - Sticky bit validation on public container!!!
|
||||
|
||||
Create Containers
|
||||
# Create containers:
|
||||
Log Create Private Container
|
||||
${PRIV_CID_GEN} = Create container ${USER_KEY} 0x1C8C8CCC
|
||||
Container Existing ${USER_KEY} ${PRIV_CID_GEN}
|
||||
|
||||
Log Create Public Container
|
||||
${PUBLIC_CID_GEN} = Create container ${USER_KEY} 0x3FFFFFFF
|
||||
Container Existing ${USER_KEY} ${PUBLIC_CID_GEN}
|
||||
|
||||
Log Create Read-Only Container
|
||||
${READONLY_CID_GEN} = Create container ${USER_KEY} 0x1FFFCCFF
|
||||
Container Existing ${USER_KEY} ${READONLY_CID_GEN}
|
||||
|
||||
Set Global Variable ${PRIV_CID} ${PRIV_CID_GEN}
|
||||
Set Global Variable ${PUBLIC_CID} ${PUBLIC_CID_GEN}
|
||||
Set Global Variable ${READONLY_CID} ${READONLY_CID_GEN}
|
||||
|
||||
|
||||
Generate file
|
||||
# Generate small file
|
||||
${FILE_S_GEN} = Generate file of bytes 1024
|
||||
${FILE_S_HASH_GEN} = Get file hash ${FILE_S_GEN}
|
||||
|
||||
Set Global Variable ${FILE_S} ${FILE_S_GEN}
|
||||
Set Global Variable ${FILE_S_HASH} ${FILE_S_HASH_GEN}
|
||||
|
||||
Check Private Container
|
||||
# Check Private:
|
||||
# Expected: User - pass, Other - fail, System(IR) - pass (+ System(Container node) - pass, Non-container node - fail).
|
||||
|
||||
# Put
|
||||
${S_OID_USER} = Put object to NeoFS ${USER_KEY} ${FILE_S} ${PRIV_CID}
|
||||
Run Keyword And Expect Error *
|
||||
... Put object to NeoFS ${OTHER_KEY} ${FILE_S} ${PRIV_CID}
|
||||
Run Keyword And Expect Error *
|
||||
... Put object to NeoFS ${SYSTEM_KEY} ${FILE_S} ${PRIV_CID}
|
||||
|
||||
|
||||
# Get
|
||||
Get object from NeoFS ${USER_KEY} ${PRIV_CID} ${S_OID_USER} s_file_read
|
||||
Run Keyword And Expect Error *
|
||||
... Get object from NeoFS ${OTHER_KEY} ${PRIV_CID} ${S_OID_USER} s_file_read
|
||||
Run Keyword And Expect Error *
|
||||
... Get object from NeoFS ${SYSTEM_KEY} ${PRIV_CID} ${S_OID_USER} s_file_read
|
||||
|
||||
# Get Range
|
||||
Get Range ${USER_KEY} ${PRIV_CID} ${S_OID_USER} 0:256
|
||||
Run Keyword And Expect Error *
|
||||
... Get Range ${OTHER_KEY} ${PRIV_CID} ${S_OID_USER} 0:256
|
||||
Run Keyword And Expect Error *
|
||||
... Get Range ${SYSTEM_KEY} ${PRIV_CID} ${S_OID_USER} 0:256
|
||||
|
||||
# TODO: GetRangeHash
|
||||
# get-range-hash --cid <cid> --oid <oid> [--bearer <hex>] [--verify --file </path/to/file>] [--salt <hex>] [<offset1>:<length1> [...]]
|
||||
# neospcc@neospcc:~/GIT/neofs-testcases$ docker exec neofs-cli neofs-cli --host 192.168.123.71:8080 --key 0fa21a94be2227916284e4b3495180d9c93d04f095fe9d5a86f22044f5c411d2 object get-range-hash --cid 4H9iChvzYdBg6qntfYUWGWCzsJFBDdo99KegefsD721Q --oid a101d078-b3d4-4325-8fe8-41dce6917097
|
||||
# invalid input
|
||||
# Usage: get-range-hash --cid <cid> --oid <oid> [--bearer <hex>] [--verify --file </path/to/file>] [--salt <hex>] [<offset1>:<length1> [...]]
|
||||
|
||||
|
||||
# Search
|
||||
@{S_OBJ_PRIV} = Create List ${S_OID_USER}
|
||||
Search object ${USER_KEY} ${PRIV_CID} ${EMPTY} @{S_OBJ_PRIV}
|
||||
Run Keyword And Expect Error *
|
||||
... Search object ${OTHER_KEY} ${PRIV_CID} ${EMPTY} @{S_OBJ_PRIV}
|
||||
Search object ${SYSTEM_KEY} ${PRIV_CID} ${EMPTY} @{S_OBJ_PRIV}
|
||||
|
||||
|
||||
# Head
|
||||
Head object ${USER_KEY} ${PRIV_CID} ${S_OBJ_PRIV} ${True}
|
||||
Run Keyword And Expect Error *
|
||||
... Head object ${OTHER_KEY} ${PRIV_CID} ${S_OBJ_PRIV} ${True}
|
||||
Head object ${SYSTEM_KEY} ${PRIV_CID} ${S_OBJ_PRIV} ${True}
|
||||
|
||||
|
||||
# Delete
|
||||
Delete object ${USER_KEY} ${PRIV_CID} ${S_OID_USER}
|
||||
Run Keyword And Expect Error *
|
||||
... Delete object ${OTHER_KEY} ${PRIV_CID} ${S_OID_USER}
|
||||
Run Keyword And Expect Error *
|
||||
... Delete object ${SYSTEM_KEY} ${PRIV_CID} ${S_OID_USER}
|
||||
|
||||
|
||||
|
||||
Check Public Container
|
||||
# Check Public:
|
||||
# Expected: User - pass, Other - fail, System(IR) - pass (+ System(Container node) - pass, Non-container node - fail).
|
||||
|
||||
# Put
|
||||
${S_OID_USER} = Put object to NeoFS ${USER_KEY} ${FILE_S} ${PUBLIC_CID}
|
||||
${S_OID_OTHER} = Put object to NeoFS ${OTHER_KEY} ${FILE_S} ${PUBLIC_CID}
|
||||
# By discussion, IR can not make any operations instead of HEAD, SEARCH and GET RANGE HASH at the current moment
|
||||
Run Keyword And Expect Error *
|
||||
... Put object to NeoFS ${SYSTEM_KEY} ${FILE_S} ${PUBLIC_CID}
|
||||
|
||||
# Get
|
||||
Get object from NeoFS ${USER_KEY} ${PUBLIC_CID} ${S_OID_USER} s_file_read
|
||||
Get object from NeoFS ${OTHER_KEY} ${PUBLIC_CID} ${S_OID_USER} s_file_read
|
||||
# By discussion, IR can not make any operations instead of HEAD, SEARCH and GET RANGE HASH at the current moment
|
||||
Run Keyword And Expect Error *
|
||||
... Get object from NeoFS ${SYSTEM_KEY} ${PUBLIC_CID} ${S_OID_USER} s_file_read
|
||||
|
||||
# Get Range
|
||||
Get Range ${USER_KEY} ${PUBLIC_CID} ${S_OID_USER} 0:256
|
||||
Get Range ${OTHER_KEY} ${PUBLIC_CID} ${S_OID_USER} 0:256
|
||||
# By discussion, IR can not make any operations instead of HEAD, SEARCH and GET RANGE HASH at the current moment
|
||||
Run Keyword And Expect Error *
|
||||
... Get Range ${SYSTEM_KEY} ${PUBLIC_CID} ${S_OID_USER} 0:256
|
||||
|
||||
# TODO: GetRangeHash
|
||||
# get-range-hash --cid <cid> --oid <oid> [--bearer <hex>] [--verify --file </path/to/file>] [--salt <hex>] [<offset1>:<length1> [...]]
|
||||
# neospcc@neospcc:~/GIT/neofs-testcases$ docker exec neofs-cli neofs-cli --host 192.168.123.71:8080 --key 0fa21a94be2227916284e4b3495180d9c93d04f095fe9d5a86f22044f5c411d2 object get-range-hash --cid 4H9iChvzYdBg6qntfYUWGWCzsJFBDdo99KegefsD721Q --oid a101d078-b3d4-4325-8fe8-41dce6917097
|
||||
# invalid input
|
||||
# Usage: get-range-hash --cid <cid> --oid <oid> [--bearer <hex>] [--verify --file </path/to/file>] [--salt <hex>] [<offset1>:<length1> [...]]
|
||||
|
||||
|
||||
# Search
|
||||
@{S_OBJ_PRIV} = Create List ${S_OID_USER} ${S_OID_OTHER}
|
||||
Search object ${USER_KEY} ${PUBLIC_CID} ${EMPTY} @{S_OBJ_PRIV}
|
||||
Search object ${OTHER_KEY} ${PUBLIC_CID} ${EMPTY} @{S_OBJ_PRIV}
|
||||
Search object ${SYSTEM_KEY} ${PUBLIC_CID} ${EMPTY} @{S_OBJ_PRIV}
|
||||
|
||||
|
||||
# Head
|
||||
Head object ${USER_KEY} ${PUBLIC_CID} ${S_OID_USER} ${True}
|
||||
Head object ${OTHER_KEY} ${PUBLIC_CID} ${S_OID_USER} ${True}
|
||||
Head object ${SYSTEM_KEY} ${PUBLIC_CID} ${S_OID_USER} ${True}
|
||||
|
||||
Head object ${USER_KEY} ${PUBLIC_CID} ${S_OID_OTHER} ${True}
|
||||
Head object ${OTHER_KEY} ${PUBLIC_CID} ${S_OID_OTHER} ${True}
|
||||
Head object ${SYSTEM_KEY} ${PUBLIC_CID} ${S_OID_OTHER} ${True}
|
||||
|
||||
# Delete
|
||||
Delete object ${USER_KEY} ${PUBLIC_CID} ${S_OID_USER}
|
||||
Delete object ${OTHER_KEY} ${PUBLIC_CID} ${S_OID_USER}
|
||||
Run Keyword And Expect Error *
|
||||
... Delete object ${SYSTEM_KEY} ${PUBLIC_CID} ${S_OID_USER}
|
||||
|
||||
|
||||
Check Read-Only Container
|
||||
# Check Read Only container:
|
||||
|
||||
# Put
|
||||
${S_OID_USER} = Put object to NeoFS ${USER_KEY} ${FILE_S} ${READONLY_CID}
|
||||
Run Keyword And Expect Error *
|
||||
... Put object to NeoFS ${OTHER_KEY} ${FILE_S} ${READONLY_CID}
|
||||
Run Keyword And Expect Error *
|
||||
... Put object to NeoFS ${SYSTEM_KEY} ${FILE_S} ${READONLY_CID}
|
||||
|
||||
# Get
|
||||
Get object from NeoFS ${USER_KEY} ${READONLY_CID} ${S_OID_USER} s_file_read
|
||||
Get object from NeoFS ${OTHER_KEY} ${READONLY_CID} ${S_OID_USER} s_file_read
|
||||
# By discussion, IR can not make any operations instead of HEAD, SEARCH and GET RANGE HASH at the current moment
|
||||
Run Keyword And Expect Error *
|
||||
... Get object from NeoFS ${SYSTEM_KEY} ${READONLY_CID} ${S_OID_USER} s_file_read
|
||||
|
||||
# Get Range
|
||||
Get Range ${USER_KEY} ${READONLY_CID} ${S_OID_USER} 0:256
|
||||
Get Range ${OTHER_KEY} ${READONLY_CID} ${S_OID_USER} 0:256
|
||||
# By discussion, IR can not make any operations instead of HEAD, SEARCH and GET RANGE HASH at the current moment
|
||||
Run Keyword And Expect Error *
|
||||
... Get Range ${SYSTEM_KEY} ${READONLY_CID} ${S_OID_USER} 0:256
|
||||
|
||||
# TODO: GetRangeHash
|
||||
# get-range-hash --cid <cid> --oid <oid> [--bearer <hex>] [--verify --file </path/to/file>] [--salt <hex>] [<offset1>:<length1> [...]]
|
||||
# neospcc@neospcc:~/GIT/neofs-testcases$ docker exec neofs-cli neofs-cli --host 192.168.123.71:8080 --key 0fa21a94be2227916284e4b3495180d9c93d04f095fe9d5a86f22044f5c411d2 object get-range-hash --cid 4H9iChvzYdBg6qntfYUWGWCzsJFBDdo99KegefsD721Q --oid a101d078-b3d4-4325-8fe8-41dce6917097
|
||||
# invalid input
|
||||
# Usage: get-range-hash --cid <cid> --oid <oid> [--bearer <hex>] [--verify --file </path/to/file>] [--salt <hex>] [<offset1>:<length1> [...]]
|
||||
|
||||
|
||||
# Search
|
||||
@{S_OBJ_RO} = Create List ${S_OID_USER}
|
||||
Search object ${USER_KEY} ${READONLY_CID} ${EMPTY} @{S_OBJ_RO}
|
||||
Search object ${OTHER_KEY} ${READONLY_CID} ${EMPTY} @{S_OBJ_RO}
|
||||
Search object ${SYSTEM_KEY} ${READONLY_CID} ${EMPTY} @{S_OBJ_RO}
|
||||
|
||||
|
||||
# Head
|
||||
Head object ${USER_KEY} ${READONLY_CID} ${S_OID_USER} ${True}
|
||||
Head object ${OTHER_KEY} ${READONLY_CID} ${S_OID_USER} ${True}
|
||||
Head object ${SYSTEM_KEY} ${READONLY_CID} ${S_OID_USER} ${True}
|
||||
|
||||
# Delete
|
||||
Delete object ${USER_KEY} ${READONLY_CID} ${S_OID_USER}
|
||||
Run Keyword And Expect Error *
|
||||
... Delete object ${OTHER_KEY} ${READONLY_CID} ${S_OID_USER}
|
||||
Run Keyword And Expect Error *
|
||||
... Delete object ${SYSTEM_KEY} ${READONLY_CID} ${S_OID_USER}
|
|
@ -11,95 +11,7 @@ Library ${RESOURCES}/neo.py
|
|||
*** Variables ***
|
||||
&{FILE_USR_HEADER} = key1=1 key2='abc'
|
||||
|
||||
|
||||
*** Test cases ***
|
||||
NeoFS Simple Object Operations
|
||||
[Documentation] Testcase to validate NeoFS operations with simple object.
|
||||
[Tags] Object NeoFS NeoCLI
|
||||
[Timeout] 20 min
|
||||
|
||||
${PRIV_KEY} = Generate Neo private key
|
||||
${PUB_KEY} = Get Neo public key ${PRIV_KEY}
|
||||
${ADDR} = Get Neo address ${PRIV_KEY}
|
||||
${TX} = Request NeoFS Deposit ${PUB_KEY}
|
||||
Wait Until Keyword Succeeds 1 min 15 sec
|
||||
... Transaction accepted in block ${TX}
|
||||
Get Transaction ${TX}
|
||||
# Due to develop branch with zero-payment for container and different blockchains for payment.
|
||||
# Temporarily removed.
|
||||
# ${BALANCE} = Wait Until Keyword Succeeds 10 min 1 min
|
||||
# ... Get Balance ${PUB_KEY}
|
||||
# Expected Balance ${PUB_KEY} 0 50
|
||||
${CID} = Create container ${PRIV_KEY}
|
||||
Container Existing ${PRIV_KEY} ${CID}
|
||||
# Due to develop branch with zero-payment for container and different blockchains for payment.
|
||||
# Fail will be ignored temporarily. Temporarily removed.
|
||||
# Run Keyword And Ignore Error
|
||||
# ... Wait Until Keyword Succeeds 2 min 30 sec
|
||||
# ... Expected Balance ${PUB_KEY} ${BALANCE} -0.00001424
|
||||
${FILE} = Generate file of bytes 1024
|
||||
${FILE_HASH} = Get file hash ${FILE}
|
||||
${S_OID} = Put object to NeoFS ${PRIV_KEY} ${FILE} ${CID}
|
||||
${H_OID} = Put object to NeoFS ${PRIV_KEY} ${FILE} ${CID} &{FILE_USR_HEADER}
|
||||
# Next keyword has been removed due to https://neospcc.atlassian.net/browse/NSPCC-1103
|
||||
# Validate storage policy for object ${PRIV_KEY} 2 ${CID} ${S_OID}
|
||||
${SGID} = Create storage group ${PRIV_KEY} ${CID} ${S_OID} ${H_OID}
|
||||
|
||||
@{S_OBJ_SG} = Create List ${SGID}
|
||||
@{S_OBJ_ALL} = Create List ${S_OID} ${H_OID} ${SGID}
|
||||
@{S_OBJ_H} = Create List ${H_OID}
|
||||
|
||||
Search object ${PRIV_KEY} ${CID} --sg @{S_OBJ_SG}
|
||||
Get storage group ${PRIV_KEY} ${CID} ${SGID}
|
||||
Get object from NeoFS ${PRIV_KEY} ${CID} ${S_OID} s_file_read
|
||||
Get object from NeoFS ${PRIV_KEY} ${CID} ${S_OID} h_file_read
|
||||
Search object ${PRIV_KEY} ${CID} ${EMPTY} @{S_OBJ_ALL}
|
||||
Search object ${PRIV_KEY} ${CID} ${EMPTY} @{S_OBJ_H} &{FILE_USR_HEADER}
|
||||
Head object ${PRIV_KEY} ${CID} ${S_OID} ${True}
|
||||
Head object ${PRIV_KEY} ${CID} ${H_OID} ${True} &{FILE_USR_HEADER}
|
||||
|
||||
Run Keyword And Expect Error REGEXP:User header (\\w+=\\w+\\s?)+ was not found
|
||||
... Head object ${PRIV_KEY} ${CID} ${H_OID} ${False} &{FILE_USR_HEADER}
|
||||
|
||||
Verify file hash s_file_read ${FILE_HASH}
|
||||
Verify file hash h_file_read ${FILE_HASH}
|
||||
&{ID_OBJ_S} = Create Dictionary ID=${S_OID}
|
||||
Delete object ${PRIV_KEY} ${CID} ${S_OID}
|
||||
Verify Head tombstone ${PRIV_KEY} ${CID} ${S_OID}
|
||||
# Removed due to tombstones zombies.
|
||||
# Wait Until Keyword Succeeds 2 min 30 sec
|
||||
# ... Search object ${PRIV_KEY} ${CID} ${EMPTY} @{EMPTY} &{ID_OBJ_S}
|
||||
# Run Keyword And Expect Error *
|
||||
# ... Get object from NeoFS ${PRIV_KEY} ${CID} ${S_OID} s_file_read_2
|
||||
&{ID_OBJ_H} = Create Dictionary ID=${H_OID}
|
||||
Delete object ${PRIV_KEY} ${CID} ${H_OID}
|
||||
Verify Head tombstone ${PRIV_KEY} ${CID} ${H_OID}
|
||||
|
||||
# Removed due to tombstones zombies.
|
||||
# Search object ${PRIV_KEY} ${CID} ${EMPTY} @{EMPTY} &{FILE_USR_HEADER}
|
||||
# Wait Until Keyword Succeeds 2 min 30 sec
|
||||
# ... Search object ${PRIV_KEY} ${CID} ${EMPTY} @{EMPTY} &{ID_OBJ_H}
|
||||
# Run Keyword And Expect Error *
|
||||
# ... Get object from NeoFS ${PRIV_KEY} ${CID} ${H_OID} s_file_read_2
|
||||
|
||||
|
||||
&{SGID_OBJ} = Create Dictionary ID=${SGID}
|
||||
Delete object ${PRIV_KEY} ${CID} ${SGID}
|
||||
Verify Head tombstone ${PRIV_KEY} ${CID} ${SGID}
|
||||
# Removed due to tombstones zombies.
|
||||
# Search object ${PRIV_KEY} ${CID} --sg @{EMPTY}
|
||||
# Wait Until Keyword Succeeds 2 min 30 sec
|
||||
# ... Search object ${PRIV_KEY} ${CID} ${EMPTY} @{EMPTY} &{SGID_OBJ}
|
||||
# Run Keyword And Expect Error *
|
||||
# ... Get object from NeoFS ${PRIV_KEY} ${CID} ${SGID} s_file_read_2
|
||||
|
||||
Cleanup File ${FILE}
|
||||
Cleanup File s_file_read
|
||||
Cleanup File h_file_read
|
||||
Run Keyword And Expect Error Error: 's_file_read_2' file not found
|
||||
... Cleanup File s_file_read_2
|
||||
|
||||
|
||||
NeoFS Complex Object Operations
|
||||
[Documentation] Testcase to validate NeoFS operations with complex object.
|
||||
[Tags] Object NeoFS NeoCLI
|
101
robot/testsuites/integration/object_simple.robot
Normal file
101
robot/testsuites/integration/object_simple.robot
Normal file
|
@ -0,0 +1,101 @@
|
|||
*** Settings ***
|
||||
Variables ../../variables/common.py
|
||||
|
||||
Library ${RESOURCES}/environment.py
|
||||
Library ${RESOURCES}/neo.py
|
||||
Library ${RESOURCES}/neofs.py
|
||||
Library ${RESOURCES}/payment.py
|
||||
Library ${RESOURCES}/assertions.py
|
||||
Library ${RESOURCES}/neo.py
|
||||
|
||||
*** Variables ***
|
||||
&{FILE_USR_HEADER} = key1=1 key2='abc'
|
||||
|
||||
|
||||
*** Test cases ***
|
||||
NeoFS Simple Object Operations
|
||||
[Documentation] Testcase to validate NeoFS operations with simple object.
|
||||
[Tags] Object NeoFS NeoCLI
|
||||
[Timeout] 20 min
|
||||
|
||||
${PRIV_KEY} = Generate Neo private key
|
||||
${PUB_KEY} = Get Neo public key ${PRIV_KEY}
|
||||
${ADDR} = Get Neo address ${PRIV_KEY}
|
||||
${TX} = Request NeoFS Deposit ${PUB_KEY}
|
||||
Wait Until Keyword Succeeds 1 min 15 sec
|
||||
... Transaction accepted in block ${TX}
|
||||
Get Transaction ${TX}
|
||||
# Due to develop branch with zero-payment for container and different blockchains for payment.
|
||||
# Temporarily removed.
|
||||
# ${BALANCE} = Wait Until Keyword Succeeds 10 min 1 min
|
||||
# ... Get Balance ${PUB_KEY}
|
||||
# Expected Balance ${PUB_KEY} 0 50
|
||||
${CID} = Create container ${PRIV_KEY}
|
||||
Container Existing ${PRIV_KEY} ${CID}
|
||||
# Due to develop branch with zero-payment for container and different blockchains for payment.
|
||||
# Fail will be ignored temporarily. Temporarily removed.
|
||||
# Run Keyword And Ignore Error
|
||||
# ... Wait Until Keyword Succeeds 2 min 30 sec
|
||||
# ... Expected Balance ${PUB_KEY} ${BALANCE} -0.00001424
|
||||
${FILE} = Generate file of bytes 1024
|
||||
${FILE_HASH} = Get file hash ${FILE}
|
||||
${S_OID} = Put object to NeoFS ${PRIV_KEY} ${FILE} ${CID}
|
||||
${H_OID} = Put object to NeoFS ${PRIV_KEY} ${FILE} ${CID} &{FILE_USR_HEADER}
|
||||
|
||||
Validate storage policy for object ${PRIV_KEY} 2 ${CID} ${S_OID}
|
||||
${SGID} = Create storage group ${PRIV_KEY} ${CID} ${S_OID} ${H_OID}
|
||||
|
||||
@{S_OBJ_SG} = Create List ${SGID}
|
||||
@{S_OBJ_ALL} = Create List ${S_OID} ${H_OID} ${SGID}
|
||||
@{S_OBJ_H} = Create List ${H_OID}
|
||||
|
||||
Search object ${PRIV_KEY} ${CID} --sg @{S_OBJ_SG}
|
||||
Get storage group ${PRIV_KEY} ${CID} ${SGID}
|
||||
Get object from NeoFS ${PRIV_KEY} ${CID} ${S_OID} s_file_read
|
||||
Get object from NeoFS ${PRIV_KEY} ${CID} ${S_OID} h_file_read
|
||||
Search object ${PRIV_KEY} ${CID} ${EMPTY} @{S_OBJ_ALL}
|
||||
Search object ${PRIV_KEY} ${CID} ${EMPTY} @{S_OBJ_H} &{FILE_USR_HEADER}
|
||||
Head object ${PRIV_KEY} ${CID} ${S_OID} ${True}
|
||||
Head object ${PRIV_KEY} ${CID} ${H_OID} ${True} &{FILE_USR_HEADER}
|
||||
|
||||
Run Keyword And Expect Error REGEXP:User header (\\w+=\\w+\\s?)+ was not found
|
||||
... Head object ${PRIV_KEY} ${CID} ${H_OID} ${False} &{FILE_USR_HEADER}
|
||||
|
||||
Verify file hash s_file_read ${FILE_HASH}
|
||||
Verify file hash h_file_read ${FILE_HASH}
|
||||
&{ID_OBJ_S} = Create Dictionary ID=${S_OID}
|
||||
Delete object ${PRIV_KEY} ${CID} ${S_OID}
|
||||
Verify Head tombstone ${PRIV_KEY} ${CID} ${S_OID}
|
||||
# Removed due to tombstones zombies.
|
||||
# Wait Until Keyword Succeeds 2 min 30 sec
|
||||
# ... Search object ${PRIV_KEY} ${CID} ${EMPTY} @{EMPTY} &{ID_OBJ_S}
|
||||
# Run Keyword And Expect Error *
|
||||
# ... Get object from NeoFS ${PRIV_KEY} ${CID} ${S_OID} s_file_read_2
|
||||
&{ID_OBJ_H} = Create Dictionary ID=${H_OID}
|
||||
Delete object ${PRIV_KEY} ${CID} ${H_OID}
|
||||
Verify Head tombstone ${PRIV_KEY} ${CID} ${H_OID}
|
||||
|
||||
# Removed due to tombstones zombies.
|
||||
# Search object ${PRIV_KEY} ${CID} ${EMPTY} @{EMPTY} &{FILE_USR_HEADER}
|
||||
# Wait Until Keyword Succeeds 2 min 30 sec
|
||||
# ... Search object ${PRIV_KEY} ${CID} ${EMPTY} @{EMPTY} &{ID_OBJ_H}
|
||||
# Run Keyword And Expect Error *
|
||||
# ... Get object from NeoFS ${PRIV_KEY} ${CID} ${H_OID} s_file_read_2
|
||||
|
||||
|
||||
&{SGID_OBJ} = Create Dictionary ID=${SGID}
|
||||
Delete object ${PRIV_KEY} ${CID} ${SGID}
|
||||
Verify Head tombstone ${PRIV_KEY} ${CID} ${SGID}
|
||||
# Removed due to tombstones zombies.
|
||||
# Search object ${PRIV_KEY} ${CID} --sg @{EMPTY}
|
||||
# Wait Until Keyword Succeeds 2 min 30 sec
|
||||
# ... Search object ${PRIV_KEY} ${CID} ${EMPTY} @{EMPTY} &{SGID_OBJ}
|
||||
# Run Keyword And Expect Error *
|
||||
# ... Get object from NeoFS ${PRIV_KEY} ${CID} ${SGID} s_file_read_2
|
||||
|
||||
Cleanup File ${FILE}
|
||||
Cleanup File s_file_read
|
||||
Cleanup File h_file_read
|
||||
Run Keyword And Expect Error Error: 's_file_read_2' file not found
|
||||
... Cleanup File s_file_read_2
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
*** Settings ***
|
||||
Variables ../../variables/common.py
|
||||
|
||||
Library ${RESOURCES}/neofs.py
|
||||
Library ${RESOURCES}/assertions.py
|
||||
|
||||
*** Variables ***
|
||||
${OBJECT} ${ABSOLUTE_FILE_PATH}/test_file
|
||||
${READ_OBJECT} ${ABSOLUTE_FILE_PATH}/read_file
|
||||
|
||||
*** Test cases ***
|
||||
Read and Write to NeoFS
|
||||
${CID} = Create container
|
||||
${OID} = Write object to NeoFS ${OBJECT} ${CID}
|
||||
Read object from NeoFS ${CID} ${OID} ${READ_OBJECT}
|
||||
Should Be Equal as Binaries ${OBJECT} ${READ_OBJECT}
|
|
@ -1 +0,0 @@
|
|||
123
|
Loading…
Reference in a new issue