From f59daa15004938a33de7409b7c32ff83f4cd24fc Mon Sep 17 00:00:00 2001 From: loverustfs Date: Wed, 2 Dec 2026 20:00:31 +0800 Subject: [PATCH] ci: require execution evidence for production ECStore recovery tests --- .github/workflows/ci.yml | 13 +++++++++++++ docs/testing/ci-gates.md | 2 ++ scripts/ci_test_artifact.py | 22 +++++++++++++++++++--- scripts/test_ci_test_artifact.py | 15 +++++++++++++-- 4 files changed, 47 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0584cc67b3..d0a0fff837 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -382,6 +382,19 @@ jobs: } > artifacts/workspace/doctest-diagnostics.txt exit "${status}" + - name: Verify production ECStore crash and recovery + if: needs.classify-changes.outputs.mode == 'full' + env: + CARGO_BUILD_JOBS: "2" + run: | + dst=(--locked -p rustfs-ecstore --features dst --test dst_production_ecstore --profile ci) + mkdir -p artifacts/workspace/dst + cargo nextest list "${dst[@]}" --message-format json > artifacts/workspace/dst/selection.json + rm -f target/nextest/ci/junit.xml + trap 'if [[ -f target/nextest/ci/junit.xml ]]; then cp target/nextest/ci/junit.xml artifacts/workspace/dst/junit.xml; fi' EXIT + cargo nextest run "${dst[@]}" --no-tests fail --retries 0 + python3 scripts/ci_test_artifact.py evidence --dst artifacts/workspace/dst/selection.json target/nextest/ci/junit.xml + - name: Upload test reports and diagnostics if: always() uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 diff --git a/docs/testing/ci-gates.md b/docs/testing/ci-gates.md index cf37c0ed17..d88bcd6664 100644 --- a/docs/testing/ci-gates.md +++ b/docs/testing/ci-gates.md @@ -22,6 +22,8 @@ Specialized boundary, hardware and alternate-feature lanes run only on the sched Workspace Clippy runs on every event with a selected workspace Rust job, pull requests included, in its own `Workspace Clippy` job. It runs beside `Workspace Lint and Build` instead of in front of it, because check-mode metadata and the linked test binaries share no compiler output; `scripts/ci_gate.py --check-workflow` rejects a workflow in which the archive producer or any archive consumer waits for the lint, or in which the lint leaves the aggregate. `Workspace Lint and Build` keeps its name as the archive producer: it creates the exact test archive and runs doctests; `Workspace tests` consumes the archive without rebuilding it. `cache-warm.yml` warms Clippy's check artifacts under `ci-dev` with the same invocation to reuse compatible dependency artifacts. `make pre-commit` does not run Clippy. Select local Clippy targets, features, and documentation exemptions from the root `AGENTS.md` verification tier; the workspace command below reproduces the CI lane and is not a universal pre-push requirement. +Full-scope runs also execute the production ECStore suite in `dst_production_ecstore` against simulated disks with `--features dst`. It checks the durability of acknowledged writes, metadata publication, and multipart retries with valid, missing, or misplaced per-drive evidence. The workspace producer retains the nextest listing and JUnit report and verifies that every required case passed. + Serial ILM tests run at the end of `workspace-tests` for the `full` scope, consuming the same verified archive as ordinary workspace tests. The existing ignored-test filter and `-j1` remain; `--profile default` keeps the no-retry execution and preserves the separate core CI JUnit report. Any ILM failure fails the consumer and required aggregate. Logs remain in the workspace test evidence artifact. There is no separate ILM compilation or cache restore. `required-checks` runs even after failed or skipped dependencies. `scripts/ci_gate.py verify` rejects missing jobs, unexpected jobs, failure, cancellation, and unexpected skips; optional lanes are required only on their declared events. `Workspace Clippy` is the workspace lint, `Workspace Lint and Build` and `Workspace tests` are the ordinary Rust producer and consumer, while `Test and Lint` uniquely names the aggregate. New validation jobs must update both its direct dependencies and the script contract. A report-only lane is registered in `REPORT_ONLY_JOBS` instead: it stays out of the aggregate, must keep its distinguishing environment, and must keep the steps it reruns identical to the required job it mirrors. Test this wiring and its failure cases with `python3 scripts/ci_gate.py --self-test`. diff --git a/scripts/ci_test_artifact.py b/scripts/ci_test_artifact.py index a791d0c1ff..4a17ff9305 100644 --- a/scripts/ci_test_artifact.py +++ b/scripts/ci_test_artifact.py @@ -24,6 +24,16 @@ CORE_TESTS = { "head_object_consistency_test::head_object_consistency_after_write_and_multipart_and_presigned_head", "storage_class_capability_test::tests::historical_label_only_metadata_is_standard_without_hiding_a_real_transition_tier", } +DST_SUITE = "rustfs-ecstore::dst_production_ecstore" +DST_TESTS = { + "dst_prod_test1_quorum_put_get_delete_offline_and_enospc", + "dst_prod_test2_physical_bitrot_highwayhash_detect_reconstruct_and_heal", + "dst_prod_test3_alice_power_loss_crash_consistency_old_or_new_never_mixed", + "metadata_write_crash_preserves_published_metadata", + "dst_prod_test4_deterministic_multiseed_concurrent_chaos_and_replay_equivalence", + "dst_prod_test5_multipart_commit_crash_cutpoints_before_rename_and_before_cleanup", + "multipart_replay_rejects_missing_or_other_disk_anchor", +} def output(*args): @@ -151,12 +161,16 @@ def selected_tests(listing): return selected -def verify_execution(listing, junit, core=False): +def verify_execution(listing, junit, core=False, dst=False): inventory = json.loads(Path(listing).read_text()) expected = selected_tests(inventory) known = {(binary, name) for binary, suite in inventory["rust-suites"].items() for name in suite["testcases"]} if core and (len(expected) != len(CORE_TESTS) or {name for _, name in expected} != CORE_TESTS): raise ValueError("core contract must select exactly the write/read, denial and restart proofs") + if dst: + missing = {(DST_SUITE, name) for name in DST_TESTS} - expected + if missing: + raise ValueError(f"missing production DST tests: {sorted(missing)}") report = ET.parse(junit).getroot() if report.tag != "testsuites" or report.get("failures") != "0" or report.get("errors") != "0": raise ValueError("test report must be a successful nextest run") @@ -201,7 +215,9 @@ def main(): child = sub.add_parser("evidence") child.add_argument("listing", type=Path) child.add_argument("junit", type=Path) - child.add_argument("--core", action="store_true") + required = child.add_mutually_exclusive_group() + required.add_argument("--core", action="store_true") + required.add_argument("--dst", action="store_true") args = parser.parse_args() try: if args.command == "build": @@ -221,7 +237,7 @@ def main(): "doc": [*selection, "--doc"], "warm": ["--no-run", *selection]}[args.operation] subprocess.run(command, cwd=ROOT, check=True) else: - print(f"Verified {verify_execution(args.listing, args.junit, args.core)} test executions") + print(f"Verified {verify_execution(args.listing, args.junit, args.core, args.dst)} test executions") except (OSError, ValueError, KeyError, TypeError, ET.ParseError, subprocess.CalledProcessError) as error: print(f"verification artifact: {error}", file=sys.stderr) return 1 diff --git a/scripts/test_ci_test_artifact.py b/scripts/test_ci_test_artifact.py index e9debff392..2a105f4eed 100644 --- a/scripts/test_ci_test_artifact.py +++ b/scripts/test_ci_test_artifact.py @@ -244,10 +244,10 @@ class ExecutionEvidenceTests(unittest.TestCase): self.listing = listing([("crate-a", "one", False), ("crate-b", "two", False), ("crate-b", "ignored", True)]) self.report = junit([("crate-a", "one", None), ("crate-b", "two", None)]) - def verify(self, listing_value=None, report=None, *, core=False): + def verify(self, listing_value=None, report=None, *, core=False, dst=False): self.listing_file.write_text(json.dumps(self.listing if listing_value is None else listing_value)) ET.ElementTree(self.report if report is None else report).write(self.junit_file) - return artifact.verify_execution(self.listing_file, self.junit_file, core=core) + return artifact.verify_execution(self.listing_file, self.junit_file, core=core, dst=dst) def test_exact_selected_set_and_known_ignored_cases(self): self.assertEqual(self.verify(), 2) @@ -321,6 +321,17 @@ class ExecutionEvidenceTests(unittest.TestCase): with self.subTest(attribute=attribute), self.assertRaises(ValueError): self.verify(report=report) + def test_dst_rejects_a_green_report_with_a_missing_required_test(self): + cases = [(artifact.DST_SUITE, name) for name in sorted(artifact.DST_TESTS)] + for selected in [cases, cases[:-1]]: + inventory = listing([(suite, name, False) for suite, name in selected]) + report = junit([(suite, name, None) for suite, name in selected]) + if selected == cases: + self.assertEqual(self.verify(inventory, report, dst=True), len(cases)) + else: + with self.assertRaisesRegex(ValueError, "missing production DST tests"): + self.verify(inventory, report, dst=True) + def test_core_requires_exactly_three_selected_proofs(self): names = sorted(artifact.CORE_TESTS) core_listing = listing([("e2e", name, False) for name in names])