From b348a99b03bf49bae6b8a97a0547c94bdcd5d2e9 Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Tue, 16 Dec 2025 17:40:51 +0100 Subject: [PATCH] chore: move defaults to constants Signed-off-by: Ettore Di Giacinto --- pkg/model/watchdog_options.go | 7 +++++-- pkg/model/watchdog_test.go | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/pkg/model/watchdog_options.go b/pkg/model/watchdog_options.go index cb21b019e..100d07f6e 100644 --- a/pkg/model/watchdog_options.go +++ b/pkg/model/watchdog_options.go @@ -4,7 +4,10 @@ import ( "time" ) -const DefaultWatchdogInterval = 500 * time.Millisecond +const ( + DefaultWatchdogInterval = 500 * time.Millisecond + DefaultMemoryReclaimerThreshold = 0.80 +) // WatchDogOptions contains all configuration for the WatchDog type WatchDogOptions struct { @@ -112,7 +115,7 @@ func DefaultWatchDogOptions() *WatchDogOptions { idleCheck: false, lruLimit: 0, memoryReclaimerEnabled: false, - memoryReclaimerThreshold: 0.80, + memoryReclaimerThreshold: DefaultMemoryReclaimerThreshold, } } diff --git a/pkg/model/watchdog_test.go b/pkg/model/watchdog_test.go index da25bdf4d..81085907a 100644 --- a/pkg/model/watchdog_test.go +++ b/pkg/model/watchdog_test.go @@ -107,7 +107,7 @@ var _ = Describe("WatchDog", func() { model.WithProcessManager(pm), ) _, threshold := wd.GetMemoryReclaimerSettings() - Expect(threshold).To(Equal(0.95)) // default + Expect(threshold).To(Equal(model.DefaultMemoryReclaimerThreshold)) }) It("should allow updating memory reclaimer settings dynamically", func() { @@ -318,7 +318,7 @@ var _ = Describe("WatchDog", func() { enabled, threshold := wd.GetMemoryReclaimerSettings() Expect(enabled).To(BeFalse()) - Expect(threshold).To(Equal(0.95)) + Expect(threshold).To(Equal(model.DefaultMemoryReclaimerThreshold)) }) It("should allow combining multiple options", func() {