Skip to content

Flaky TestProducerMetrics unit test #671

@rubvs

Description

@rubvs
> go version
go version go1.24.4 darwin/arm64

> go test -v -failfast -race -count=10 -timeout=60s ./... -run TestProducerMetrics

?       github.com/elastic/apm-queue/v2 [no test files]
?       github.com/elastic/apm-queue/v2/cmd/queuebench  [no test files]
=== RUN   TestProducerMetrics
=== RUN   TestProducerMetrics/DeadlineExceeded
=== RUN   TestProducerMetrics/ContextCanceled
=== RUN   TestProducerMetrics/Unknown_error_reason
=== RUN   TestProducerMetrics/unknown_topic
=== RUN   TestProducerMetrics/Produced
panic: test timed out after 10s
        running tests:
                TestProducerMetrics (10s)
                TestProducerMetrics/Produced (9s)

goroutine 111 [running]:
testing.(*M).startAlarm.func1()
        /usr/local/go/src/testing/testing.go:2484 +0x4d8
created by time.goFunc
        /usr/local/go/src/time/sleep.go:215 +0x44

goroutine 1 [chan receive]:
testing.(*T).Run(0xc000003a40, {0x1033152e9, 0x13}, 0x103730630)
        /usr/local/go/src/testing/testing.go:1859 +0x6a4
testing.runTests.func1(0xc000003a40)
        /usr/local/go/src/testing/testing.go:2279 +0x80
testing.tRunner(0xc000003a40, 0xc000049ad8)
        /usr/local/go/src/testing/testing.go:1792 +0x184
testing.runTests(0xc00000c210, {0x103e393a0, 0x21, 0x21}, {0x826b916263ebb94c?, 0x0?, 0x103e40a20?})
        /usr/local/go/src/testing/testing.go:2277 +0x780
testing.(*M).Run(0xc000282fa0)
        /usr/local/go/src/testing/testing.go:2142 +0xb6c
main.main()
        _testmain.go:111 +0x114

goroutine 7 [chan receive]:
testing.(*T).Run(0xc000003c00, {0x10330cf7c, 0x8}, 0xc00040e650)
        /usr/local/go/src/testing/testing.go:1859 +0x6a4
github.com/elastic/apm-queue/v2/kafka.TestProducerMetrics(0xc000003c00)
        /Users/rubenvanstaden/apm-queue/kafka/metrics_test.go:202 +0x254
testing.tRunner(0xc000003c00, 0x103730630)
        /usr/local/go/src/testing/testing.go:1792 +0x184
created by testing.(*T).Run in goroutine 1
        /usr/local/go/src/testing/testing.go:1851 +0x688

goroutine 102 [sync.WaitGroup.Wait]:
sync.runtime_SemacquireWaitGroup(0xc000422680?)
        /usr/local/go/src/runtime/sema.go:110 +0x2c
sync.(*WaitGroup).Wait(0xc000422680)
        /usr/local/go/src/sync/waitgroup.go:118 +0x74
github.com/elastic/apm-queue/v2/kafka.(*Producer).Produce(0xc00050a000, {0x1037441c8, 0x103e695e0}, {0xc0004680e0, 0x3, 0x0?})
        /Users/rubenvanstaden/apm-queue/kafka/producer.go:281 +0x774
github.com/elastic/apm-queue/v2/kafka.TestProducerMetrics.func1({0x1037441c8, 0x103e695e0}, 0xc00041c540, {0x103742358, 0xc00050a000}, {0x1037462c0, 0xc00041e460}, {0x103310512, 0xd}, {0xc0004b53b8, ...})
        /Users/rubenvanstaden/apm-queue/kafka/metrics_test.go:52 +0x2a0
github.com/elastic/apm-queue/v2/kafka.TestProducerMetrics.func6(0xc00041c540)
        /Users/rubenvanstaden/apm-queue/kafka/metrics_test.go:315 +0x2b40
testing.tRunner(0xc00041c540, 0xc00040e650)
        /usr/local/go/src/testing/testing.go:1792 +0x184
created by testing.(*T).Run in goroutine 7
        /usr/local/go/src/testing/testing.go:1851 +0x688

goroutine 104 [select]:
github.com/twmb/franz-go/pkg/kgo.(*Client).reapConnectionsLoop(0xc00047e808)
        /Users/rubenvanstaden/go/pkg/mod/github.com/twmb/[email protected]/pkg/kgo/broker.go:558 +0x178
created by github.com/twmb/franz-go/pkg/kgo.NewClient in goroutine 102
        /Users/rubenvanstaden/go/pkg/mod/github.com/twmb/[email protected]/pkg/kgo/client.go:519 +0x12a0

goroutine 103 [select]:
github.com/twmb/franz-go/pkg/kgo.(*Client).updateMetadataLoop(0xc00047e808)
        /Users/rubenvanstaden/go/pkg/mod/github.com/twmb/[email protected]/pkg/kgo/metadata.go:195 +0x98c
created by github.com/twmb/franz-go/pkg/kgo.NewClient in goroutine 102
        /Users/rubenvanstaden/go/pkg/mod/github.com/twmb/[email protected]/pkg/kgo/client.go:518 +0x123c

goroutine 105 [select]:
github.com/twmb/franz-go/pkg/kgo.(*Client).waitUnknownTopic(0xc00047e808, {0x1037441c8, 0x103e695e0}, {0xc00044a060, 0x18}, 0xc0004113e0)
        /Users/rubenvanstaden/go/pkg/mod/github.com/twmb/[email protected]/pkg/kgo/producer.go:923 +0x348
created by github.com/twmb/franz-go/pkg/kgo.(*Client).addUnknownTopicRecord in goroutine 102
        /Users/rubenvanstaden/go/pkg/mod/github.com/twmb/[email protected]/pkg/kgo/producer.go:890 +0x4ac
FAIL    github.com/elastic/apm-queue/v2/kafka   10.517s
?       github.com/elastic/apm-queue/v2/metrictest      [no test files]
testing: warning: no tests to run
PASS
ok      github.com/elastic/apm-queue/v2/queuecontext    1.206s [no tests to run]
2025-06-14T17:44:24.672-0400    INFO    systemtest/main_test.go:40      skipping system tests, pass -run-system-tests to enable
ok      github.com/elastic/apm-queue/v2/systemtest      1.627s
FAIL

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions