[#171] make up: Error report

Signed-off-by: Elizaveta Chichindaeva <elizaveta@nspcc.ru>
This commit is contained in:
Elizaveta Chichindaeva 2022-02-07 14:41:34 +03:00
parent e7dde52a31
commit f3fc070cc9
2 changed files with 18 additions and 10 deletions

View file

@ -27,12 +27,17 @@ def _cmd_run(cmd, timeout=30):
return output return output
except subprocess.CalledProcessError as exc: except subprocess.CalledProcessError as exc:
raise RuntimeError(f"Error:\nreturn code: {exc.returncode} " raise RuntimeError(f"Error:\nreturn code: {exc.returncode} "
f"\nOutput: {exc.output}") from exc f"\nOutput: {exc.output}") from exc
except Exception as exc:
return_code, _ = subprocess.getstatusoutput(cmd)
logger.info(f"Error:\nreturn code: {return_code}\nOutput: "
f"{exc.output.decode('utf-8') if type(exc.output) is bytes else exc.output}")
raise
def _run_with_passwd(cmd): def _run_with_passwd(cmd):
p = pexpect.spawn(cmd) child = pexpect.spawn(cmd)
p.expect(".*") child.expect(".*")
p.sendline('\r') child.sendline('\r')
p.wait() child.wait()
cmd = p.read() cmd = child.read()
return cmd.decode() return cmd.decode()

View file

@ -6,11 +6,11 @@ import uuid
import docker import docker
from neo3 import wallet from neo3 import wallet
from common import SIMPLE_OBJ_SIZE, ASSETS_DIR
from cli_helpers import _cmd_run
from robot.api.deco import keyword from robot.api.deco import keyword
from robot.api import logger from robot.api import logger
from robot.libraries.BuiltIn import BuiltIn from robot.libraries.BuiltIn import BuiltIn
from common import *
from cli_helpers import _cmd_run
ROBOT_AUTO_KEYWORDS = False ROBOT_AUTO_KEYWORDS = False
@ -62,9 +62,11 @@ def make_up(services=['']):
if services != ['']: if services != ['']:
for service in services: for service in services:
cmd = f'make up/{service}' cmd = f'make up/{service}'
_cmd_run(cmd, timeout=80) logger.info(f"Cmd: {cmd}")
_cmd_run(cmd)
else: else:
cmd = f'make up/basic; make update.max_object_size val={SIMPLE_OBJ_SIZE}' cmd = f'make up/basic; make update.max_object_size val={SIMPLE_OBJ_SIZE}'
logger.info(f"Cmd: {cmd}")
_cmd_run(cmd, timeout=80) _cmd_run(cmd, timeout=80)
os.chdir(test_path) os.chdir(test_path)
@ -76,5 +78,6 @@ def make_down():
os.chdir(dev_path) os.chdir(dev_path)
cmd = 'make down; make clean' cmd = 'make down; make clean'
_cmd_run(cmd) logger.info(f"Cmd: {cmd}")
_cmd_run(cmd, timeout=60)
os.chdir(test_path) os.chdir(test_path)