Airflow test commands unexpectedly updates metadata database

Viewed 129

I am trying to test my DAGs on Airflow 2.1.0 with the Airflow test commands. I understand that there are 2 test commands:

  • airflow dags test <dag_id> <execution_date> - runs a specified DAG for a given date in test mode
  • airflwo tasks test <dag_id> <task_id> <execution_date> - runs a specified task instance of a specified DAG for a given date in test mode

Based on my understanding, the test commands should not update the metadata, and thus state changes to DAGS and tasks should not be reflected in the Airflow Web UI. From the Airflow Tutorial (emphasis mine):

Note that the airflow tasks test command runs task instances locally, outputs their log to > stdout (on screen), does not bother with dependencies, and does not communicate state (running, success, failed, ...) to the database. It simply allows testing a single task instance. The same applies to airflow dags test [dag_id] [execution_date], but on a DAG level. It performs a single DAG run of the given DAG id. While it does take task dependencies into account, no state is registered in the database. It is convenient for locally testing a full run of your DAG, given that e.g. if one of your tasks expects data at some location, it is available

In addition, Difference between "airflow run" and "airflow test" in Airflow also mentions the same thing. However, to my surprise, running a test command does produce a state change for the dag when running airflow dags test test_dag "2021-06-01 21:00:00+00:00"

enter image description here

As seen, the DAG contains an instance of a successful task. Thus, why is the DAG being updated in the UI? Is this undocumented behavior or a misconfiguration on my part?

0 Answers
Related