-
Notifications
You must be signed in to change notification settings - Fork 505
METRON-424 ability to validate ip addresses against both IPV4 and IPV6 #303
Conversation
|
I would personally vote for |
|
I tend to agree, I prefer |
|
Jon described it well. I'd prefer "explicit and obvious." |
|
OK, good then. I don't have to change anything. |
|
So, the problem with the tests is this: This test failed because of a timeout (probably because the box running it is overloaded. The stream of failures after that point is due to the Parser Integration tests not shutting down the infrastructure it spins up (e.g. storm, etc.) when the tests fail. I'd close and immediately reopen this PR and it should trigger a test rerun. It is probably worth while making a JIRA to correct the integration tests to be smarter and not spew horrible things. |
|
I pulled the PR down locally, and ran into the same integration test issue. I also ran on master locally and it succeeded. I'm not sure what the root issue is if that's (consistently) the case. |
|
Justin, how do I run the integration tests? |
|
I just outright did a mvn clean install for the entire project and let it run while I was doing other stuff. but integration-test target I believe also hits them. |
|
To run the integration tests... Run I do not believe that the Integration tests are run with an On a side note, you can see what Travis is doing by looking at the |
|
FWIW - I am also getting the integration test failures for this PR when I run them locally. Not sure what the problem is though. I think an exception is being swallowed somewhere. |
|
Ok - I'm running the integration-test now. Is there a way to debug it? |
|
I would run one of the tests and put a break point at |
|
I'm running as in https://maven.apache.org/surefire/maven-surefire-plugin/examples/debugging.html and attaching with intellij in test, as you describe actually. It was how to kick off the test in debug that got me, not having much luck though. |
|
If that works for you, then great. I usually use Maven when I need to run all the tests before a merge or PR. When I want to dig into one test and debug something, I just open up Intellij. That makes setting the breakpoint and triggering a single test run very easy. You just have to watch out because sometimes (rarely) something will work in Intellij, but not in Maven or vice versa. Each builds the code slightly differently. |
|
I figured out what was going on with this PR and it's kinda interesting, so forgive the long-winded explanation. @ottobackwards is indeed right, it is not apparent why his PR about a FieldTransformation and Stellar Function would affect the It turns out the problem is here. The keen observer will notice in the global config we are ensuring that the
Well, for the first question, it was never correct in the integration tests, but since we did not exercise the situation where we send in invalid IP addresses it was not apparent. Furthermore, the default behavior for fields which do not exist is to return For the second question, @ottobackwards has changed the default behavior for fields which do not resolve is to return For clarity to show how I go about debugging these problems, I'll be rather explicit in how I figured out what was happening:
I submitted a PR to your PR branch, @ottobackwards, so if you merge that in, the build should work (fingers crossed ;) |
|
Interesting. Is there anything we can do to make integration test failures like this more transparent in the future? |
|
@nickwallen Funny you mention that; yes, I think we can. We should modify |
|
Ok - from what I can see things are written to the kafka topic, but the bolt is never called. I don't see an crashes in the field validation code at this time. Can anyone make sense of these exceptions I get ( I am only running the BRO Integration test ) |
|
That is awesome. Thank you. The good news, is in true ‘learning by carnage’ fashion, I know know a bit On October 13, 2016 at 09:43:23, Casey Stella (notifications@github.com) I figured out what was going on with this PR and it's kinda interesting, so @ottobackwards https://github.com/ottobackwards is indeed right, it is It turns out the problem is here Now, you may ask:
Well, for the first question, it was never correct in the integration For the second question, @ottobackwards https://github.com/ottobackwards For clarity to show how I go about debugging these problems, I'll be rather
I submitted a PR to your PR branch, @ottobackwards — |
Fixed a long-standing misconfiguration in the tests
|
Are you going to open a jira for that? On October 13, 2016 at 10:16:13, Casey Stella (notifications@github.com) @nickwallen https://github.com/nickwallen Funny you mention that; yes, I — |
|
Yep, I will. :) |
|
Ok, so there is still an issue here. Some of the other parsers do not create an As I see it, we have 2 choices:
I suggest 1 upon further consideration. Global validation across ALL parsers is going to have to be tolerant of missing values as not all parsers are going to provide every fields. I think it should be interpreted, "Are these fields globally valid if they exist?" rather than "are these fields globally valid?" That being said, I think that the accommodation for this should exist in the FieldValidation function, not in the individual validator functions. I'll make a PR to your PR to this effect, but I wanted to make sure everyone was on board with that and gather thoughts. |
|
Actually, upon even further consideration, I think we should revert the default behavior of the IP validator to return Thoughts? |
|
I would prefer changing the IPValidator. As an aside to this, if someone were to want to add in new models to the system I would think Metron would need to have the validation mapped to model type and not so hard coded into the system. Some of this would fall out of that effort, unless I'm mistaken |
|
Yeah, I agree. I'd like to have a sensor-specific validator as well as a global validator. Right now we have a |
|
That JIRA about making the ParserIntegrationTest better is at https://issues.apache.org/jira/browse/METRON-502 |
|
I would like to get the discussion on that going, as adding in new models is something near and dear. |
|
I can't be assigned jiras but I'll take a stab at METRON-502, unless you have already completed it ;) |
|
@ottobackwards Sure, why don't you start a DISCUSS thread and lay out how you envision that looking? |
|
Go for it, man. It's all yours. :) |
Changed ipvalidation to return true if the field doesn't exist.
|
+1 on inspection |
Allow the specification of multiple validation types for IP
{ "fieldValidations" : [ { "input" : [ "field1", "field2" ] ,"validation" : "IP" ,"config" : { "type" : ["IPV4","IPV6"] } } ] }The question with this PR is if this is the correct approach. Is this the most consistent approach? Is it the least surprising? Would it be better to add a ALL keyword such that instead of specifying both types you can just do
"type": "ALL"?
I did it this way to start, but I'm open to change it based on review.