opensearch-project/neural-search
View on GitHub[Tech debt] Improve test coverage - phase 1, meet minimal required level
Open
#429 opened on Oct 10, 2023
Maintenancegood first issue
Repository metrics
- Stars
- (116 stars)
- PR merge metrics
- (PR metrics pending)
Description
Improve test coverage for repo, all packages should be above 80%.
Currently report is showing following packages that are below 80%:
- https://github.com/opensearch-project/neural-search/tree/main/src/main/java/org/opensearch/neuralsearch/plugin - 71%
- https://github.com/opensearch-project/neural-search/tree/main/src/main/java/org/opensearch/neuralsearch/query - 77%
- https://github.com/opensearch-project/neural-search/tree/main/src/main/java/org/opensearch/neuralsearch/search - 77%
Steps to repro:
- Check above links for code coverage report. Click on every class and check which lines or methods are not covered, write tests for those lines.
- If you write unit test and want to run it, do
./gradlew test
that will execute changes. If you want to check how coverage changes after adding your test, you need to create a new PR with your changes, mark it as "Draft" and let CI run. Part of the CI execution is generation of new coverage report with your changes.
Some tips:
- check existing unit tests, e.g. https://github.com/opensearch-project/neural-search/blob/main/src/test/java/org/opensearch/neuralsearch/query/HybridQueryBuilderTests.java
- make sure all tests are passing on your local
- make sure tests are deterministic and stable, avoid hammering failing tests until it passes