Repository navigation
Add OpenLineage system tests for the emission policy - #75678
Conversation
|
@ramitkataria Would you mind checking if those OL tests showcase what you'd expect from this recently merged feature ? Trying to cover all possible scenarios here, so that we are sure they work well end to end. |
6eae59d to
4fd635c
Compare
70d614a to
26d2f08
Compare
26d2f08 to
d3cc5cd
Compare
ramitkataria
left a comment
There was a problem hiding this comment.
Thanks a lot - this looks like a great set of tests! Added a couple of nits inline that my agent found. Also:
t_identity caught something on my side: the identity is namespace + "/" + name, and file dataset names start with /, so file://host1/x matches as file://host1//x. Since it isn't released yet, I'll open a small follow-up to drop the doubled slash. That would change t_identity's pattern to file://host1/slash_.*, so happy to go with whichever order suits you.
If you feel like it, two more cases are safe in the shared deployment: an invalid hook-scoped rule (e.g. with emit) to show it's skipped, and two same-tier exclude_datasets rules to show the last one wins. Totally optional though!
|
Here's the PR I just opened: #75921 |
The exclusion control and hook scope added to the emission policy resolve per dataset across many rule tiers and authoring overrides. Without system tests, a regression in tier precedence, locking or authoring would pass unnoticed. Co-Authored-By: Claude <noreply@anthropic.com>
The provider docs include the system test Dags, so markdown fences and indented lists in their docstrings broke the docs build and made the spellcheck flag the stand-in class names. Co-Authored-By: Claude <noreply@anthropic.com>
The policy grew to a single unreadable line. A folded block keeps the value a single JSON line while letting each rule sit on its own line. Co-Authored-By: Claude <noreply@anthropic.com>
… tests The exclusion tests only checked a few scopes, and the existing policy Dags checked each control once through authoring and, in conf, only the source code. Rule tiers, every lineage source, locks, and the remaining controls could change behaviour without any test noticing. Co-Authored-By: Claude <noreply@anthropic.com>
A Dag run's own COMPLETE and FAIL come after its checking task, so no test could tell whether the success and failed handlers apply the policy. Child Dags finish before the parent's checking task and make them observable. Co-Authored-By: Claude <noreply@anthropic.com>
Runtime AssetAlias outlets are reported only since Airflow 3.1 and the hook lineage collector cap exists only since 3.2, so the OpenLineage e2e compat runs on 3.0 and 3.1 failed on the shared Dag. A separate Dag lets each version have its own expected events. Co-Authored-By: Claude <noreply@anthropic.com>
The previous commit moved the runtime AssetAlias outlets and collector cap checks out of the shared sources Dag, but the Dag meant to hold them was never added, so the conf rule and the collector cap setting pointed at nothing and neither behaviour was tested. Co-Authored-By: Claude <noreply@anthropic.com>
The scheduler resolves the policy for the emits_ol_events field of the Dag run START event from the serialized Dag, and the skipped-task handler and the dataset and query lineage APIs check it on their own, so none of them was exercised by the existing tests. Task groups, mapped and TaskFlow tasks, regex and exact scopes, same-tier conflicts, the order of authoring calls and authored lists over hook-scoped hook_lineage rules were not tested either. Co-Authored-By: Claude <noreply@anthropic.com>
… on Airflow 3.0 Airflow 3.0 calls no listener when a task skips itself, so the skipped-task checks failed there. Co-Authored-By: Claude <noreply@anthropic.com>
The policy tests repeated the same scenarios in several one-task Dags and kept near-full copies of expected events for small version differences, which made them slow to review and easy to let drift from the e2e policy config. Co-Authored-By: Claude <noreply@anthropic.com>
Reviewers could not tell from the Dag code alone which rules and authoring calls a task exercises or why an event is expected to be missing, and some tasks only proved that a facet was absent, which would also pass if lineage were broken entirely. Co-Authored-By: Claude <noreply@anthropic.com>
On Airflow 3.0 a self-skipping task still sends START, so the 3.0 expected events check it, and the runId check, which needs a terminal event for every START, is turned off there for that Dag only. The trigger tasks defer while waiting, so ten waits no longer hold worker slots in the shared e2e batch. The e2e config now warns that the SmoothOperator rule applies to every Dag, and describes the collector cap correctly. Co-Authored-By: Claude <noreply@anthropic.com>
…ests Exclusion now matches file datasets without a doubled slash, so the identity test pattern follows. Ignored invalid hook-scoped rules and last-wins between same-tier exclude lists were untested. The test operator now tags every reason a check fails, as the e2e output shows only tagged lines, and the Airflow 2 expected events of the deferral Dag say which version they are for. Co-Authored-By: Claude <noreply@anthropic.com>
d3cc5cd to
e869a48
Compare
|
Thanks for the fix PR, rebased and included this in tests already |
Adds OpenLineage system and e2e tests for the emission policy: dataset exclusion (every rule tier, lineage source, authoring override and lock) and the other controls in conf, authoring and locked rules. The tests also check the
emits_ol_eventsthe scheduler reports in the Dag run START event, and thatemit_dataset_lineageandemit_query_lineageemit nothing underemit: false.related: #71312
Also in this PR:
OpenLineageTestOperatornow logs every reason a check fails with the validation error tag and the event key, including runId integrity problems, errors other than a template mismatch and an unreadable expected events file. The e2e job output shows only the tagged lines, so some failures used to show up there without a reason.openlineage_defer_simple_dag.jsonis renamed toopenlineage_defer_simple_dag__af2.json. Airflow 3 has its own files for this Dag, so the unsuffixed file was only used on Airflow 2, which its name didn't say.Not covered, because the e2e Dags share one deployment and these would change or block every other test:
scope: {}) conf rules and locked global rules, except forexclude_datasets, which only matches the dataset names of these tests (a locked global rule would block authoring everywhere)include_source_codeat operator scope, and operator rules on built-in operators other thanSmoothOperator, which no other test uses (a custom operator is used, and it has no extractor that produces source code)disabled_for_operators,selective_enable,disable_source_code,include_full_task_info), which are global configNot covered for other reasons:
mainyetWas generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Sonnet 5.5, Opus 5.5) following the guidelines
🤖 Generated with Claude Code