From 360fa7d1cd309007b7bbf00c6b6643ffeda74d99 Mon Sep 17 00:00:00 2001 From: Juan Fernandez Date: Fri, 8 May 2026 11:17:40 -0400 Subject: [PATCH] Fixes flaky test (#37026) Resolves #37026 Fixes flaky calendar cron test. --- server/cron/calendar_cron_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/server/cron/calendar_cron_test.go b/server/cron/calendar_cron_test.go index 5fab6bc5a6..8a14c8a045 100644 --- a/server/cron/calendar_cron_test.go +++ b/server/cron/calendar_cron_test.go @@ -704,6 +704,17 @@ func TestCalendarEvents1KHosts(t *testing.T) { return nil } + // On Tuesdays during work hours, events get scheduled for the next 30-min + // slot today and can elapse before the second cron runs. deleteCalendarEvent + // then skips the calendar delete (eventInFuture is false) and events leak + // into the assertion below. Push StartTime/EndTime far enough out that the + // boundary can never be crossed during the test. + futureStart := time.Now().Add(24 * time.Hour) + for _, ev := range eventPerHost { + ev.StartTime = futureStart + ev.EndTime = futureStart.Add(30 * time.Minute) + } + err = cronCalendarEvents(ctx, ds, distributedLock, defaultCalendarConfig, logger) require.NoError(t, err)