satellite/metabase/rangedloop: disable ranged loop for tests
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
This commit is contained in:
parent
95d87f5a22
commit
5d0934e4d9
@ -30,7 +30,7 @@ type Config struct {
|
|||||||
Parallelism int `help:"how many chunks of segments to process in parallel" default:"2"`
|
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"`
|
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"`
|
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"`
|
SuspiciousProcessedRatio float64 `help:"ratio where to consider processed count as supicious" default:"0.03"`
|
||||||
}
|
}
|
||||||
@ -93,6 +93,10 @@ func (service *Service) Close() error {
|
|||||||
func (service *Service) Run(ctx context.Context) (err error) {
|
func (service *Service) Run(ctx context.Context) (err error) {
|
||||||
defer mon.Task()(&ctx)(&err)
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
|
||||||
|
if service.config.Interval == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
service.log.Info("ranged loop initialized")
|
service.log.Info("ranged loop initialized")
|
||||||
|
|
||||||
return service.Loop.Run(ctx, func(ctx context.Context) error {
|
return service.Loop.Run(ctx, func(ctx context.Context) error {
|
||||||
|
@ -590,7 +590,12 @@ func TestObserver_PlacementCheck(t *testing.T) {
|
|||||||
testplanet.Run(t, testplanet.Config{
|
testplanet.Run(t, testplanet.Config{
|
||||||
SatelliteCount: 1, StorageNodeCount: 4, UplinkCount: 1,
|
SatelliteCount: 1, StorageNodeCount: 4, UplinkCount: 1,
|
||||||
Reconfigure: testplanet.Reconfigure{
|
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) {
|
}, func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet) {
|
||||||
planet.Satellites[0].RangedLoop.RangedLoop.Service.Loop.Pause()
|
planet.Satellites[0].RangedLoop.RangedLoop.Service.Loop.Pause()
|
||||||
|
Loading…
Reference in New Issue
Block a user