forked from TrueCloudLab/frostfs-testcases
[#163] Setup and Teardown restart dev-env
Signed-off-by: Elizaveta Chichindaeva <elizaveta@nspcc.ru>
This commit is contained in:
parent
bd9507a19e
commit
0d86352cbe
7 changed files with 49 additions and 13 deletions
|
@ -42,10 +42,8 @@ Test cases are designed to run on Python 3.8.
|
|||
|
||||
## Run
|
||||
|
||||
Execute `./run.sh` script. It will run all the tests available in this repo. To run an arbitrary UserScenario or testcase(s), you need to run the command:
|
||||
`./run.sh robot/testsuites/integration/<UserScenario>` or `./run.sh robot/testsuites/integration/<UserScenario>/<testcase>.robot`
|
||||
|
||||
Logs will be saved in the artifacts/ directory after tests with any of the statuses are completed.
|
||||
To run an arbitrary UserScenario or testcase, you need to run the command:
|
||||
`robot --outputdir artifacts/ robot/testsuites/integration/<UserScenario>` or `robot --outputdir artifacts/ robot/testsuites/integration/<UserScenario>/<testcase>.robot`
|
||||
|
||||
The following UserScenarios and testcases are available for execution:
|
||||
|
||||
|
|
|
@ -13,14 +13,14 @@ from robot.api import logger
|
|||
ROBOT_AUTO_KEYWORDS = False
|
||||
|
||||
|
||||
def _cmd_run(cmd):
|
||||
def _cmd_run(cmd, timeout=30):
|
||||
"""
|
||||
Runs given shell command <cmd>, in case of success returns its stdout,
|
||||
in case of failure returns error message.
|
||||
"""
|
||||
try:
|
||||
compl_proc = subprocess.run(cmd, check=True, universal_newlines=True,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, timeout=30,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, timeout=timeout,
|
||||
shell=True)
|
||||
output = compl_proc.stdout
|
||||
logger.info(f"Output: {output}")
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
#!/usr/bin/python3.8
|
||||
|
||||
import docker
|
||||
import os
|
||||
import tarfile
|
||||
import uuid
|
||||
import docker
|
||||
|
||||
from neo3 import wallet
|
||||
from robot.api.deco import keyword
|
||||
from robot.api import logger
|
||||
from robot.libraries.BuiltIn import BuiltIn
|
||||
|
||||
from common import *
|
||||
from cli_helpers import _cmd_run
|
||||
|
||||
|
||||
ROBOT_AUTO_KEYWORDS = False
|
||||
|
||||
|
@ -48,6 +49,32 @@ def get_container_logs(testcase_name: str) -> None:
|
|||
def wif_to_binary(wif: str) -> str:
|
||||
priv_key = wallet.Account.private_key_from_wif(wif)
|
||||
path = f"{os.getcwd()}/{ASSETS_DIR}/{str(uuid.uuid4())}"
|
||||
with open(path, "wb") as f:
|
||||
f.write(priv_key)
|
||||
with open(path, "wb") as out:
|
||||
out.write(priv_key)
|
||||
return path
|
||||
|
||||
@keyword('Make Up')
|
||||
def make_up(services=['']):
|
||||
test_path = os.getcwd()
|
||||
dev_path = os.getenv('DEVENV_PATH', '../neofs-dev-env')
|
||||
os.chdir(dev_path)
|
||||
|
||||
if services != ['']:
|
||||
for service in services:
|
||||
cmd = f'make up/{service}'
|
||||
_cmd_run(cmd, timeout=80)
|
||||
else:
|
||||
cmd = f'make up/basic; make update.max_object_size val={SIMPLE_OBJ_SIZE}'
|
||||
_cmd_run(cmd, timeout=80)
|
||||
|
||||
os.chdir(test_path)
|
||||
|
||||
@keyword('Make Down')
|
||||
def make_down():
|
||||
test_path = os.getcwd()
|
||||
dev_path = os.getenv('DEVENV_PATH', '../neofs-dev-env')
|
||||
os.chdir(dev_path)
|
||||
|
||||
cmd = 'make down; make clean'
|
||||
_cmd_run(cmd)
|
||||
os.chdir(test_path)
|
||||
|
|
|
@ -7,9 +7,12 @@ Library utility_keywords.py
|
|||
*** Keywords ***
|
||||
|
||||
Setup
|
||||
[Arguments]
|
||||
Make Up
|
||||
Create Directory ${ASSETS_DIR}
|
||||
|
||||
Teardown
|
||||
[Arguments] ${LOGFILE}
|
||||
Remove Directory ${ASSETS_DIR} True
|
||||
Get Docker Logs ${LOGFILE}
|
||||
Make Down
|
||||
|
|
|
@ -7,6 +7,7 @@ Library payment_neogo.py
|
|||
Library gates.py
|
||||
Library wallet_keywords.py
|
||||
Library rpc_call_keywords.py
|
||||
Library utility_keywords.py
|
||||
|
||||
Resource payment_operations.robot
|
||||
Resource setup_teardown.robot
|
||||
|
@ -16,6 +17,7 @@ ${PLACEMENT_RULE} = REP 1 IN X CBF 1 SELECT 1 FROM * AS X
|
|||
${TRANSFER_AMOUNT} = ${6}
|
||||
${DEPOSIT_AMOUNT} = ${5}
|
||||
${CONTAINER_WAIT_INTERVAL} = 1 min
|
||||
@{INCLUDE_SVC} = http_gate
|
||||
|
||||
*** Test cases ***
|
||||
|
||||
|
@ -24,6 +26,7 @@ NeoFS HTTP Gateway
|
|||
[Timeout] 5 min
|
||||
|
||||
[Setup] Setup
|
||||
Make Up ${INCLUDE_SVC}
|
||||
|
||||
${WALLET} ${ADDR} ${WIF} = Prepare Wallet And Deposit
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ Resource payment_operations.robot
|
|||
${DEPOSIT} = ${30}
|
||||
${WIF} = ${MAINNET_WALLET_WIF}
|
||||
${DEPOSIT_TIMEOUT}= 30s
|
||||
@{INCLUDE_SVC} = s3_gate
|
||||
|
||||
*** Test cases ***
|
||||
Buckets in NeoFS S3 Gateway
|
||||
|
@ -23,6 +24,7 @@ Buckets in NeoFS S3 Gateway
|
|||
[Timeout] 10 min
|
||||
|
||||
[Setup] Setup
|
||||
Make Up ${INCLUDE_SVC}
|
||||
|
||||
${WALLET} ${ADDR} ${WIF} = Prepare Wallet And Deposit
|
||||
${FILE_S3} = Generate file of bytes ${COMPLEX_OBJ_SIZE}
|
||||
|
|
|
@ -7,12 +7,14 @@ Library payment_neogo.py
|
|||
Library gates.py
|
||||
Library wallet_keywords.py
|
||||
Library contract_keywords.py
|
||||
Library utility_keywords.py
|
||||
|
||||
Resource setup_teardown.robot
|
||||
|
||||
*** Variables ***
|
||||
${DEPOSIT_AMOUNT} = ${5}
|
||||
${WIF} = ${MAINNET_WALLET_WIF}
|
||||
@{INCLUDE_SVC} = s3_gate
|
||||
|
||||
*** Test cases ***
|
||||
Objects in NeoFS S3 Gateway
|
||||
|
@ -21,6 +23,7 @@ Objects in NeoFS S3 Gateway
|
|||
[Timeout] 10 min
|
||||
|
||||
[Setup] Setup
|
||||
Make Up ${INCLUDE_SVC}
|
||||
|
||||
${WALLET} ${ADDR} = Init Wallet from WIF ${ASSETS_DIR} ${WIF}
|
||||
${TX_DEPOSIT} = NeoFS Deposit ${WIF} ${DEPOSIT_AMOUNT}
|
||||
|
|
Loading…
Reference in a new issue