-
Notifications
You must be signed in to change notification settings - Fork 117
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
Implement basic field assertion (types, presence) #143
Conversation
I assume you will choose a different test package than |
Yes, I will try to use the only one present, I've also spotted that we need to validate sample events. See: https://github.com/elastic/integrations/blob/master/packages/aws/data_stream/sns/sample_event.json . The file is raw dump from Elasticsearch, but we're interested in |
Not sure what should I do with entries like:
The field |
I assume this field is somehow getting defined in the index template's mapping. Do you how/where that's happening? |
No idea. Maybe @ruflin know some more details? I suspect that there are more hidden definitions. |
The system test runner reports tests results under the "Tests" tab: Moving on... |
I need to fix the
|
Hm.. it looks that the CI failed for a couple of fields: https://beats-ci.elastic.co/blue/organizations/jenkins/Beats%2Felastic-package/detail/PR-143/28/tests Investigating. Not sure why the CI hasn't reported these issues earlier. Current status:
EDIT: I notice one issue with the current implementation. It returns the issue issue found for the document. I suspect it would be great to return all validation problems as we do for spec. EDIT2: I'm confused now. I added a couple of fields and it seems that there're new weird ones coming :) ( |
I imagine such new common fields should not be added frequently so I would actually prefer to be strict, at least initially and see how much of a PITA it becomes for us. If we suddenly see all tests failing for integrations, it's a pretty good indication that it's not something wrong with one or two integrations but something more widespread and common. Looking at the failure details it should become pretty clear what that common new field is and then we can add it to our skip list. Also, depending on how we solve #147, we might not have to worry about this issue of new common fields being added every so often. |
Ok, I will adjust the implementation to report all problems and then add missing fields. I'm only worried about future situations in which we have to adjust all integrations (time consuming), but maybe it won't be so hard. |
Yes, this is a fair point. I think we'll have to see how it goes. If it starts to become a hassle, I'll be +1 to not failing on undefined fields. But I'm also hoping we can find an elegant solution to #147, maybe something that involves being able to detect these common fields from some other source than the package field definition files. |
I modified the code to get all validation errors at once, but it went up to 300 errors :) See: https://beats-ci.elastic.co/blue/organizations/jenkins/Beats%2Felastic-package/detail/PR-143/33/tests I will adjust the code to report only unique records. |
I managed to clean up all reported fields: https://beats-ci.elastic.co/blue/organizations/jenkins/Beats%2Felastic-package/detail/PR-143/35/tests Field families that are not related to the specific integration, but appear in documents: |
@ycombinator I fixed all issues and addressed your comments. Please take a look when you're free. Keep in mind the number of additional fields I had to put here. |
isFieldFamilyMatching("event", key) || // too many common fields | ||
isFieldFamilyMatching("host", key) || // too many common fields | ||
isFieldFamilyMatching("metricset", key) || // field is deprecated | ||
isFieldFamilyMatching("event.module", key) // field is deprecated |
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 line is now redundant with isFieldFamilyMatching("event", key)
but I think we should keep it anyway because even if we were to somehow get rid of isFieldFamilyMatching("event", key)
in the future, we would want this line to be here, correct?
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.
Right, maybe it's better to keep it here even though it's redundant.
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. Nice job on this feature!
This PR introduces a basic field type assertion during pipeline and system tests. When a pipeline or system test is executed, generated results are examined against correctness with fields schema (fields YAML files). All inconsistencies will be reported.
Issue: #90
Action items (TODOs):