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

Fix lustre2 input plugin config parse regression #6114

Merged
merged 4 commits into from
Jul 18, 2019

Conversation

GeorgeMac
Copy link
Contributor

This closes #6107

PR contains a test definition to capture the regression scenario and an associated fix.

Oustanding question:

Was there a desire to parse these new ost_jobstat and mds_jobstat fields also? Do we need to support those field names as aliases?

Required for all PRs:

  • Signed CLA.
  • Associated README.md updated.
  • Has appropriate unit tests.

@GeorgeMac GeorgeMac added fix pr to fix corresponding bug regression something that used to work, but is now broken labels Jul 12, 2019
@GeorgeMac GeorgeMac changed the title Add failing test for lustre2 input toml parsing regression Fix lustre2 input plugin config parse regression Jul 12, 2019
@GeorgeMac
Copy link
Contributor Author

@frroberts will reverting this name change cause issues with your previous change #5771 ?

@frroberts
Copy link
Contributor

I don't see why it would cause any issues. (Unfortunately I do not have access to a real system to test on right now.)

plugins/inputs/lustre2/lustre2.go Outdated Show resolved Hide resolved
plugins/inputs/lustre2/lustre2_test.go Outdated Show resolved Hide resolved
@@ -330,3 +333,38 @@ func TestLustre2GeneratesJobstatsMetrics(t *testing.T) {
err = os.RemoveAll(os.TempDir() + "/telegraf")
require.NoError(t, err)
}

func TestLustre2CanParseConfiguration(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just an observation. I have mixed feelings on this test, you could imagine having tests like this for all plugins and overall I think if we did this it would be too burdensome in it's current form. On the other hand obviously it does check for a valid bug.

Copy link
Contributor Author

@GeorgeMac GeorgeMac Jul 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that in this form it would be burdensome. I actually had mentioned about having a test like this everywhere with @goller.

Would a kind of test harness for all plugins be worthwhile?

e.g.

import "github.com/influxdata/telegraf/internal/harness"

func TestHarness(t *testing.T) {
    harness.TestInputPlugin(t, "some_plugin", &SomePlugin{})
}

Which would validate the plugin has been registered under some_plugin. Parse the result of plugin.SamplePlugin() and assert it against the provided telegraf.Input.

Could have one per plugin type and capture some high-level criteria like this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I'm ambivalent, it's not something that has historically been a huge source of bugs, so it might just not be worth the effort or a situation where we have bigger fish to fry. We could definitely provide a better interface to the config package to ease toml string -> plugin, but I'm not entirely sure how the harness would work. It seems like you need to provide at a minimum the input TOML with all options set, and a filled plugin struct to compare against.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah my illustration is lacking a little. For this PR shall I just leave it as is or remove the test?

The harness would ideally test all configurable fields, so the sample would need uncommenting in part if it were used. This could be done with a simple regexp, but that may be brittle and difficult to explain.

@danielnelson danielnelson added this to the 1.11.3 milestone Jul 17, 2019
@GeorgeMac GeorgeMac merged commit 56c6539 into master Jul 18, 2019
@GeorgeMac GeorgeMac deleted the gm/fix-lustre-regression branch July 18, 2019 13:40
danielnelson pushed a commit that referenced this pull request Jul 22, 2019
bitcharmer pushed a commit to bitcharmer/telegraf that referenced this pull request Oct 18, 2019
athoune pushed a commit to bearstech/telegraf that referenced this pull request Apr 17, 2020
idohalevi pushed a commit to idohalevi/telegraf that referenced this pull request Sep 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix pr to fix corresponding bug regression something that used to work, but is now broken
Projects
None yet
Development

Successfully merging this pull request may close these issues.

lustre2 input plugin not customizable due to TOML parsing issue
3 participants