-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Log the list of config files loaded when starting the nomad agent #536
Conversation
@@ -266,6 +266,12 @@ func TestConfig_LoadConfig(t *testing.T) { | |||
t.Fatalf("bad: %#v", config) | |||
} | |||
|
|||
expectedConfigFiles := []string{fh.Name()} | |||
if !reflect.DeepEqual(config.Files, expectedConfigFiles) { | |||
t.Errorf("Loaded configs don't match\nExpected\n%+vGot\n%+v\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kinda weird style: Could it instead be t.Errorf("Loaded configs don't match: want %#v; got %#v"
You don't need the last \n anyways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I use this pattern when dumping a complex type (struct, list, etc.) because each will appear on its own line. This makes it easier to spot the differences and/or copy-paste into a diff program if it's very large.
For example, this is easy to read:
Loaded configs don't match: want 1; got 2
But this is not:
Loaded configs don't match: want []string{"charlie", "bracvo", "delta"}; got []string{"charlie", "bravco", "delta"}
The pattern I used shows up like this when the comparison fails:
Loaded configs don't match
Expected
[charlie bracvo delta]
Got
[charlie bravco delta]
LGTM |
Log the list of config files loaded when starting the nomad agent
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
Closes #40