def test_data_in_marquez(wait_for_marquez, init_airflow_db):

    dag_id = "test_dag_v2"
    execution_date = "2019-02-01T00:00:00"
    namespace = "integration-test"

    c = MarquezClient(namespace_name=namespace)

    assert (trigger_dag(dag_id, execution_date))
    assert (check_dag_state(dag_id, execution_date))
    result = c.get_namespace(namespace)
    assert (result and result['name'] == namespace)

    expected_job = "test_dag_v2"
    result = c.get_job(expected_job)
    assert (result and result['name'] == expected_job)
def test_namespace_not_found(wait_for_marquez):
    c = MarquezClient(host=MARQUEZ_HOST, port=MARQUEZ_PORT)

    expected_namespace = "not_found"
    with pytest.raises(errors.APIError):
        c.get_namespace(expected_namespace)
def test_timeout(wait_for_marquez, broken_network):
    c = MarquezClient(host=MARQUEZ_HOST, port=MARQUEZ_PORT, timeout_ms=1)

    expected_namespace = "timeout_test"
    with pytest.raises(ReadTimeout):
        c.get_namespace(expected_namespace)
def test_bad_port(wait_for_marquez):
    c = MarquezClient(host=MARQUEZ_HOST, port="6000")
    with pytest.raises(requests.exceptions.ConnectionError) as e:
        c.get_namespace("no_connection")
    assert isinstance(e.value.args[0], MaxRetryError)