From 5b951de2b71dc3df7afef976ce12c4e5b75cc0ee Mon Sep 17 00:00:00 2001 From: Zhengchao An Date: Sat, 22 Aug 2026 10:58:01 +0800 Subject: [PATCH] test(ci): bound s3-tests failure logs (#6361) --- scripts/check_test_wiring.py | 27 ++++++++++++++++++++++++++- scripts/s3-tests/run.sh | 3 ++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/scripts/check_test_wiring.py b/scripts/check_test_wiring.py index d04af1f12..4edd41f0d 100755 --- a/scripts/check_test_wiring.py +++ b/scripts/check_test_wiring.py @@ -206,6 +206,13 @@ def check_runner_selection(root: Path) -> list[str]: return errors +def check_s3_tests_runner(root: Path) -> list[str]: + runner = (root / "scripts/s3-tests/run.sh").read_text() + if "--showlocals" in runner: + return ["scripts/s3-tests/run.sh: pytest failure diagnostics must not dump local values"] + return [] + + def profile_selection(root: Path, profile: str) -> str: if not re.fullmatch(r"e2e-[a-z0-9-]+", profile): raise ValueError(f"invalid e2e profile name: {profile}") @@ -272,6 +279,7 @@ def validate(root: Path) -> list[str]: errors.extend(check_e2e_modules(root)) errors.extend(check_fuzz_targets(root)) errors.extend(check_runner_selection(root)) + errors.extend(check_s3_tests_runner(root)) errors.extend(check_profile_definitions(root)) return errors @@ -341,6 +349,23 @@ class SelfTests(unittest.TestCase): ) self.assertEqual(len(check_fuzz_targets(root)), 1) + def test_s3_runner_rejects_unbounded_failure_locals(self) -> None: + with tempfile.TemporaryDirectory() as tmp: + root = Path(tmp) + runner = root / "scripts/s3-tests/run.sh" + runner.parent.mkdir(parents=True) + runner.write_text("tox -- -vv -ra --tb=long\n") + self.assertEqual(check_s3_tests_runner(root), []) + runner.write_text("tox -- -vv -ra --showlocals --tb=long\n") + self.assertEqual(len(check_s3_tests_runner(root)), 1) + with ( + mock.patch(__name__ + ".check_e2e_modules", return_value=[]), + mock.patch(__name__ + ".check_fuzz_targets", return_value=[]), + mock.patch(__name__ + ".check_runner_selection", return_value=[]), + mock.patch(__name__ + ".check_profile_definitions", return_value=[]), + ): + self.assertEqual(len(validate(root)), 1) + def test_profile_listing_enforces_selection(self) -> None: with tempfile.TemporaryDirectory() as tmp: root = Path(tmp) @@ -411,7 +436,7 @@ def main() -> int: for error in errors: print(f"ERROR: {error}", file=sys.stderr) return 1 - print("OK: e2e modules, runner selection, fuzz matrices, and profile guards are wired") + print("OK: e2e modules, runner selection, fuzz matrices, profiles, and bounded diagnostics are wired") return 0 diff --git a/scripts/s3-tests/run.sh b/scripts/s3-tests/run.sh index ac8b691f5..74e2289f6 100755 --- a/scripts/s3-tests/run.sh +++ b/scripts/s3-tests/run.sh @@ -1028,10 +1028,11 @@ else fi # Run tests from s3tests/functional +# Failure locals can contain multi-MiB request bodies; keep tracebacks without expanding local values. set +e S3TEST_CONF="${CONF_OUTPUT_PATH}" \ tox -- \ - -vv -ra --showlocals --tb=long \ + -vv -ra --tb=long \ --maxfail="${MAXFAIL}" \ --timeout="${TEST_TIMEOUT}" \ --junitxml="${ARTIFACTS_DIR}/junit.xml" \