Finish porting all tests from Python to Golang from test_harvester.py #24397
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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,
filestream
input 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, anOpTruncate
event is emitted. When the prospector gets this event, theHarvesterGroup
is restarting theHarvester
of the file. Restarting basically means that the newHarvester
waits 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.asciidoc
orCHANGELOG-developer.next.asciidoc
.