[VC-35738] Append errgroup errors to the error returned by Agent.Run #606
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.
In #599 (comment) I caused a bug where the error from the errgroup Go routines is discarded rather than being logged and causing the process to exit.
How did I notice this bug? I noticed the problem while testing a revision of #603 where I wrapped nil DataGatherer.Run early return into an error...but was not seeing the resulting error. It turns out that is the wrong behaviour and I found an additional bug #605 so I have since reverted that change.
I didn't write automated test for this because I feel like we will be refactoring and simplifying the agent Run code in future and I just want to get the logging sorted out.
But I did test this manually as follows:
You can see a log message about the API server skipping the shutdown sequence because the server has already stopped due to port 8081 is already being occupied,
but the error from the errgroup Go routine is being lost.
This time the test fails because the errgroup error has been properly bubbled up to the main function.