-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[Metricbeat] Check that fields are documented in data tests #11127
Conversation
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.
Tested locally with an undocumented field, and it works!
f950884
to
c627c95
Compare
@@ -36,8 +36,8 @@ | |||
type: long | |||
description: > | |||
Request latency, number of requests | |||
- name: request.latency.bucket |
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.
This should not change the template itself as it checks if a *
already exists in the name and if not it will add it. We use the *
in the docs check to verify that the fields are multifields. We should use this as a convention moving forward.
c627c95
to
56497fd
Compare
@@ -190,6 +190,41 @@ func writeDataJSON(t *testing.T, data common.MapStr, module, metricSet string) { | |||
} | |||
} | |||
|
|||
// checkDocument checks that all fields which show up in the events are documented |
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.
Comment should say checkDocumented
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.
better then hound ci :-) Changed.
@@ -15,7 +15,7 @@ | |||
// specific language governing permissions and limitations | |||
// under the License. | |||
|
|||
package testing | |||
package data |
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.
Mostly for my own curiosity: why was this package change necessary?
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.
If I remember correctly, without it there was a circular import when using _ "github.com/elastic/beats/metricbeat/include"
Currently we check in python tests that the fields are documented. As by now we have all the fields also available in the go code with the fields.go files it is possible to do this check in the new data tests. To prevent cyclic imports the data_test.go had to be moved to its own package. Now by default all modules are imported. Like this we don't have to add each module manually.
eeb4ce7
to
4d80a2c
Compare
@ycombinator Updated and rebased because of a conflict. |
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.
LGTM.
Currently we check in python tests that the fields are documented. As by now we have all the fields also available in the go code with the fields.go files it is possible to do this check in the new data tests.
To prevent cyclic imports the data_test.go had to be moved to its own package.
Now by default all modules are imported. Like this we don't have to add each module manually.