(t *testing.T)
| 144 | } |
| 145 | |
| 146 | func TestHeadTailBuffer_LongLineTruncation(t *testing.T) { |
| 147 | t.Parallel() |
| 148 | |
| 149 | buf := agentproc.NewHeadTailBuffer() |
| 150 | |
| 151 | // Write a line longer than MaxLineLength. |
| 152 | longLine := strings.Repeat("m", agentproc.MaxLineLength+500) |
| 153 | _, err := buf.Write([]byte(longLine + "\n")) |
| 154 | require.NoError(t, err) |
| 155 | |
| 156 | out, _ := buf.Output() |
| 157 | lines := strings.Split(strings.TrimRight(out, "\n"), "\n") |
| 158 | require.Len(t, lines, 1) |
| 159 | require.LessOrEqual(t, len(lines[0]), agentproc.MaxLineLength) |
| 160 | require.True(t, strings.HasSuffix(lines[0], "... [truncated]")) |
| 161 | } |
| 162 | |
| 163 | func TestHeadTailBuffer_LongLineInTail(t *testing.T) { |
| 164 | t.Parallel() |
nothing calls this directly
no test coverage detected