From 8f6bbb59c742e9d3ce56615a8b21bf504b3a56b9 Mon Sep 17 00:00:00 2001 From: haruka <1628615876@qq.com> Date: Sun, 20 Sep 2026 15:04:15 +0800 Subject: [PATCH] test: stabilize Gemini keepalive test --- backend/internal/service/gemini_sse_comment_compat_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/internal/service/gemini_sse_comment_compat_test.go b/backend/internal/service/gemini_sse_comment_compat_test.go index 360f51ad38..c53e18ca0c 100644 --- a/backend/internal/service/gemini_sse_comment_compat_test.go +++ b/backend/internal/service/gemini_sse_comment_compat_test.go @@ -81,7 +81,11 @@ func runAntigravityGeminiStreamWithIdle(t *testing.T, userAgent string, idle tim } func TestAntigravityGeminiStreamKeepsCommentKeepaliveForOrdinaryClients(t *testing.T) { - out := runAntigravityGeminiStreamWithIdle(t, "curl/8.7.1", 1200*time.Millisecond) + // The keepalive interval is configured in whole seconds. Leave enough idle + // time for the first data event to be processed before the ticker fires; + // otherwise a busy CI runner can consume the first tick too early and close + // the stream before any heartbeat is written. + out := runAntigravityGeminiStreamWithIdle(t, "curl/8.7.1", 2200*time.Millisecond) require.Contains(t, out, ":\n\n", "ordinary clients should still get the idle keepalive") require.Contains(t, out, `"text":"partial"`) }