Beispiel-DAG-Test (Airflow 1)

Beispiel für einen Einheitentest für einen DAG

Codebeispiel

Python

Richten Sie für die Authentifizierung bei Cloud Composer Standardanmeldedaten für Anwendungen ein. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.

def test_dag_with_variables(set_variables):
    # Importing the module verifies that there are no syntax errors.
    from . import unit_testing_variables as module

    # The assert_has_valid_dag verifies that the module contains an Airflow DAG
    # and that the DAG contains no cycles.
    internal_unit_testing.assert_has_valid_dag(module)

Nächste Schritte

Informationen zum Suchen und Filtern von Codebeispielen für andere Google Cloud-Produkte finden Sie im Google Cloud-Beispielbrowser.