[#788] engine: Fix flaky tests

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2023-11-09 10:25:46 +03:00
parent 3534d6d05b
commit 1b22801eed

View file

@ -137,13 +137,12 @@ func TestLockUserScenario(t *testing.T) {
// 5. // 5.
e.HandleNewEpoch(lockerExpiresAfter + 1) e.HandleNewEpoch(lockerExpiresAfter + 1)
// delay for GC
time.Sleep(time.Second)
inhumePrm.WithTarget(tombAddr, objAddr) inhumePrm.WithTarget(tombAddr, objAddr)
require.Eventually(t, func() bool {
_, err = e.Inhume(context.Background(), inhumePrm) _, err = e.Inhume(context.Background(), inhumePrm)
require.NoError(t, err) return err == nil
}, 30*time.Second, time.Second)
} }
func TestLockExpiration(t *testing.T) { func TestLockExpiration(t *testing.T) {
@ -213,15 +212,13 @@ func TestLockExpiration(t *testing.T) {
// 3. // 3.
e.HandleNewEpoch(lockerExpiresAfter + 1) e.HandleNewEpoch(lockerExpiresAfter + 1)
// delay for GC processing. It can't be estimated, but making it bigger
// will slow down test
time.Sleep(time.Second)
// 4. // 4.
inhumePrm.WithTarget(oidtest.Address(), objectcore.AddressOf(obj)) inhumePrm.WithTarget(oidtest.Address(), objectcore.AddressOf(obj))
require.Eventually(t, func() bool {
_, err = e.Inhume(context.Background(), inhumePrm) _, err = e.Inhume(context.Background(), inhumePrm)
require.NoError(t, err) return err == nil
}, 30*time.Second, time.Second)
} }
func TestLockForceRemoval(t *testing.T) { func TestLockForceRemoval(t *testing.T) {