Ensure SafeWriter is closed before reading buffer in test
- Added a call to `CloseSafeWriter` in `TestJsValueStreamingWorkflow` to flush all pending async writes before reading the output buffer. This change improves test reliability, particularly on slow CI runners, by preventing potential issues with empty buffers.
This commit is contained in:
parent
1b028abdef
commit
831f3051ea
1 changed files with 5 additions and 0 deletions
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue