diff --git a/robot/resources/lib/python/cli_helpers.py b/robot/resources/lib/python/cli_helpers.py index 3bf1e1b..ef604f1 100644 --- a/robot/resources/lib/python/cli_helpers.py +++ b/robot/resources/lib/python/cli_helpers.py @@ -27,12 +27,17 @@ def _cmd_run(cmd, timeout=30): return output except subprocess.CalledProcessError as exc: 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): - p = pexpect.spawn(cmd) - p.expect(".*") - p.sendline('\r') - p.wait() - cmd = p.read() + child = pexpect.spawn(cmd) + child.expect(".*") + child.sendline('\r') + child.wait() + cmd = child.read() return cmd.decode() diff --git a/robot/resources/lib/python/utility_keywords.py b/robot/resources/lib/python/utility_keywords.py index b45e2c4..6a5c2c1 100644 --- a/robot/resources/lib/python/utility_keywords.py +++ b/robot/resources/lib/python/utility_keywords.py @@ -6,11 +6,11 @@ import uuid import docker 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 import logger from robot.libraries.BuiltIn import BuiltIn -from common import * -from cli_helpers import _cmd_run ROBOT_AUTO_KEYWORDS = False @@ -62,9 +62,11 @@ def make_up(services=['']): if services != ['']: for service in services: cmd = f'make up/{service}' - _cmd_run(cmd, timeout=80) + logger.info(f"Cmd: {cmd}") + _cmd_run(cmd) else: cmd = f'make up/basic; make update.max_object_size val={SIMPLE_OBJ_SIZE}' + logger.info(f"Cmd: {cmd}") _cmd_run(cmd, timeout=80) os.chdir(test_path) @@ -76,5 +78,6 @@ def make_down(): os.chdir(dev_path) cmd = 'make down; make clean' - _cmd_run(cmd) + logger.info(f"Cmd: {cmd}") + _cmd_run(cmd, timeout=60) os.chdir(test_path)