feat: make LoadHTTPConfigFile set directory and move from tests file #415
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.
Move away the functions from the test files since they are not only test helper.
For motivation, see prometheus/prometheus#11487
Also add setting directory
cfg.SetDirectory(filepath.Dir(filepath.Dir(filename)))
as used in Alertmanager seehttps://github.com/prometheus/alertmanager/blob/1a9f55b939ab81b86428c013ae294ad80779c9b6/cli/config/http_config.go#L36
Prometheus does not use the
LoadHTTPConfigFile
function AFAIK, so the change in setting the directory won't break anything, hopefully.Other possibility is to avoid setting the directory and fix this on the Alertmanager side outside the common library.
That might be safer (function is exported, so it could be breaking change for someone, possibly?)
@roidelapluie PTAL