Skip to content

test: fold duplicated test/benchmark scaffolding into shared helpers #673

Closed

Description

@tdakkota

Test and benchmark scaffolding has been copied per package, next to shared helpers that already
exist. There are ~151 struct types in _test.go files. Recent PRs (#671, #672) each added another
heapSampler, inProcessS3, golden digest and backend matrix. This issue tracks folding them into
shared helpers. Survey at f30d3d4 (main + #672).

Existing shared helpers — extend these, don't invent new homes

  • backend/backendtest:
    • Run conformance, AtomicConditionalPut, WithCapacity, WithDeferred.
    • It is used by internal package block tests, so it must never import block, engine or
      recordengine.
  • backend/faultbackend: Wrap, Rule, Gate, Ops, Count. It forwards no optional
    capabilities.
  • internal/mergestream/mergestreamtest:
    • a per-key read-counting Backend with FailWriteAt;
    • a cross-engine Run(t, open) suite through a Store adapter. This is the model for sharing
      suites across engines without an import cycle.
  • internal/obs/obstest, internal/vfs/vfstest, internal/reproduce.

Plan (ranked: most duplication, lowest risk first)

Found along the way

recordengine's partsBytes doc says it sums on-disk size. It sums sizeBytes, which in the
record engine is decoded bytes (introspect.go), while in the metrics engine it is disk bytes. So
the two engines' merge benchmark MB/s are not comparable. Fix the doc in item 1, and state the unit
in both benchmarks.

Rules for every PR here

  • Behaviour-preserving: no test's assertion, tuned threshold or measured quantity changes, and the
    golden files stay byte-identical.
  • A shared helper that forwards or strips backend capabilities must say which, because several
    tests measure exactly that.
  • Shared packages must not create import cycles: no engine or recordengine imports from anything
    those packages' internal tests use.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KcLq1G8KpWBvM53JaQb1tS

Activity

  1. added
    trackingUmbrella or index issue tracking other issues
    on Sep 23, 2026
  2. added 4 commits that reference this issue on Sep 24, 2026
  3. tdakkota commented on Sep 24, 2026

    @tdakkota
    ContributorAuthor

    All eight items are done. Landed: #674 (items 1–4), #675 (item 6, heaptest), #676 (item 5, faultbackend), #678 (item 7 etcdtest, which also fixed #509's port race), and #679 (item 8, the cross-engine suite). The follow-up it surfaced, #680, landed as #681. Item 7's fetchtest half was dropped: it came out net +44 lines of call-site churn for no deduplication.

    🤖 Generated with Claude Code

    https://claude.ai/code/session_01KcLq1G8KpWBvM53JaQb1tS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    trackingUmbrella or index issue tracking other issues

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions