This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch v3-1-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v3-1-test by this push:
new e6af61cdf6a [v3-1-test] Add check for schedule parameter for system
tests (#58254) (#58255)
e6af61cdf6a is described below
commit e6af61cdf6ac87a112e0f7e52b4577f99c25f62d
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Thu Nov 13 18:35:50 2025 +0100
[v3-1-test] Add check for schedule parameter for system tests (#58254)
(#58255)
(cherry picked from commit 30b9598c7b01ca14cf2a459291ec4f0de53634a4)
Co-authored-by: VladaZakharova <[email protected]>
---
scripts/ci/prek/check_system_tests.py | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/scripts/ci/prek/check_system_tests.py
b/scripts/ci/prek/check_system_tests.py
index 0d9aaa3dc06..e5012e7c11e 100755
--- a/scripts/ci/prek/check_system_tests.py
+++ b/scripts/ci/prek/check_system_tests.py
@@ -55,9 +55,38 @@ PYTEST_FUNCTION_PATTERN = re.compile(
r"test_run = get_test_run"
)
+DAG_WITH_ARGS = re.compile(
+ r"with\s+DAG\s*\(\s*(?P<args>.*?)\)\s*as\s+\w+\s*:",
+ re.DOTALL,
+)
+REQUIRES_SCHEDULE_ERROR = (
+ "[red]System test DAG must set the 'schedule' parameter (e.g.
schedule='@once').[/]\n\n"
+ "[yellow]Example:[/]\n\n"
+ "with DAG(\n"
+ " DAG_ID,\n"
+ " schedule='@once',\n"
+ " start_date=datetime(2021, 1, 1),\n"
+ " catchup=False,\n"
+ " tags=[...],\n"
+ ") as dag:\n"
+)
+
def _check_file(file: Path):
content = file.read_text()
+ console.print("----------file path: ", file)
+ for m in DAG_WITH_ARGS.finditer(content):
+ args = m.group("args")
+ if "schedule" not in args:
+ errors.append(
+ f"In {file}: System test DAG must include the 'schedule'
parameter "
+ f"(e.g. schedule='@once') inside DAG(...).\n"
+ )
+ elif "providers/google/" in str(file).replace("\\", "/") and
"schedule=None" in args:
+ errors.append(
+ f"In {file}: System test DAG should not include the 'schedule'
parameter "
+ f"with value 'None' inside DAG(...): this configuration will
make the automated run not possible for the test.\n"
+ )
if "from tests_common.test_utils.watcher import watcher" in content:
index = content.find(WATCHER_APPEND_INSTRUCTION_SHORT)
if index == -1: