コード例 #1
0
ファイル: test_docker.py プロジェクト: zhuohuwu0603/mlrun
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
ファイル: test_docker.py プロジェクト: rpatil524/mlrun
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
ファイル: test_httpdb.py プロジェクト: zhuohuwu0603/mlrun
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')