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

[tests] Add test base class and example #82

Merged
merged 2 commits into from Jul 25, 2018

Conversation

valeriocos
Copy link
Member

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 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 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.
@valeriocos valeriocos requested a review from jgbarah July 24, 2018 17:43
@valeriocos
Copy link
Member Author

@jgbarah @aswanipranjal, is it close to what you need to execute tests?

@coveralls
Copy link

Pull Request Test Coverage Report for Build 199

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 55.309%

Totals Coverage Status
Change from base Build 193: 0.0%
Covered Lines: 849
Relevant Lines: 1535

💛 - Coveralls

@aswanipranjal
Copy link
Contributor

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!

@valeriocos
Copy link
Member Author

@aswanipranjal I used elasticdump to collect the mappings and data of enriched indexes (see the script in the issue body). I download them from blue6, an environment we use to create and test the dashboards, however you could take them from any enriched index you generate. If needed I can open another PR containing the data from other data sources.

Copy link
Contributor

@jgbarah jgbarah left a 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.

@jgbarah jgbarah merged commit 1243d05 into chaoss:master Jul 25, 2018
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

4 participants