@@ -5,6 +5,7 @@ This directory contains end-to-end integration tests for the Devlog Collector.
55## Overview
66
77Integration tests verify that all components work correctly together:
8+
89- Agent adapters (log parsing)
910- File system watcher (monitoring)
1011- HTTP client (batching, retry)
@@ -14,60 +15,72 @@ Integration tests verify that all components work correctly together:
1415## Test Scenarios
1516
1617### 1. ` TestEndToEnd_CopilotLogParsing `
18+
1719Verifies the complete flow from Copilot log file to backend API.
1820
1921** What it tests** :
22+
2023- Log file parsing with Copilot adapter
2124- Event extraction and formatting
2225- HTTP client batching and sending
2326- Backend API integration
2427- Data integrity through the pipeline
2528
2629** Expected behavior** :
30+
2731- 2 events parsed from sample log
2832- All events reach backend
2933- Event metadata preserved (agent ID, type, file path)
3034
3135### 2. ` TestEndToEnd_OfflineBuffering `
36+
3237Verifies offline buffering when backend is unavailable.
3338
3439** What it tests** :
40+
3541- Detection of backend failures
3642- Automatic buffering to SQLite
3743- Event persistence across restarts
3844- Automatic retry when backend recovers
3945- Buffer cleanup after successful send
4046
4147** Expected behavior** :
48+
4249- Events buffered when backend down (503)
4350- Events retrieved from buffer intact
4451- Events sent successfully when backend up
4552- Buffer cleared after send
4653
4754### 3. ` TestEndToEnd_LogRotation `
55+
4856Verifies handling of log file rotation.
4957
5058** What it tests** :
59+
5160- Processing events from initial file
5261- Detection of file rotation
5362- Processing events from new file
5463- No data loss during rotation
5564
5665** Expected behavior** :
66+
5767- Events from both files processed
5868- Rotation handled gracefully
5969- No duplicate or missed events
6070
6171### 4. ` TestEndToEnd_HighVolume `
72+
6273Verifies performance with many events.
6374
6475** What it tests** :
76+
6577- Parsing 100 events efficiently
6678- Batching optimization
6779- Memory management
6880- Throughput
6981
7082** Expected behavior** :
83+
7184- 100/100 events processed (100% success)
7285- Processing completes in <5 seconds
7386- No memory leaks
@@ -91,6 +104,7 @@ go test ./internal/integration -short
91104## Test Environment
92105
93106Each test creates an isolated environment:
107+
94108- Temporary directory (auto-cleanup)
95109- Mock HTTP backend
96110- Real components (minimal mocking)
@@ -116,7 +130,7 @@ func TestEndToEnd_YourScenario(t *testing.T) {
116130 // Initialize components
117131 registry := adapters.DefaultRegistry (" test-project" )
118132 adapter := adapters.NewCopilotAdapter (" test-project" )
119-
133+
120134 // ... rest of setup
121135
122136 // Write test log files
@@ -142,17 +156,20 @@ func TestEndToEnd_YourScenario(t *testing.T) {
142156## Debugging Failed Tests
143157
144158### Enable verbose logging
159+
145160``` go
146161log := logrus.New ()
147162log.SetLevel (logrus.DebugLevel )
148163```
149164
150165### Check test output
166+
151167``` bash
152168go test ./internal/integration -v 2>&1 | tee test.log
153169```
154170
155171### Inspect temp files
172+
156173``` go
157174// Add this to prevent cleanup
158175tmpDir := t.TempDir ()
@@ -163,16 +180,19 @@ t.Logf("Test directory: %s", tmpDir)
163180## Common Issues
164181
165182** Events not received by backend** :
183+
166184- Check batching delay (increase wait time)
167185- Verify log format matches adapter expectations
168186- Check mock server handler logic
169187
170188** Buffer not storing events** :
189+
171190- Ensure SendSingleEvent used (not SendEvent)
172191- Verify backend returns failure status
173192- Check buffer configuration
174193
175194** Timing issues** :
195+
176196- Increase sleep durations
177197- Use polling instead of fixed delays
178198- Check debounce settings
@@ -189,6 +209,7 @@ For continuous integration:
189209` ` `
190210
191211For faster CI (skip slow tests):
212+
192213` ` ` bash
193214go test ./internal/integration -short
194215```
@@ -198,7 +219,7 @@ go test ./internal/integration -short
198219Expected performance on modern hardware:
199220
200221- Log parsing: ~ 5,000 events/second
201- - HTTP batching: ~ 1,000 events/second
222+ - HTTP batching: ~ 1,000 events/second
202223- Buffer operations: <1ms per event
203224- End-to-end latency: <100ms per event
204225
@@ -211,6 +232,7 @@ Expected performance on modern hardware:
211232## Support
212233
213234For issues with integration tests:
235+
2142361 . Check test output for specific failures
2152372 . Enable debug logging
2162383 . Verify component configurations
0 commit comments