예제 #1
0
def test_docker():
    tag = f'mlrun/test-{uuid4().hex}'
    cid = None

    cmd = [
        'docker', 'build', '-f', 'dockerfiles/mlrun-api/Dockerfile', '-t', tag,
        '.'
    ]
    run(cmd, cwd=prj_dir, check=True)
    with clean_docker('rmi', tag):
        port = 8080
        cmd = ['docker', 'run', '--detach', '-p', f'{port}:{port}', tag]
        out = run(cmd, stdout=PIPE, check=True)
        cid = out.stdout.decode('utf-8').strip()
        with clean_docker('rm', cid):
            url = f'http://localhost:{port}/api/healthz'
            timeout = 30
            assert wait_for_server(url, timeout), \
                f'server failed to start after {timeout} seconds, url={url}'
예제 #2
0
def test_docker():
    tag = f"mlrun/test-{uuid4().hex}"
    cid = None

    cmd = [
        "docker", "build", "-f", "dockerfiles/mlrun-api/Dockerfile", "-t", tag,
        "."
    ]
    run(cmd, cwd=prj_dir, check=True)
    with clean_docker("rmi", tag):
        port = 8080
        cmd = ["docker", "run", "--detach", "-p", f"{port}:{port}", tag]
        out = run(cmd, stdout=PIPE, check=True)
        cid = out.stdout.decode("utf-8").strip()
        with clean_docker("rm", cid):
            url = f"http://localhost:{port}/api/healthz"
            timeout = 30
            assert wait_for_server(
                url, timeout
            ), f"server failed to start after {timeout} seconds, url={url}"
예제 #3
0
def check_server_up(url):
    health_url = f'{url}/api/healthz'
    timeout = 30
    if not wait_for_server(health_url, timeout):
        raise RuntimeError(f'server did not start after {timeout} sec')