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
2 changed files with 16 additions and 2 deletions
Showing only changes of commit a181c9e434 - Show all commits

View file

@ -478,4 +478,10 @@ const (
FrostFSNodeContainerRemovalEventReceivedButTreesWerentRemoved = "container removal event received, but trees weren't removed" // Error in ../node/cmd/frostfs-node/tree.go
FrostFSNodeCantListenGRPCEndpointControl = "can't listen gRPC endpoint (control)" // Error in ../node/cmd/frostfs-node/control.go
CommonApplicationStarted = "application started" // Info in ../node/cmd/frostfs-ir/main.go
ShardGCCollectingExpiredObjectsStarted = "collecting expired objects started"
ShardGCCollectingExpiredObjectsCompleted = "collecting expired objects completed"
ShardGCCollectingExpiredLocksStarted = "collecting expired locks started"
ShardGCCollectingExpiredLocksCompleted = "collecting expired locks completed"
ShardGCRemoveGarbageStarted = "garbage remove started"
ShardGCRemoveGarbageCompleted = "garbage remove completed"
)

View file

@ -204,6 +204,9 @@ func (s *Shard) removeGarbage() {
return
}
s.log.Debug(logs.ShardGCRemoveGarbageStarted)
defer s.log.Debug(logs.ShardGCRemoveGarbageCompleted)
buf := make([]oid.Address, 0, s.rmBatchSize)
var iterPrm meta.GarbageIterationPrm
@ -259,6 +262,9 @@ func (s *Shard) getExpiredObjectsParameters() (workersCount, batchSize int) {
}
func (s *Shard) collectExpiredObjects(ctx context.Context, e Event) {
s.log.Debug(logs.ShardGCCollectingExpiredObjectsStarted, zap.Uint64("epoch", e.(newEpoch).epoch))
defer s.log.Debug(logs.ShardGCCollectingExpiredObjectsCompleted, zap.Uint64("epoch", e.(newEpoch).epoch))
workersCount, batchSize := s.getExpiredObjectsParameters()
errGroup, egCtx := errgroup.WithContext(ctx)
@ -344,6 +350,7 @@ func (s *Shard) collectExpiredTombstones(ctx context.Context, e Event) {
log := s.log.With(zap.Uint64("epoch", epoch))
log.Debug(logs.ShardStartedExpiredTombstonesHandling)
defer log.Debug(logs.ShardFinishedExpiredTombstonesHandling)
const tssDeleteBatch = 50
tss := make([]meta.TombstonedObject, 0, tssDeleteBatch)
@ -400,11 +407,12 @@ func (s *Shard) collectExpiredTombstones(ctx context.Context, e Event) {
tss = tss[:0]
tssExp = tssExp[:0]
}
log.Debug(logs.ShardFinishedExpiredTombstonesHandling)
}
func (s *Shard) collectExpiredLocks(ctx context.Context, e Event) {
s.log.Debug(logs.ShardGCCollectingExpiredLocksStarted, zap.Uint64("epoch", e.(newEpoch).epoch))
defer s.log.Debug(logs.ShardGCCollectingExpiredLocksCompleted, zap.Uint64("epoch", e.(newEpoch).epoch))
workersCount, batchSize := s.getExpiredObjectsParameters()
errGroup, egCtx := errgroup.WithContext(ctx)