Skip to content
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

Merged
merged 3 commits into from
Dec 9, 2015

Conversation

cbednarski
Copy link
Contributor

Closes #40

@@ -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",
Copy link
Contributor

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.

Copy link
Contributor Author

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]

@dadgar
Copy link
Contributor

dadgar commented Dec 9, 2015

LGTM

cbednarski added a commit that referenced this pull request Dec 9, 2015
Log the list of config files loaded when starting the nomad agent
@cbednarski cbednarski merged commit dc23448 into master Dec 9, 2015
@cbednarski cbednarski deleted the f-log-config-files branch December 9, 2015 20:18
@github-actions
Copy link

github-actions bot commented May 1, 2023

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.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants