Skip to content

test(ingest): TestRejectPoison_CountedByDisposition fails at -count>1 #700

Description

@EricAndrechek

Area: ingest — tests

TestRejectPoison_CountedByDisposition (internal/ingest/worker_test.go) fails on every run after the first in one process: go test -race -count=2 -run TestRejectPoison_CountedByDisposition ./internal/ingest fails on run 2 (and 3, with -count=3). It passes at -count=1, which is what make ci uses, so CI never sees it. It reproduces on main (measured on main and on #624's branch; the test came from #554).

Likely cause (inferred, not confirmed): the test swaps the global meter provider with otel.SetMeterProvider and reads wavehouse_ingest_poison_total through a fresh ManualReader. The ingest package's instruments are created once from the global provider, and OpenTelemetry's global delegation binds them to the first provider set. On the second run the counter still records into the first run's provider, so the new reader sees nothing, or the totals carry over.

Why it matters: -count=N and -test.shuffle are the usual way to shake out flaky tests, and this test makes them fail in internal/ingest for a reason unrelated to the code under test.

Fix direction: give the worker its instruments through a metric.MeterProvider passed in (or a package-level hook the test can set) rather than the global, or have the test read deltas from its own reader instead of absolute totals. Check the other tests in internal/ingest that call otel.SetMeterProvider for the same pattern.

Test: go test -race -count=3 ./internal/ingest passes.

Related: #554.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/ingestIngest pipeline (Bento, batching, DLQ)bugSomething isn't working

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions