Return errors instead of calling t.Fatalf for timing-sensitive failure
modes. Scale the Sleep call to the timeout (so that it isn't too short
for the longer durations).
Fixes #54891.
Change-Id: I574e85e121becdda9ab8ee6bfd37c18a549d366d
Reviewed-on: https://go-review.googlesource.com/c/go/+/430955 Reviewed-by: Joel Sing <joel@sing.id.au>
Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>