(t *testing.T)
| 161 | } |
| 162 | |
| 163 | func TestHeadTailBuffer_LongLineInTail(t *testing.T) { |
| 164 | t.Parallel() |
| 165 | |
| 166 | // Use small buffers so we can force data into the tail. |
| 167 | buf := agentproc.NewHeadTailBufferSized(20, 5000) |
| 168 | |
| 169 | // Fill head with short data. |
| 170 | _, err := buf.Write([]byte("head data goes here\n")) |
| 171 | require.NoError(t, err) |
| 172 | |
| 173 | // Now write a very long line into the tail. |
| 174 | longLine := strings.Repeat("T", agentproc.MaxLineLength+100) |
| 175 | _, err = buf.Write([]byte(longLine + "\n")) |
| 176 | require.NoError(t, err) |
| 177 | |
| 178 | out, info := buf.Output() |
| 179 | require.NotNil(t, info) |
| 180 | // The long line in the tail should be truncated. |
| 181 | require.Contains(t, out, "... [truncated]") |
| 182 | } |
| 183 | |
| 184 | func TestHeadTailBuffer_ConcurrentWrites(t *testing.T) { |
| 185 | t.Parallel() |
nothing calls this directly
no test coverage detected