forked from TrueCloudLab/frostfs-node
[#668] shard/test: Disable GC where it is not needed
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
42696016de
commit
382eb8a485
2 changed files with 9 additions and 2 deletions
|
@ -119,6 +119,8 @@ type gcCfg struct {
|
|||
expiredCollectorBatchSize int
|
||||
|
||||
metrics GCMectrics
|
||||
|
||||
testHookRemover func(ctx context.Context) gcRunResult
|
||||
}
|
||||
|
||||
func defaultGCCfg() gcCfg {
|
||||
|
@ -209,7 +211,12 @@ func (gc *gc) tickRemover(ctx context.Context) {
|
|||
case <-timer.C:
|
||||
startedAt := time.Now()
|
||||
|
||||
result := gc.remover(ctx)
|
||||
var result gcRunResult
|
||||
if gc.testHookRemover != nil {
|
||||
result = gc.testHookRemover(ctx)
|
||||
} else {
|
||||
result = gc.remover(ctx)
|
||||
}
|
||||
timer.Reset(gc.removerInterval)
|
||||
|
||||
gc.metrics.AddRunDuration(time.Since(startedAt), result.success)
|
||||
|
|
|
@ -75,7 +75,7 @@ func Test_ObjectNotFoundIfNotDeletedFromMetabase(t *testing.T) {
|
|||
}
|
||||
|
||||
sh = New(opts...)
|
||||
|
||||
sh.gcCfg.testHookRemover = func(context.Context) gcRunResult { return gcRunResult{} }
|
||||
require.NoError(t, sh.Open())
|
||||
require.NoError(t, sh.Init(context.Background()))
|
||||
|
||||
|
|
Loading…
Reference in a new issue