test-corpus

Manages bucket-fetched test fixtures for Rust test suites via a git submodule.

9.2k|581|Updated Jan 31, 2025
One-click install
npx skills add https://github.com/kreuzberg-dev/kreuzberg --skill test-corpus
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-corpus
Source: https://github.com/kreuzberg-dev/kreuzberg/tree/main/.ai-rulez/skills/test-corpus
Command: npx skills add https://github.com/kreuzberg-dev/kreuzberg --skill test-corpus

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

The test_documents submodule stores 654 binary fixtures (~581 MiB) that are not committed to git, so fresh clones, worktrees, and CI jobs fail with missing-file errors unless the corpus is fetched from a public GCS bucket and handled correctly.

Core Features & Use Cases

  • Corpus Fetching: Materialize fixtures anonymously over HTTPS with fetch_corpus.py, optionally narrowing with include patterns like 'pdf/**'.
  • Fixture-Safe Testing: Use the read_test_fixture helper so missing fixtures skip with a greppable SKIP line instead of failing builds, and never include_bytes! corpus files.
  • A/B Control Setup: Avoid vacuous worktree controls by symlinking test_documents and isolating CARGO_TARGET_DIR so fixture-guarded tests actually run.
  • Use Case: After a fresh clone, run the fetch script before cargo test so fixture-backed tests execute instead of erroring, and publish corpus changes with the submodule commit pushed before the superproject gitlink.

Quick Start

Fetch the test fixture corpus and explain why my Rust tests are failing with missing-file errors on a fresh clone.

Frequently Asked Questions about test-corpus

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fetch the test_documents fixture corpus?

Run python3 test_documents/scripts/fetch_corpus.py to download everything, or pass --include 'pdf/**' to narrow the fetch. Files come from a public GCS bucket over anonymous HTTPS with no credentials, and fetched files are gitignored inside the submodule.

Why do Rust tests fail with missing-file errors on a fresh clone?

The test_documents submodule's binary fixtures are not committed to git, so tests reading from it fail until you run the fetch script. These are missing-file errors, not assertion failures, so read the message before concluding the suite regressed.

Can I use include_bytes! for corpus fixtures in Rust tests?

No. Baking corpus bytes in at compile time turns a missing fixture into a build failure for the whole crate. Use the read_test_fixture helper instead, which prints a greppable SKIP line and returns None when the fixture is unavailable.

Why does a git worktree give a false green test run?

git worktree add does not populate submodules, so the control worktree has an empty test_documents and every fixture-guarded test skips silently. Symlink the main tree's test_documents into the worktree and use a dedicated CARGO_TARGET_DIR.

How do I publish changes to the test fixture corpus?

From inside the submodule, run publish_corpus.py with --dry-run first, then publish and verify against the bucket. Push the submodule commit before the superproject gitlink, or CI fails at checkout with a missing submodule SHA.

What is the difference between fixtures/ and test_documents/?

The fixtures/ directory at the repo root is committed to git and safe to use with include_bytes!. Only test_documents/ is bucket-fetched and uncommitted, so it requires the fetch script and the read_test_fixture guard.