WIP: Morph: Add unit tests #2

Closed
dstepanov-yadro wants to merge 233 commits from TrueCloudLab/frostfs-node:master into object-3608-morph-unit-tests
Showing only changes of commit 365a7ca0f4 - Show all commits

View file

@ -76,7 +76,7 @@ type gc struct {
workerPool util.WorkerPool
remover func()
remover func(context.Context)
eventChan chan Event
mEventHandler map[eventType]*eventHandlers
@ -115,7 +115,7 @@ func (gc *gc) init(ctx context.Context) {
}
gc.wg.Add(2)
go gc.tickRemover()
go gc.tickRemover(ctx)
go gc.listenEvents(ctx)
}
@ -160,7 +160,7 @@ func (gc *gc) listenEvents(ctx context.Context) {
}
}
func (gc *gc) tickRemover() {
func (gc *gc) tickRemover(ctx context.Context) {
defer gc.wg.Done()
timer := time.NewTimer(gc.removerInterval)
@ -178,7 +178,7 @@ func (gc *gc) tickRemover() {
gc.log.Debug(logs.ShardGCIsStopped)
return
case <-timer.C:
gc.remover()
gc.remover(ctx)
timer.Reset(gc.removerInterval)
}
}
@ -196,8 +196,8 @@ func (gc *gc) stop() {
// iterates over metabase and deletes objects
// with GC-marked graves.
// Does nothing if shard is in "read-only" mode.
func (s *Shard) removeGarbage() {
ctx, cancel := context.WithCancel(context.Background())
func (s *Shard) removeGarbage(pctx context.Context) {
ctx, cancel := context.WithCancel(pctx)
defer cancel()
s.gcCancel.Store(cancel)