Fix flaky test #795

Merged
dstepanov-yadro merged 2 commits from dstepanov-yadro/frostfs-node:fix/test_lock_expiration into master 2024-09-04 19:51:04 +00:00
2 changed files with 9 additions and 14 deletions

View file

@ -137,13 +137,12 @@ func TestLockUserScenario(t *testing.T) {
// 5.
e.HandleNewEpoch(lockerExpiresAfter + 1)
// delay for GC
time.Sleep(time.Second)
Review

I think what we really need is manual GC execution: can we e.g. call removeGarbage explicitly or is it too much refactoring?

I think what we really need is manual GC execution: can we e.g. call `removeGarbage` explicitly or is it too much refactoring?
inhumePrm.WithTarget(tombAddr, objAddr)
_, err = e.Inhume(context.Background(), inhumePrm)
require.NoError(t, err)
require.Eventually(t, func() bool {
_, err = e.Inhume(context.Background(), inhumePrm)
return err == nil
}, 30*time.Second, time.Second)
}
func TestLockExpiration(t *testing.T) {
@ -213,15 +212,13 @@ func TestLockExpiration(t *testing.T) {
// 3.
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.
inhumePrm.WithTarget(oidtest.Address(), objectcore.AddressOf(obj))
_, err = e.Inhume(context.Background(), inhumePrm)
require.NoError(t, err)
require.Eventually(t, func() bool {
_, err = e.Inhume(context.Background(), inhumePrm)
return err == nil
}, 30*time.Second, time.Second)
}
func TestLockForceRemoval(t *testing.T) {

View file

@ -11,9 +11,7 @@ import (
policyengine "git.frostfs.info/TrueCloudLab/policy-engine"
)
var (
errAPEChainNoSource = errors.New("could not get ape chain source for the container")
)
var errAPEChainNoSource = errors.New("could not get ape chain source for the container")
type apeCheckerImpl struct {
log *logger.Logger