Update testcases for NeoFS 0.20.0 version and fix issues (#62)

* update testcases for NeoFS 0.20.0 version
* fix issues
This commit is contained in:
anatoly-bogatyrev 2021-05-26 17:14:46 +03:00 committed by GitHub
parent 17047720fd
commit e0b0cbf823
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 21 deletions

View file

@ -320,7 +320,8 @@ def get_range(private_key: str, cid: str, oid: str, range_file: str, bearer: str
def create_container(private_key: str, basic_acl:str, rule:str):
if rule == "":
logger.error("Cannot create container with empty placement rule")
if basic_acl != "":
if basic_acl:
basic_acl = f"--basic-acl {basic_acl}"
createContainerCmd = (

View file

@ -9,6 +9,11 @@ import requests
import json
import os
import tarfile
import sys
sys.path.insert(0,'../neofs-keywords')
import converters
import wallet
from robot.api.deco import keyword
from robot.api import logger
@ -29,7 +34,7 @@ def withdraw_mainnet_gas(wallet: str, address: str, scripthash: str, amount: int
cmd = (
f"{NEOGO_CLI_EXEC} contract invokefunction -w {wallet} -a {address} "
f"-r {NEO_MAINNET_ENDPOINT} {NEOFS_CONTRACT} withdraw {scripthash} "
f"int:{amount} -- {scripthash}"
f"int:{amount} -- {scripthash}:Global"
)
logger.info(f"Executing command: {cmd}")
@ -43,21 +48,19 @@ def withdraw_mainnet_gas(wallet: str, address: str, scripthash: str, amount: int
@keyword('NeoFS Deposit')
def neofs_deposit(wallet: str, address: str, scripthash: str, amount: int, wallet_pass:str=''):
cmd = ( f"{NEOGO_CLI_EXEC} contract invokefunction -w {wallet} -a {address} "
f"-r {NEO_MAINNET_ENDPOINT} {NEOFS_CONTRACT} "
f"deposit {scripthash} int:{amount} bytes: -- {scripthash}")
def neofs_deposit(wallet_file: str, address: str, scripthash: str, amount: int, wallet_pass:str=''):
logger.info(f"Executing command: {cmd}")
out = _run_sh_with_passwd(wallet_pass, cmd)
logger.info(f"Command completed with output: {out}")
# 1) Get NeoFS contract address.
deposit_addr = converters.contract_hash_to_address(NEOFS_CONTRACT)
logger.info(f"deposit_addr: {deposit_addr}")
m = re.match(r'^Sent invocation transaction (\w{64})$', out)
if m is None:
# 2) Transfer GAS to the NeoFS contract address.
out = wallet.new_nep17_transfer(address, deposit_addr, amount, 'GAS', wallet_file, '', NEO_MAINNET_ENDPOINT)
if len(out) != 64:
raise Exception("Can not get Tx.")
tx = m.group(1)
return tx
return out
@keyword('Transaction accepted in block')
def transaction_accepted_in_block(tx_id):
@ -116,7 +119,7 @@ def get_balance(privkey: str):
balance = _get_balance_request(privkey)
return balance
return float(balance)
def _get_balance_request(privkey: str):

View file

@ -8,7 +8,7 @@ Library ${KEYWORDS}/wallet_keywords.py
Library ${KEYWORDS}/rpc_call_keywords.py
*** Variables ***
${PLACEMENT_RULE} = "REP 2 IN X CBF 1 SELECT 4 FROM * AS X"
${PLACEMENT_RULE} = REP 2 IN X CBF 1 SELECT 4 FROM * AS X
${TRANSFER_AMOUNT} = ${11}
*** Test cases ***
@ -34,7 +34,7 @@ NeoFS Object Replication
Wait Until Keyword Succeeds 1 min 15 sec
... Transaction accepted in block ${TX_DEPOSIT}
Get Transaction ${TX_DEPOSIT}
${CID} = Create container ${PRIV_KEY} ${EMPTY} ${PLACEMENT_RULE}
Container Existing ${PRIV_KEY} ${CID}

View file

@ -10,7 +10,6 @@ ${FILE_USR_HEADER_OTH} = key1=2
${UNEXIST_OID} = B2DKvkHnLnPvapbDgfpU1oVUPuXQo5LTfKVxmNDZXQff
${TRANSFER_AMOUNT} = 15
${DEPOSIT_AMOUNT} = 10
${EMPTY_ACL} = ""
*** Keywords ***
@ -37,11 +36,9 @@ Payment operations
Set Global Variable ${ADDR} ${ADDR}
Prepare container
${CID} = Create container ${PRIV_KEY} ${EMPTY_ACL} ${COMMON_PLACEMENT_RULE}
${CID} = Create container ${PRIV_KEY} ${EMPTY} ${COMMON_PLACEMENT_RULE}
Container Existing ${PRIV_KEY} ${CID}
Wait Until Keyword Succeeds ${NEOFS_EPOCH_TIMEOUT} ${MORPH_BLOCK_TIME}
${NEOFS_BALANCE} = Get NeoFS Balance ${PRIV_KEY}
Should Be True ${NEOFS_BALANCE} < ${DEPOSIT_AMOUNT}
${CONTAINER_FEE} = Evaluate ${DEPOSIT_AMOUNT} - ${NEOFS_BALANCE}

View file

@ -43,7 +43,7 @@ NEOFS_NETMAP = os.getenv("NEOFS_NETMAP", ['s01.neofs.devenv:8080', 's02.neofs.de
GAS_HASH = os.getenv("GAS_HASH", '0xd2a4cff31913016155e38e474a2c06d08be276cf')
NEOFS_CONTRACT = (os.getenv("NEOFS_CONTRACT") if os.getenv("NEOFS_CONTRACT")
else os.getenv("NEOFS_IR_CONTRACTS_NEOFS", 'cfe89912c457754b7eb1f89781dc74bb3e0070bf'))
else os.getenv("NEOFS_IR_CONTRACTS_NEOFS", '008b43d3de8741b896015f79ac0fbfa4055b4574'))
COMMON_PLACEMENT_RULE = "REP 2 IN X CBF 1 SELECT 2 FROM * AS X"