satellite/gracefulexit: de-flake TestNodeFailingGracefulExitWithLowOnlineScore

I can't say with certainty yet what caused the two failures I know
about, but I have one theory: the node continuing to check in during the
test skewed the online score towards 1, and using the test default for
GracefulExitDurationInDays meant there were fewer update periods than
expected.

At any rate, it is more correct to pause the graceful exit processing
chore and the contact chore during the test, even if it doesn't end up
solving the problem.

Refs: https://github.com/storj/storj/issues/6401
Change-Id: I06d43d531e0b3344af13878c8d55213349fdcfa3
This commit is contained in:
paul cannon 2023-11-06 12:17:11 -06:00 committed by Storj Robot
parent 00cb237a90
commit 084719cde1

View File

@ -1931,12 +1931,16 @@ func TestNodeFailingGracefulExitWithLowOnlineScore(t *testing.T) {
config.Reputation.FlushInterval = 0 config.Reputation.FlushInterval = 0
config.GracefulExit.MinimumOnlineScore = 0.6 config.GracefulExit.MinimumOnlineScore = 0.6
config.GracefulExit.TimeBased = true config.GracefulExit.TimeBased = true
config.GracefulExit.GracefulExitDurationInDays = 30
}, },
}, },
}, func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet) { }, func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet) {
satellite := planet.Satellites[0] satellite := planet.Satellites[0]
exitingNode := planet.StorageNodes[0] exitingNode := planet.StorageNodes[0]
exitingNode.GracefulExit.Chore.Loop.Pause()
exitingNode.Contact.Chore.Pause(ctx)
simTime := time.Now() simTime := time.Now()
satellite.GracefulExit.Endpoint.SetNowFunc(func() time.Time { return simTime }) satellite.GracefulExit.Endpoint.SetNowFunc(func() time.Time { return simTime })
doneTime := simTime.AddDate(0, 0, satellite.Config.GracefulExit.GracefulExitDurationInDays) doneTime := simTime.AddDate(0, 0, satellite.Config.GracefulExit.GracefulExitDurationInDays)