helper: Allow logs isolation per acceptance test #16356
Merged
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.
Why
We run nightly acceptance tests for and collect debug logs produced during the whole run. As we run tests in parallel for some providers (e.g. AWS), the logs get written to the file in parallel too which isn't very helpful for debugging, especially when you're trying to isolate a problem related to a single test and track down a chain of HTTP requests/responses and you have to skip unrelated messages just b/c another test happens to run at the same time.
This also means we only need to download a single ~0.5M file for the test that is actually failing instead of downloading debug log for the whole run (~650M in case of AWS).
How
This patch allows us to use a new ENV variable:
I have considered the option of using templating (
/log/location/test-{{.TestName}}.log
) instead of sprintf which would be safer (we'd know if interpolation failed), but I treat this as initial version we can iterate on and potentially break the convention as it's only used during test runs, not by users, so we don't need to be worried as much about deprecation etc.Example
Future
I reckon we might have more advanced/formalised tracing and logging which would allow the user to send logs with more context somewhere they can process them more efficiently and easily in the future. This is IMO much bigger project and this patch isn't supposed to address that.