Streamline run log and update handling
This commit is contained in:
@@ -553,6 +553,27 @@ func TestOSProcessSupervisorRelaysRawCarriageReturn(t *testing.T) {
|
||||
if len(output) != 1 || output[0] != "stdout:raw\r" {
|
||||
t.Fatalf("expected raw CR to be relayed, got %+v", output)
|
||||
}
|
||||
if result.Stdout != "" || result.Stderr != "" {
|
||||
t.Fatalf("relayed process output must not be duplicated into result buffers, got %+v", result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestOSProcessSupervisorChunksLongRelayedLinesWithoutRewriting(t *testing.T) {
|
||||
var output []string
|
||||
result, err := (OSProcessSupervisor{}).Run(context.Background(), ProcessCommand{
|
||||
Args: []string{"sh", "-c", "printf %70000s | tr ' ' x"},
|
||||
OutputLine: func(stream string, line string) {
|
||||
if stream == "stdout" {
|
||||
output = append(output, line)
|
||||
}
|
||||
},
|
||||
})
|
||||
if err != nil || result.ExitCode != 0 {
|
||||
t.Fatalf("run process: result=%+v err=%v", result, err)
|
||||
}
|
||||
if len(output) < 2 || strings.Join(output, "") != strings.Repeat("x", 70000) {
|
||||
t.Fatalf("expected long relayed line to reassemble exactly, chunks=%d", len(output))
|
||||
}
|
||||
}
|
||||
|
||||
func TestProcessCommandJSONOmitsOutputCallback(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user