From 4399a6c1ab1855459d4be87414a06157cfd45028 Mon Sep 17 00:00:00 2001 From: Gani Georgiev Date: Fri, 12 Dec 2025 08:48:29 +0200 Subject: [PATCH] added small threshold for the cron time based tests --- tools/cron/cron_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/cron/cron_test.go b/tools/cron/cron_test.go index 6ed73cb4..8b18dc1a 100644 --- a/tools/cron/cron_test.go +++ b/tools/cron/cron_test.go @@ -258,7 +258,7 @@ func TestCronStartStop(t *testing.T) { c := New() - c.SetInterval(500 * time.Millisecond) + c.SetInterval(250 * time.Millisecond) c.Add("test1", "* * * * *", func() { test1++ @@ -274,7 +274,7 @@ func TestCronStartStop(t *testing.T) { c.Start() c.Start() - time.Sleep(1 * time.Second) + time.Sleep(505 * time.Millisecond) // slightly larger to minimize flakiness // call twice Stop to ensure that the second stop is no-op c.Stop() @@ -287,10 +287,10 @@ func TestCronStartStop(t *testing.T) { t.Fatalf("Expected %d test2, got %d", expectedCalls, test2) } - // resume for 2 seconds + // resume for 1 seconds c.Start() - time.Sleep(2 * time.Second) + time.Sleep(1005 * time.Millisecond) // slightly larger to minimize flakiness c.Stop()