From edf921324b56b36faea6d20f152753630bffe734 Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 11 Dec 2025 17:50:00 +0800 Subject: [PATCH] Improve test reliability in TestSubscribeFrom by adjusting sleep durations and timestamp calculations. Increased sleep time to 1100ms for CI environment stability and modified timestamp capture to account for millisecond precision, ensuring accurate event timing in tests. --- trace/trace_subscription_test.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/trace/trace_subscription_test.go b/trace/trace_subscription_test.go index 4028f74a..77d4b81d 100644 --- a/trace/trace_subscription_test.go +++ b/trace/trace_subscription_test.go @@ -121,13 +121,17 @@ func TestSubscribeFrom(t *testing.T) { assert.NoError(t, err) // Wait to ensure different timestamp (simulate time passing) + // Use a longer sleep to account for CI environment variability time.Sleep(1100 * time.Millisecond) // Record timestamp (simulate user noting current time before refresh) - resumeTimestamp := time.Now().UnixMilli() + // Subtract 1ms to ensure we capture events that happen "now" + // This accounts for millisecond precision and timing variability in CI + resumeTimestamp := time.Now().UnixMilli() - 1 - // Wait again to ensure next operations are after resumeTimestamp - time.Sleep(100 * time.Millisecond) + // Wait to ensure next operations have a clearly different timestamp + // Use longer sleep for CI reliability + time.Sleep(500 * time.Millisecond) // Continue with more operations _, err = manager.Add("Step 2", types.TraceNodeOption{Label: "Finalizing"})