Skip to content

Commit

Permalink
satellite/metabase/rangedloop: disable ranged loop for tests
Browse files Browse the repository at this point in the history
Currently each testplanet test is running ranged loop no matter if
it's used or not. This is small change with some benefits like:
* saves some cpu cycles
* less log entries
* ranged loop won't interfere with other systems

Change have no big impact on tests execration but I believe it's nice to
have.

Change-Id: I731846bf625cac47ed4f3ca3bc1d1a4659bdcce8
  • Loading branch information
mniewrzal authored and Storj Robot committed Sep 18, 2023
1 parent 95d87f5 commit 5d0934e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 5 additions & 1 deletion satellite/metabase/rangedloop/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type Config struct {
Parallelism int `help:"how many chunks of segments to process in parallel" default:"2"`
BatchSize int `help:"how many items to query in a batch" default:"2500"`
AsOfSystemInterval time.Duration `help:"as of system interval" releaseDefault:"-5m" devDefault:"-1us" testDefault:"-1us"`
Interval time.Duration `help:"how often to run the loop" releaseDefault:"2h" devDefault:"10s" testDefault:"10s"`
Interval time.Duration `help:"how often to run the loop" releaseDefault:"2h" devDefault:"10s" testDefault:"0"`

SuspiciousProcessedRatio float64 `help:"ratio where to consider processed count as supicious" default:"0.03"`
}
Expand Down Expand Up @@ -93,6 +93,10 @@ func (service *Service) Close() error {
func (service *Service) Run(ctx context.Context) (err error) {
defer mon.Task()(&ctx)(&err)

if service.config.Interval == 0 {
return nil
}

service.log.Info("ranged loop initialized")

return service.Loop.Run(ctx, func(ctx context.Context) error {
Expand Down
7 changes: 6 additions & 1 deletion satellite/repair/checker/observer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,12 @@ func TestObserver_PlacementCheck(t *testing.T) {
testplanet.Run(t, testplanet.Config{
SatelliteCount: 1, StorageNodeCount: 4, UplinkCount: 1,
Reconfigure: testplanet.Reconfigure{
Satellite: testplanet.ReconfigureRS(1, 2, 4, 4),
Satellite: testplanet.Combine(
testplanet.ReconfigureRS(1, 2, 4, 4),
func(log *zap.Logger, index int, config *satellite.Config) {
config.RangedLoop.Interval = 10 * time.Second
},
),
},
}, func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet) {
planet.Satellites[0].RangedLoop.RangedLoop.Service.Loop.Pause()
Expand Down

0 comments on commit 5d0934e

Please sign in to comment.