RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
fix: unstable tests (#20838)
Jin Haic890faa9b023
diff --git a/internal/harness/core/cancel_full_test.go b/internal/harness/core/cancel_full_test.goindex 166f0a9391..2d89fd8d40 100644--- a/internal/harness/core/cancel_full_test.go+++ b/internal/harness/core/cancel_full_test.go@@ -561,8 +561,11 @@ func TestWithCancel_SequentialAgent(t *testing.T) {t.Fatalf("NewSequential: %v", err)}opt, cancel := WithCancel()- iter := wf.Run(ctx, &AgentInput{Messages: []Message{schema.UserMessage("run")}}, opt)+ // Cancel before Run: with the default immediate mode and instant mock+ // sub-agents, the workflow goroutine can otherwise finish on another OS+ // thread before cancel() is observed, leaving no CancelError in the stream.cancel()+ iter := wf.Run(ctx, &AgentInput{Messages: []Message{schema.UserMessage("run")}}, opt)drainAndAssertCancelError(t, iter)}@@ -581,8 +584,11 @@ func TestWithCancel_LoopAgent(t *testing.T) {t.Fatalf("NewLoop: %v", err)}opt, cancel := WithCancel()- iter := wf.Run(ctx, &AgentInput{Messages: []Message{schema.UserMessage("run")}}, opt)+ // Cancel before Run: with the default immediate mode and instant mock+ // sub-agents, the workflow goroutine can otherwise finish on another OS+ // thread before cancel() is observed, leaving no CancelError in the stream.cancel()+ iter := wf.Run(ctx, &AgentInput{Messages: []Message{schema.UserMessage("run")}}, opt)drainAndAssertCancelError(t, iter)}@@ -601,8 +607,11 @@ func TestWithCancel_ParallelAgent(t *testing.T) {t.Fatalf("NewParallel: %v", err)}opt, cancel := WithCancel()- iter := wf.Run(ctx, &AgentInput{Messages: []Message{schema.UserMessage("run")}}, opt)+ // Cancel before Run: with the default immediate mode and instant mock+ // sub-agents, the workflow goroutine can otherwise finish on another OS+ // thread before cancel() is observed, leaving no CancelError in the stream.cancel()+ iter := wf.Run(ctx, &AgentInput{Messages: []Message{schema.UserMessage("run")}}, opt)drainAndAssertCancelError(t, iter)}