You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@metron.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/04/27 15:54:00 UTC

[jira] [Commented] (METRON-1540) Solr Integration tests should use actual schemas

    [ https://issues.apache.org/jira/browse/METRON-1540?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16456653#comment-16456653 ] 

ASF GitHub Bot commented on METRON-1540:
----------------------------------------

GitHub user justinleet opened a pull request:

    https://github.com/apache/metron/pull/1005

    METRON-1540: Solr Integration tests should use actual schemas

    ## Contributor Comments
    A few things happened here.
    
    * I had the Solr IP field return FieldType.IP as the type. If someone knows a reason this should be reverted/changed, let me know.
    * All the test 
    schemas except for the "test" schema were removed.  They were outdated versions of actual schemas that we use.
    * The tests that used them, in particular `SearchIntegrationTest.java` was updated to refer to the actual schemas
    * Some minor test data changes occurred, e.g. `duplicate_field_name` to `ttl` (which is an actual field that conflicts in type between bro and snort).
    * Fix to dynamic fields in the `SolrColumnMetadataDao`.  Prior to this fix, only the fields defined in the schema would be returned by the DAO.  Now it will return both schema fields and dynamic fields that are used in practice (e.g. `threat:triage:score` is not explicitly defined, it matches a pattern and receives type float).  It may be worth renaming this PR and Jira, since this is an actual bug that came out of this testing.  However, this testing change is fairly necessary for the PR (since we didn't have the dynamic fallbacks in the old schemas and why bother fixing schemas we want to delete anyway).
    * Cleaned up the tests so it was more obvious what was being tested in particular.  The tests no longer hit every field, but a reasonable subset (otherwise bro would be a couple hundred fields).
    * `SolrSearchDao` now has a catch for `SolrException`.  Oddly, changing which type went into the wrong place changed the exception (e.g. int into text or text into int).  It seems reasonable to catch that exception rather than letting things blow up.
    
    I also ran it up in full dev, switched over to Solr.
    
    I confirmed that something like `threat:triage`score` didn't appear (as it would be dynamic).
    
    I then pushed this piece of Bro data through (that will hit a typed dynamic field and the overall ignored typed fallback field).  The new fields at the end are `threat:triage:score` and `fake.field`.
    ```
    {"http": {"ts":1524842503.557505,"uid":"CUQVlMYsuW1ySX8z8","id.orig_h":"192.168.138.158","id.orig_p":49185,"id.resp_h":"62.75.195.236","id.resp_p":80,"trans_depth":1,"method":"GET","host":"ubb67.3c147o.u806a4.w07d919.o5f.f1.b80w.r0faf9.e8mfzdgrf7g0.groupprograms.in","uri":"/","referrer":"http://va872g.g90e1h.b8.642b63u.j985a2.v33e.37.pa269cc.e8mfzdgrf7g0.groupprograms.in/?285a4d4e4e5a4d4d4649584c5d43064b4745","user_agent":"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)","request_body_len":0,"response_body_len":8973,"status_code":200,"status_msg":"OK","tags":[],"resp_fuids":["FdMX8Q3FciDFIl5Gt4"],"resp_mime_types":["application/x-shockwave-flash"],"threat:triage:score":1.0,"fake.field":"fake"}}
    ```
    
    The result for Bro, per the REST API now has the fields:
    ```
      ...
      "method": "TEXT",
      "threat:triage:score": "FLOAT",
      "response_to": "TEXT",
      ...
      "adapter.geoadapter.begin.ts": "OTHER",
      "fake.field": "OTHER",
      "authentication_method": "TEXT",
      ...
    ```
    
    
    
    ## Pull Request Checklist
    
    Thank you for submitting a contribution to Apache Metron.  
    Please refer to our [Development Guidelines](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=61332235) for the complete guide to follow for contributions.  
    Please refer also to our [Build Verification Guidelines](https://cwiki.apache.org/confluence/display/METRON/Verifying+Builds?show-miniview) 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:
    - [x] Is there a JIRA ticket associated with this PR? If not one needs to be created at [Metron Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel).
    - [x] 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.
    - [x] Has your PR been rebased against the latest commit within the target branch (typically master)?
    
    
    ### For code changes:
    - [x] Have you included steps to reproduce the behavior or problem that is being changed or addressed?
    - [x] 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 && dev-utilities/build-utils/verify_licenses.sh 
      ```
    
    - [x] Have you written or updated unit tests and or integration tests to verify your changes?
    - [x] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)?
    - [x] 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:
    - [x] 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](https://travis-ci.org) is set up for your personal repository such that your branches are built there before submitting a pull request.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/justinleet/metron schemaTesting

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/metron/pull/1005.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1005
    
----

----


> Solr Integration tests should use actual schemas
> ------------------------------------------------
>
>                 Key: METRON-1540
>                 URL: https://issues.apache.org/jira/browse/METRON-1540
>             Project: Metron
>          Issue Type: Sub-task
>            Reporter: Justin Leet
>            Assignee: Justin Leet
>            Priority: Major
>
> Right now some of the integration tests, e.g. SolrSearchIntegrationTest, don't use the actual schemas for bro and snort. We've been bit a couple times during the feature branch by these tests using stripped down test schemas, we need to be using the actual ones and getting rid of the stripped down ones.
> Given that the test schemas can vary a bit and things like the column metadata varies, there's more work than just swapping them out.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)