[9.1] (backport #18525) Stop tests from polluting maven settings #18528
+5
−1
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.
Release notes
[rn:skip]
What does this PR do?
The pluginmanager tests modify
~/.m2/settings.xml. Previously when that file exists it would be restored on test cleanup. However if that file did not exist prior to the tests, the file with nonsense values generated during testing would persist. This would cause subsequent issues when the pluginmanager or other systems that respect those maven settings. This commit updates the test to ensure the test file is deleted if it did not previously exist.Previously any developer who run the tests locally and did not have an existing
~/.m2/settings.xmlwould get a file with nonsense proxies which would break the pluginmanager's ability to download jar dependencies of gems.NOTE: Fortunately this did not affect logstash artifact creation because we do testing/packaging on separate hosts.
How to test this PR locally
Logs
Previously the tests would leave behing a file like:
This would cause issues with the pluginmanager when jar-dependencies need to dowload jars for gem installation. Unfortunately that is masked because of retry logic (the jar is failed to be downlaoded but the rest of the gem code is, so on the second retry the pluginmanager thinks the complete gem has been installed).
This is an automatic backport of pull request #18525 done by Mergify.