Finish porting all tests from Python to Golang from test_harvester.py#24397
Finish porting all tests from Python to Golang from test_harvester.py#24397kvch wants to merge 2 commits intoelastic:masterfrom
Conversation
|
Pinging @elastic/agent (Team:Agent) |
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
Trends 🧪💚 Flaky test reportTests succeeded. Expand to view the summary
Test stats 🧪
|
Nice. Would it be possible to split the PR into 2 PRs to speed up review and ease discussions? The first PR only adds the new tests that run through. And the second PR with the fix + tests for the 'truncate' problem. |
What does this PR do?
This PR finishes porting tests from
test_harvester.py. It is based on #24250.Why is it important?
Two problems were discovered while porting tests:
lack of support of trucated files
The support for stopping reading from truncated files was already implemented. However,
filestreaminput could not start reading it from the beginning.A new file system event is added called
OpTruncate. When the size of a file has shrinked compared to the last time the scanner has encountered it, anOpTruncateevent is emitted. When the prospector gets this event, theHarvesterGroupis restarting theHarvesterof the file. Restarting basically means that the newHarvesterwaits for the previous one to finish and then starts reading the file from the beginning. The wait has a predefined timeout which is not the best solution, but I did not want to introduce waiting indefinitely until the context is cancelled for a Harvester. Although, this might be the right approach...encoding configuration
Encoding configuration could not be parsed from the configuration. After fixing this, there was not any new problems because most of the underlying code is already covered by unit tests.
Checklist
- [ ] I have made corresponding changes to the documentation- [ ] I have made corresponding change to the default configuration files- [ ] I have added an entry inCHANGELOG.next.asciidocorCHANGELOG-developer.next.asciidoc.