Commit 1e94e6e
authored
fix: Rework telemetry tests to use synctest (#1631)
Replace uses of a `sync.WaitGroup` to coordinate between different
goroutines in tests with `testing/synctest`. That package, stable
starting with Go 1.25, simplifies testing concurrent and asynchronous
code by providing:
- *Fake time*: Time advances automatically when goroutines block.
- *Quiescence detection*: Deterministic synchronization instead of
arbitrary delays.
- *Fast, reliable tests*: Because of the fake time mechanism, test can
wait for "arbitrary" periods of time and they will work. The clock
will advance, but wallclock will be short. At the same time, you don't
have to guess how much is enough.
Signed-off-by: Marcelo E. Magallon <marcelo.magallon@grafana.com>1 parent fa48ab6 commit 1e94e6e
File tree
3 files changed
+205
-232
lines changed- internal/telemetry
3 files changed
+205
-232
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
0 commit comments