check in loop to stablize TestContextCancel2 (#197)

Signed-off-by: Yilin Chen <sticnarf@gmail.com>
This commit is contained in:
Yilin Chen 2021-07-01 12:48:49 +08:00 committed by GitHub
parent 1c834e747b
commit c2d356f0f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -290,8 +290,9 @@ func (s *testCommitterSuite) TestContextCancel2() {
s.Nil(err)
cancel()
// Secondary keys should not be canceled.
time.Sleep(time.Millisecond * 20)
s.False(s.isKeyLocked([]byte("b")))
s.Eventually(func() bool {
return !s.isKeyLocked([]byte("b"))
}, 2*time.Second, 20*time.Millisecond, "Secondary locks are not committed after 2 seconds")
}
func (s *testCommitterSuite) TestContextCancelRetryable() {