Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

METRON-1429: SearchIntegrationTest refactor #909

Closed
wants to merge 5 commits into from

Conversation

merrimanr
Copy link
Contributor

Contributor Comments

This PR cleans up SearchIntegrationTest which will make it easier to create a Solr implementation. Changes include:

  • Updated the "all_query_returns_all_results" method in SearchIntegrationTest to only contain a single test rather than also including duplicate tests that were moved to their own methods during the ES 5 upgrade work. Tests that were not duplicated were moved to their own method.
  • Removed logic from ElasticsearchSearchIntegrationTest that rewrites guids without the - character. This made the tests confusing because different ids were being used for validation and is no longer needed.
  • Metaalert data was removed and tests involving metaalerts were updated to use other sensors instead. There is no reason for metaalerts to be included here as there are other dedicated metaalert integration tests.
  • Improved the "get_all_latest_guid" test by using guids from different sensor types.

All tests should still run after this change.

Pull Request Checklist

Thank you for submitting a contribution to Apache Metron.
Please refer to our Development Guidelines for the complete guide to follow for contributions.
Please refer also to our Build Verification Guidelines for complete smoke testing guides.

In order to streamline the review of the contribution we ask you follow these guidelines and ask you to double check the following:

For all changes:

  • Is there a JIRA ticket associated with this PR? If not one needs to be created at Metron Jira.
  • Does your PR title start with METRON-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
  • Has your PR been rebased against the latest commit within the target branch (typically master)?

For code changes:

  • Have you included steps to reproduce the behavior or problem that is being changed or addressed?

  • Have you included steps or a guide to how the change may be verified and tested manually?

  • Have you ensured that the full suite of tests and checks have been executed in the root metron folder via:

    mvn -q clean integration-test install && build_utils/verify_licenses.sh 
    
  • Have you written or updated unit tests and or integration tests to verify your changes?

  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?

  • Have you verified the basic functionality of the build by building and running locally with Vagrant full-dev environment or the equivalent?

For documentation related changes:

  • Have you ensured that format looks appropriate for the output in which it is rendered by building and verifying the site-book? If not then run the following commands and the verify changes via site-book/target/site/index.html:

    cd site-book
    mvn site
    

Note:

Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.
It is also recommended that travis-ci is set up for your personal repository such that your branches are built there before submitting a pull request.

Copy link
Contributor

@mmiklavc mmiklavc left a comment

Choose a reason for hiding this comment

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

1 very minor request and I'm +1 on this by inspection. Thanks for tackling this @merrimanr!

Assert.assertEquals(10, results.size());

// the remaining are missing the 'threat:triage:score' and should be sorted last
Assert.assertFalse(results.get(0).getSource().containsKey("threat:triage:score"));
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe put this in a simple loop?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Assert.assertEquals("10", results.get(1).getSource().get("threat:triage:score"));

// the remaining are missing the 'threat:triage:score' and should be sorted last
Assert.assertFalse(results.get(2).getSource().containsKey("threat:triage:score"));
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above - Maybe put this in a simple loop?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@cestella
Copy link
Member

Should this be against master or should this be committed against the Solr branch? It seems like this is general purpose goodness and maybe fits in master, but I wanted to double check.

@mmiklavc
Copy link
Contributor

@cestella This is going into master per the merge notes, right?

@cestella
Copy link
Member

@mmiklavc I just wanted to make sure it was submitted against the right branch. I am totally ok with that given the content of the PR, but the question is whether there's anything solr specific here (I don't think so), but wanted to confirm. If there's Solr specific stuff, it probably should go into the feature branch.

@merrimanr
Copy link
Contributor Author

I think this is useful outside of any Solr work and I intended for it to go into master.

@cestella
Copy link
Member

Sounds good, +1 Good work here, that test was confusing.

@mmiklavc
Copy link
Contributor

+1 pending travis

@mmiklavc
Copy link
Contributor

@cestella You're right about that - the general goodness. We (I) had made the mistake of doing some test refactoring in the ES upgrade branch that would have been better done in a separate PR, committed to master, and then pulled into the ES branch. Splitting out improvements/refactorings the way Ryan did here means everyone gets the benefit, and further changes or enhancements don't get mangled in repeated merges in the Solr feature branch.

@asfgit asfgit closed this in 35d81cb Jan 25, 2018
iraghumitra pushed a commit to iraghumitra/incubator-metron that referenced this pull request Feb 17, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants