tests.system.openlineage.operator

Module Contents

Classes

OpenLineageTestOperator

This operator is added for system testing purposes.

Functions

any(result)

is_datetime(result)

is_uuid(result)

env_var(var[, default])

Use this jinja method to access the environment variable named 'var'.

not_match(result, pattern)

url_scheme_authority(url)

url_path(url)

setup_jinja()

match(expected, result, env)

Check if result is "equal" to expected value.

Attributes

log

tests.system.openlineage.operator.log[source]
tests.system.openlineage.operator.any(result)[source]
tests.system.openlineage.operator.is_datetime(result)[source]
tests.system.openlineage.operator.is_uuid(result)[source]
tests.system.openlineage.operator.env_var(var, default=None)[source]

Use this jinja method to access the environment variable named ‘var’.

If there is no such environment variable set, return the default. If the default is None, raise an exception for an undefined variable.

tests.system.openlineage.operator.not_match(result, pattern)[source]
tests.system.openlineage.operator.url_scheme_authority(url)[source]
tests.system.openlineage.operator.url_path(url)[source]
tests.system.openlineage.operator.setup_jinja()[source]
tests.system.openlineage.operator.match(expected, result, env)[source]

Check if result is “equal” to expected value.

Omits keys not specified in expected value and resolves any jinja templates found.

class tests.system.openlineage.operator.OpenLineageTestOperator(event_templates=None, file_path=None, env=setup_jinja(), allow_duplicate_events=False, clear_variables=True, **kwargs)[source]

Bases: airflow.models.operator.BaseOperator

This operator is added for system testing purposes.

It compares expected event templates set on initialization with ones emitted by OpenLineage integration and stored in Variables by VariableTransport. :param event_templates: dictionary where key is the key used by VariableTransport in format of <DAG_ID>.<TASK_ID>.event.<EVENT_TYPE>, and value is event template (fragment) that need to be in received events. :param file_path: alternatively, file_path pointing to file with event templates will be used :param env: jinja environment used to render event templates :param allow_duplicate_events: if set to True, allows multiple events for the same key :param clear_variables: if set to True, clears all variables after checking events :raises: ValueError if the received events do not match with expected ones.

execute(context)[source]

Derive when creating an operator.

Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

Was this entry helpful?