(t *testing.T)
| 320 | } |
| 321 | |
| 322 | func TestHeadTailBuffer_MultipleLinesTruncated(t *testing.T) { |
| 323 | t.Parallel() |
| 324 | |
| 325 | buf := agentproc.NewHeadTailBuffer() |
| 326 | |
| 327 | short := "short line\n" |
| 328 | long := strings.Repeat("L", agentproc.MaxLineLength+100) + "\n" |
| 329 | _, err := buf.Write([]byte(short + long + short)) |
| 330 | require.NoError(t, err) |
| 331 | |
| 332 | out, _ := buf.Output() |
| 333 | lines := strings.Split(strings.TrimRight(out, "\n"), "\n") |
| 334 | require.Len(t, lines, 3) |
| 335 | require.Equal(t, "short line", lines[0]) |
| 336 | require.True(t, strings.HasSuffix(lines[1], "... [truncated]")) |
| 337 | require.Equal(t, "short line", lines[2]) |
| 338 | } |
nothing calls this directly
no test coverage detected