Merge pull request #1461 from trheyi/main

Ensure SafeWriter is closed before reading buffer in test
This commit is contained in:
Max 2026-02-11 17:08:05 +08:00 committed by GitHub
commit 2c44071a93
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1041,6 +1041,11 @@ func TestJsValueStreamingWorkflow(t *testing.T) {
}
assert.Equal(t, true, result["success"], "Streaming workflow should work correctly")
// Close SafeWriter to flush all pending async writes before reading buffer.
// SafeWriter processes writes in a background goroutine via channel;
// without this, the buffer may still be empty on slow CI runners.
cxt.CloseSafeWriter()
// Verify the complete workflow events
output := mockWriter.buffer.String()
assert.Contains(t, output, "message_start", "Output should contain message_start")