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

Add test for documented fields check for metricsets without a http input #17334

Merged
merged 6 commits into from
Apr 2, 2020

Conversation

narph
Copy link
Contributor

@narph narph commented Mar 30, 2020

What does this PR do?

Adds a test to check that the metricset fields are documented based on the events generated in the integration tests.

Why is it important?

This is a step in the requirements for moving modules/metricsets to GA.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

How to test this PR locally

Add mbtest.TestMetricsetFieldsDocumented to the integration test

Related issues

@narph narph self-assigned this Mar 30, 2020
@narph narph added the Team:Integrations Label for the Integrations team label Mar 30, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations (Team:Integrations)

@narph narph added [zube]: In Review needs_backport PR is waiting to be backported to other branches. labels Mar 30, 2020
@narph narph requested a review from exekias March 30, 2020 16:35
@zube zube bot removed the needs_backport PR is waiting to be backported to other branches. label Mar 30, 2020
@narph narph added the needs_backport PR is waiting to be backported to other branches. label Mar 30, 2020
Comment on lines 364 to 369
// should cover scenarios as azure.compute_vm_scaleset.*.*
key = strings.Join(splits[0:pos], ".") + ".*.*"
if _, ok := knownKeys[key]; ok {
found = true
break
}
Copy link
Contributor

Choose a reason for hiding this comment

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

this should not be done in all values of pos, .*.* should only replace the last 2 splits. I think this code can go outside this loop

@narph narph requested a review from exekias March 31, 2020 09:51
continue
}
}

Copy link
Contributor

Choose a reason for hiding this comment

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

WDYT about adding unit tests for this function? I see it has started to grow and I foresee we will keep updating it for a while

Copy link
Contributor Author

Choose a reason for hiding this comment

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

well spotted, added a test in testdata_test.go

@narph narph requested a review from exekias March 31, 2020 13:22
@narph narph merged commit e545836 into elastic:master Apr 2, 2020
@narph narph deleted the add_doc_test branch April 2, 2020 11:42
narph added a commit to narph/beats that referenced this pull request Apr 2, 2020
…put (elastic#17334)

* add test for documented fields

* changelog

* work on test

* add test for testdata

* fmt update

(cherry picked from commit e545836)
narph added a commit to narph/beats that referenced this pull request Apr 2, 2020
…put (elastic#17334)

* add test for documented fields

* changelog

* work on test

* add test for testdata

* fmt update

(cherry picked from commit e545836)
narph added a commit that referenced this pull request Apr 6, 2020
…etricsets without a http input (#17439)

* Add test for documented fields check for metricsets without a http input (#17334)

* add test for documented fields

* changelog

* work on test

* add test for testdata

* fmt update

(cherry picked from commit e545836)

* update changelog
narph added a commit that referenced this pull request Apr 6, 2020
…etricsets without a http input (#17438)

* Add test for documented fields check for metricsets without a http input (#17334)

* add test for documented fields

* changelog

* work on test

* add test for testdata

* fmt update

(cherry picked from commit e545836)

* update changelog
leweafan pushed a commit to leweafan/beats that referenced this pull request Apr 28, 2023
…k for metricsets without a http input (elastic#17438)

* Add test for documented fields check for metricsets without a http input (elastic#17334)

* add test for documented fields

* changelog

* work on test

* add test for testdata

* fmt update

(cherry picked from commit 072f28e)

* update changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs_backport PR is waiting to be backported to other branches. Team:Integrations Label for the Integrations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add test checking that all fields are documented
4 participants