One thing we’ve started doing in some of our Snowplow Micro test suites is to run our validation requests to Micro in a loop, and loop until we get the event we’re expecting to land. You can hit /micro/good
reasonably aggressively in your tests and then as soon as the event is ready you’ll find it. This chipped a few seconds off in places rather than having to always wait for the worst case of 5 seconds (when we’re testing some slow old browser on a terrible VM).
Some very rough pseudocode:
event = undefined
loop every 500 milliseconds
events = GET /micro/good/
if events contains expected_event_type
event = events[expected_event_type]
continue
until 5 seconds
if event is undefined
fail