Exemplo n.º 1
0
def _check_kedroviz_running(context):
    """
    Check that a service is running and responding appropriately

    Args:
        context (behave.runner.Context): Test context
    """
    data_json = json.loads(download_url("http://localhost:4141/api/nodes.json"))
    try:
        assert context.result.poll() is None
        assert "predict" in data_json["nodes"][0]["full_name"]
    finally:
        context.result.terminate()
Exemplo n.º 2
0
def _check_kedroviz_running(context):
    """
    Check that a service is running and responding appropriately

    Args:
        context (behave.runner.Context): Test context
    """
    data_json = json.loads(download_url("http://localhost:4141/api/main"))
    try:
        assert context.result.poll() is None
        assert ("example_iris_data" == sorted(
            data_json["nodes"], key=lambda i: i["full_name"])[0]["full_name"])
    finally:
        context.result.terminate()
Exemplo n.º 3
0
def _check_service_up(context):
    """
    Check that a service is running and responding appropriately

    Args:
        context (behave.runner.Context): Test context
    """
    data_json = json.loads(
        download_url("http://localhost:4141/logs/nodes.json"))

    try:
        assert context.result.poll() is None
        assert "example_iris_data" in data_json[0]["inputs"]
    finally:
        context.result.terminate()
Exemplo n.º 4
0
def _check_service_up(context):
    """
    Check that a service is running and responding appropriately

    Args:
        context (behave.runner.Context): Test context
    """
    data_json = json.loads(
        download_url("http://localhost:4141/api/nodes.json"))

    try:
        assert context.result.poll() is None
        assert (
            data_json["snapshots"][0]["nodes"][0]["full_name"] ==
            "predict([example_model,example_test_x]) -> [example_predictions]")
    finally:
        context.result.terminate()
Exemplo n.º 5
0
def _check_service_up(context: behave.runner.Context, url: str, string: str):
    """
    Check that a service is running and responding appropriately

    Args:
        context: Test context.
        url: Url that is to be read.
        string: The string to be checked.
    """
    data = download_url(url)

    try:
        assert context.result.poll() is None
        assert string in data
    finally:
        if "docker" in context.result.args:
            kill_docker_containers(context.project_name)
        else:
            context.result.terminate()