stripe / veneur

A distributed, fault-tolerant pipeline for observability data
MIT License
1.73k stars 174 forks source link

Deflake some tests #1049

Closed praboud-stripe closed 1 year ago

praboud-stripe commented 1 year ago

Summary

Deflakes TestConnect; this previously would sometimes finish before the conn_end metric was published, which would cause the test to fail. I've addressed this by having the test block on both ConnectionClosed & the metric Count calls being hit - these two are async wrt each other, so blocking on just one or the other is insufficient.

While trying to merge this, I also ran into another flake in TestAddSingleWithFailure. I've fixed this one as well - it's not entirely clear why we ever would have needed the assert.Eventually call here. Simply calling Wait() is faster and isn't flaky.

Motivation

Reduce toil from flaky tests.

Test plan

go test ./proxy/connect ./proxy/destinations -count 1000; this fails on master.