]> Cypherpunks repositories - gostls13.git/commit
time: make sure tests avoid the special-case channel code
authorRuss Cox <rsc@golang.org>
Thu, 29 Feb 2024 16:56:07 +0000 (11:56 -0500)
committerGopher Robot <gobot@golang.org>
Fri, 8 Mar 2024 22:13:33 +0000 (22:13 +0000)
commit336617186a6c01a1874685d4577042ab007609ea
treea5f99161175f21d2a0ea3813cf5144975bd6b563
parent40cc3eb27869b2cbad5bf139191d02a1bc7b84b7
time: make sure tests avoid the special-case channel code

Many of the tests in package time are about proper manipulation
of the timer heap. But now NewTimer bypasses the timer heap
except when something is blocked on the associated channel.
Make the tests test the heap again by using AfterFunc instead of
NewTimer.

In particular, adds a non-chan version of TestZeroTimer, which
was flaky-broken and then fixed by CLs in the cleanup stack.
This new tests makes sure we notice if it breaks again.

Fixes #66006.

Change-Id: Ib59fc1b8b85ef5a21e72fe418c627c9b8b8a083a
Reviewed-on: https://go-review.googlesource.com/c/go/+/568255
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
src/time/sleep_test.go