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
[tests] Add test base class and example #82
Conversation
This code proposes a test base class in charge of loading enriched data to an ElasticSearch index. In a nutshell, for every test method of a child test class, the base class loads enriched items and mappings from two files within the folder `tests/data` and save them to an ES index. The files and index are identified according to the values of the attributes `name` and `enrich_index` defined in the child test class (e.g., git_commit and git_enrich). Note that the content of the files can be obtained by dumping mappings and documents from existing enriched indexes using `elasticdump`. For instance: ``` elasticdump \ --input=https://...@blue6.biterg.io/data/github_enrich_issue_180713 \ --output=./github_issue_mappings.json \ --type=mapping \ --limit=1000 elasticdump \ --input=https://...@blue6.biterg.io/data/github_enrich_issue_180713 \ --output=./github_issue.json \ --type=data \ --limit=1000 ```
This code contains an example that showcases how to use the test base class.
@jgbarah @aswanipranjal, is it close to what you need to execute tests? |
Yes @valeriocos! This is exactly what we want. Thank you! I have to ask this though, how did you generate the enriched data? Because we should also add that mechanism of generating the enriched data in the utils file or have a separate script for that, so that if there is a need to add more data due to some changes or errors in the future, then function/script can be used. Thanks again! |
@aswanipranjal I used elasticdump to collect the mappings and data of enriched indexes (see the script in the issue body). I download them from |
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.
Looks good to me. I'm accepting it, so that we can start using this schema asap. But please, document in a separate PR, in a section in the README.md file for the repo how the mappings and index files are produced (those that this code uploads to ElasticSearch).
In addition, the name of the index, and the location of the ES instance should be in a config.py
file, the way we do that for Gelk or SortingHat. That way, we can customize tests in different setups easier. Please, when you can, produce a separate pr with that too.
This code proposes a test base class (and an example) in charge of loading enriched data to an ElasticSearch index. In a nutshell, for every test method of a child test class, the base class loads enriched items and mappings from two files within the folder
tests/data
and save them to an ES index. The files and index are identified according to the values of the attributesname
andenrich_index
defined in the child test class (e.g., git_commit and git_enrich).Note that the content of the files can be obtained by dumping mappings and documents from existing enriched indexes using
elasticdump
. For instance: