riverqueue / river

Fast and reliable background jobs in Go
https://riverqueue.com
Mozilla Public License 2.0
3.34k stars 89 forks source link

Use `TestOnly` property in example tests #440

Closed brandur closed 2 months ago

brandur commented 2 months ago

I was looking into what was making the example tests so slow (some like the periodic job enqueuer one often take 3 seconds to run), and it turns out that the lion's share of it is from from service start up jitter.

Example tests aren't in the main river package (they're in river_test) so they didn't previously have a way of interacting with the client in such a way as to disable stagger. Luckily, we do have a way now. Take advantage of the recently introduced TestOnly client property from #414 to make all the examples faster.

brandur commented 2 months ago

Oh yeah, good idea. I'll take that a bit later.