Skip to content

Test robustness: gaps the 97%+ statement coverage hides #86

Description

@MasterOfBinary

From a test-quality audit (validated @ 58cee73; statement coverage is excellent but several behaviors are unguarded):

  • Dynamic-config mid-run pickup has no deterministic unit test. The only behavioral guard was Example_dynamicConfig's exact output — which PR test: make Example_* output deterministic #69 (correctly) makes stop asserting batch sizes. After test: make Example_* output deterministic #69, a regression where doProcessors caches config.Get() once would pass the whole suite. Add a unit test that pins per-batch config re-read using a synchronization barrier (not sleeps).
  • SourceError.Error() has 0% coverage — the "source error: %v" format contract is unguarded.
  • The MaxItems < MinItems clamp in fixConfig is mutation-inert — deleting it fails no test (the MaxItems return path fires before MinItems is consulted). Cover it via observable batch sizes, or fold the clamp into validation (Resource limits + configuration validation #73).
  • Change-detector tests in buffer_config_test.go assert DefaultItemBufferSize == 100 etc. — they restate constants.go and fail legitimate retuning; keep only the >= 1 sanity checks.
  • Duplicate test helpers: testSource/countProcessor are defined twice with different shapes (external batch_test vs internal helpers_test) — drift hazard, consolidate.
  • Uncovered branches: IgnoreErrors(nil) guard; ExecuteBatches with cfg.B == nil (only cfg == nil is tested); empty configs....

Sequencing: after PR #69 lands (it rewrites the example files these gaps interact with).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions