示例#1
0
def main_canaries_runner():
    """
    Intended to be the main entry point for running canaries.
    """

    with poplar_grpc():
        res = subprocess.run(get_program_args("genny-canaries"))
        res.check_returncode()
示例#2
0
def _run_command_with_sentinel_report(cmd_func, checker_func=None):
    # This can only be imported after the setup script has installed gennylib.
    from gennylib.genny_runner import poplar_grpc

    sentinel_file = os.path.join(os.getcwd(), "build", "sentinel.junit.xml")

    with open(sentinel_file, "w") as f:
        f.write(_sentinel_report)

    with poplar_grpc():
        res = cmd_func()

    if checker_func:
        success = checker_func()
    else:
        success = res.returncode == 0

    if success:
        logging.debug("Test succeeded, removing sentinel report")
        os.remove(sentinel_file)
    else:
        logging.debug("Test failed, leaving sentinel report in place")