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

Create IpCompareCondition.java #258

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open

Create IpCompareCondition.java #258

wants to merge 20 commits into from

Conversation

jgreen117
Copy link

Create a new condition processor to check if an IP address is within a range of two other Ip's

So there is a test ip, a low ip, and a high ip. If the test ip is in between those other ip's then the condition returns true

@barakm
Copy link
Contributor

barakm commented Jan 12, 2022

@jgreen117 - what is the status here?

@jgreen117
Copy link
Author

@barakm I am waiting for a review of the code. I am not sure what other tests may be required

@TalHibner TalHibner removed their request for review January 13, 2022 14:45
@yotamlevy3 yotamlevy3 removed their request for review January 17, 2022 17:54
e.printStackTrace();
}

//System.out.println(ipToTest+" "+ipTest+" test");
Copy link
Contributor

Choose a reason for hiding this comment

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

please remove commented out log lines.

@jgreen117 jgreen117 marked this pull request as draft January 31, 2022 18:56
@jgreen117 jgreen117 closed this Feb 3, 2022
@jgreen117
Copy link
Author

Closed incorrectly

@jgreen117 jgreen117 reopened this Feb 9, 2022
@jgreen117 jgreen117 closed this Feb 9, 2022
@jgreen117 jgreen117 reopened this Feb 9, 2022
@barakm barakm mentioned this pull request Feb 14, 2022
@jgreen117 jgreen117 closed this Feb 16, 2022
@jgreen117 jgreen117 reopened this Feb 16, 2022
@jgreen117 jgreen117 closed this Feb 16, 2022
@jgreen117 jgreen117 reopened this Feb 16, 2022
@jgreen117
Copy link
Author

@barakm Sorry I am getting a bit stuck here again. I am trying to check out the code and update it to remove the commented out lines. But I cannot get it work while some of the checks havent completed. Have you run into this issue before?

@barakm
Copy link
Contributor

barakm commented Feb 17, 2022

@jgreen117 Looks like something weird with the travis-ci integration. I am looking into it.
However, I am not sure what is exactly the problem you are facing. You should not have any problem to check out this branch ('patch-1'), make some changes, add a commit and push it. The failed checks cannot stop you from updating your PR.
What exactly is the command you are trying to run, and what is the error?

@barakm
Copy link
Contributor

barakm commented Feb 17, 2022

Closing and re-opening PR to test Travis integration.

@barakm barakm closed this Feb 17, 2022
@barakm barakm reopened this Feb 17, 2022
@barakm
Copy link
Contributor

barakm commented Feb 17, 2022

Travis error message:
"We are unable to start your build at this time. You exceeded the number of users allowed for your plan. Please review your plan details and follow the steps to resolution."

https://app.travis-ci.com/github/logzio/sawmill/pull_requests

@DanMelman - Time to move to something else.

@jgreen117 jgreen117 marked this pull request as ready for review February 17, 2022 11:57
@jgreen117
Copy link
Author

@barakm okay the comments have been removed and the checks have passed let me know if there are any other changes I should make

@DanMelman DanMelman reopened this Mar 30, 2022
@DanMelman
Copy link
Collaborator

@jgreen117 sure, let's start by you fixing all the open comments (please comment/mark each fixed comment so its easier to follow). After pushing all your changes, ping me and i'll go over it again.

Comment on lines 42 to 43
if (!doc.hasField(ipTest, String.class)) return false;
String value = (doc.getField(this.ipTest));
Copy link
Author

Choose a reason for hiding this comment

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

Added these two lines to check that ipTest is a field in the doc
If it is then I pull the value in that field
Otherwise return false

@jgreen117
Copy link
Author

@DanMelman Okay I updated the comments with my changes.

@DanMelman DanMelman self-requested a review March 30, 2022 14:06

private String ipHigh;
private String ipLow;
private String ipTest;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is no really the ip to test, this is the name of field containing the ip to test
so I would just call it field

Copy link
Author

Choose a reason for hiding this comment

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

Okay ipTest renamed to field

@DanMelman
Copy link
Collaborator

@jgreen117 please add a test class before requesting review (see previous comment regarding this #258 (comment))

@jgreen117
Copy link
Author

@DanMelman

I have added the Test. However I am not sure how to run it. Please let me know if there are other tests I should add to it.
I am currently only testing if the IP is in the middle (true) or above or below the range (false)

https://github.com/logzio/sawmill/blob/jgreen117-patch-1/sawmill-core/src/test/java/io/logz/sawmill/conditions/IpComparatorConditionTest.java

@DanMelman
Copy link
Collaborator

DanMelman commented Apr 4, 2022

@DanMelman

I have added the Test. However I am not sure how to run it. Please let me know if there are other tests I should add to it. I am currently only testing if the IP is in the middle (true) or above or below the range (false)

https://github.com/logzio/sawmill/blob/jgreen117-patch-1/sawmill-core/src/test/java/io/logz/sawmill/conditions/IpComparatorConditionTest.java

@jgreen117 check out the github checks, your last commit fails compilation.
image

After fixing the compilation, push again and you will see the tests running there as well.
You can also run your test locally in the IDE (not familiar with eclipse that you mentioned you are using)

@jgreen117
Copy link
Author

@DanMelman thanks fixed the issue, forgot I renamed the class in github

@DanMelman
Copy link
Collaborator

Great @jgreen117, please make sure you also add tests to the non-happy-flow cases: illegal input type/structure, non existing field, and so on..

@jgreen117
Copy link
Author

@DanMelman Okay added some more tests let me know if I missed anything

@jgreen117
Copy link
Author

@DanMelman Let me know if there anything else I need. Thanks again for all the help with this

@DanMelman DanMelman self-requested a review April 14, 2022 04:00
Comment on lines 49 to 50
// TODO Auto-generated catch block
e.printStackTrace();
Copy link
Collaborator

Choose a reason for hiding this comment

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

@jgreen117 you still have those auto generated TO-DO parts, please go over the code once again and clean it up to spare another reviewing cycle.

@Override
public boolean evaluate(Doc doc) {

if (!doc.hasField(field, String.class)) return false;
Copy link
Collaborator

Choose a reason for hiding this comment

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

indentation seems off, please do command+optional+L on this whole file to arrange it


public class IpComparatorConditionTest {

public ConditionParser conditionParser;
Copy link
Collaborator

Choose a reason for hiding this comment

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

indentation off, please do command+option+L before commiting

jgreen117 and others added 3 commits May 4, 2022 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants