Commit 3070c5dc2d for bind
commit 3070c5dc2d60ef35637fcb82cf22b0410ccdc9db
Author: Štěpán Balážik <stepan@isc.org>
Date: Wed Dec 2 19:01:21 2026 +0100
Warn about unbackported system test infrastructure changes
System tests are only easy to backport while isctest, conftest.py and
the other shared pieces are in sync on all branches we might backport
tests to. Make Danger warn, and list the files, when a merge request
changes them on main without being labeled for backport to all of
those branches, or changes them on one of those branches or on a
security branch directly, so that the change is either backported or
split into a merge request for main which is.
diff --git a/dangerfile.py b/dangerfile.py
index 48b332a382..4558a7941d 100644
--- a/dangerfile.py
+++ b/dangerfile.py
@@ -401,6 +401,78 @@ elif not approvals.approved:
"It should not be merged until it is approved."
)
+###############################################################################
+# SYSTEM TEST INFRASTRUCTURE
+###############################################################################
+#
+# WARN if the merge request is not a backport, changes the system test
+# infrastructure, and any of the following is true:
+#
+# * It targets main and is not labeled for backporting to all branches we
+# might backport tests to.
+#
+# * It targets one of those branches, its -sub edition, or a security-* branch
+# directly. (Unless we do something non-standard, every such change should
+# come from main and reach the other branches by backport or rebase.)
+#
+# (System tests are only easy to backport while the infrastructure is in sync
+# on all those branches.)
+
+TEST_INFRA_BACKPORT_LABELS = ["v9.20", "v9.18", "v9.16", "v9.11"]
+TEST_INFRA_MAX_LISTED_FILES = 10
+
+test_infra_regex = re.compile(
+ r"""
+ bin/tests/system/
+ (
+ isctest/ # the isctest package
+ | _common/ # shared configuration and zone templates
+ | conftest\.py # pytest runner
+ | pytest\.ini
+ | ans\.py # zone-only ans.py server
+ | \w+_checker\.py # pylint plugins
+ )
+ """,
+ re.VERBOSE,
+)
+test_infra_changes = sorted(filter(test_infra_regex.match, affected_files))
+test_infra_oldest_label = f"~{TEST_INFRA_BACKPORT_LABELS[-1]}"
+test_infra_missing_labels = [
+ f"~{label}" for label in TEST_INFRA_BACKPORT_LABELS if label not in mr_labels
+]
+
+test_infra_advice = None
+if target_branch == "main":
+ if test_infra_missing_labels:
+ test_infra_advice = (
+ "Please consider backporting this merge request down to "
+ f"{test_infra_oldest_label} (missing: "
+ f"{', '.join(test_infra_missing_labels)}), or moving the test "
+ "infrastructure changes into a separate merge request that will "
+ "be backported to all of those branches."
+ )
+elif re.fullmatch(r"security-main|(security-)?bind-9\.\d+(-sub)?", target_branch):
+ test_infra_advice = (
+ "By default, every test infrastructure change should come from `main`: "
+ "please consider moving this one into a separate merge request for "
+ f"`main` that will be backported down to {test_infra_oldest_label}."
+ )
+
+if test_infra_changes and test_infra_advice and not is_backport:
+ listed_files = [
+ f"- `{path}`" for path in test_infra_changes[:TEST_INFRA_MAX_LISTED_FILES]
+ ]
+ if len(test_infra_changes) > TEST_INFRA_MAX_LISTED_FILES:
+ more = len(test_infra_changes) - TEST_INFRA_MAX_LISTED_FILES
+ listed_files.append(f"- ... and {more} more")
+ warn(
+ "This merge request changes the system test infrastructure. System "
+ "tests are only easy to backport while that code is in sync on all "
+ f"branches we might backport tests to. {test_infra_advice} "
+ "Contact QA if in doubt. This message was triggered by changes to "
+ "the following files:\n\n" + "\n".join(listed_files)
+ )
+
###############################################################################
# ANS.PY SERVERS
###############################################################################