This repository was archived by the owner on Aug 30, 2019. It is now read-only.
config: added tests for various hostname acquisition strategies#472
Merged
Conversation
gbbr
commented
Sep 18, 2018
|
|
||
| cfg, err := config.Load(flags.ConfigPath) | ||
| if err != nil { | ||
| if !os.IsNotExist(err) { |
Contributor
Author
There was a problem hiding this comment.
The logic was moved into config.Load because config should be validated when loaded, not separately using another call. This way, the config is loaded, validated, and overridden from environment in one call.
gbbr
force-pushed
the
gbbr/config-test
branch
from
September 18, 2018 09:35
326ad5d to
dc493b9
Compare
gbbr
force-pushed
the
gbbr/config-test
branch
from
September 18, 2018 09:37
dc493b9 to
db8f870
Compare
ufoot
approved these changes
Sep 18, 2018
| return nil | ||
| } | ||
|
|
||
| // LoadEnv reads environment variable values into the config. |
There was a problem hiding this comment.
Love the fact this does not need to be public any more as Load encapsulates it all.
LotharSee
approved these changes
Sep 18, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This change ensures that configuration can only be loaded if it is valid. It adds tests for various hostname acquisition strategies to ensure hostname is always set or otherwise trace agent should fail to start.
It also renames folders
test_casestotestdata, which seems more common for Go.