diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 91642701329d9..37d167e750323 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -99,7 +99,7 @@ versioning guidelines: Please see [support/README.md](support/README.md) for more information on these hooks. -* Create your PR. +* Create your PR. If your PR adds new code, it should include tests [covering](source/docs/coverage.md) the new code. * Tests will automatically run for you. * We will **not** merge any PR that is not passing tests. * PRs are expected to have 100% test coverage for added code. This can be verified with a coverage diff --git a/source/docs/aclick.png b/source/docs/aclick.png new file mode 100644 index 0000000000000..04fab49d633e6 Binary files /dev/null and b/source/docs/aclick.png differ diff --git a/source/docs/click.png b/source/docs/click.png new file mode 100644 index 0000000000000..c4dd6d3d5f03f Binary files /dev/null and b/source/docs/click.png differ diff --git a/source/docs/coverage.md b/source/docs/coverage.md new file mode 100644 index 0000000000000..af03e27fec13b --- /dev/null +++ b/source/docs/coverage.md @@ -0,0 +1,49 @@ +### How can I tell if my new code is covered by tests? + +In a PR run, for example https://github.com/envoyproxy/envoy/pull/14672 + +Click on the check mark or X for the CI results you want to look at. Generally +this will be the last run, but for this example we’ll pick an earlier, failed +run. + +![PR view](pr_view.png) + +Next, click on the “Details” link on the coverage run. If the run was a success +you may need to scroll down to see the coverage build. + +![click coverage](click.png) + +Next up, click on the warnings/errors link. For a successful coverage run, this will list zero errors/warnings but will still be clickable + +![click error](eclick.png) + +On the azure results page, again click through to see results. + +![azure error](aclick.png) + +![coverage results](results.png) + + +In this case the error reason was clear, and the directory missing coverage is listed. To get an understanding of what lines aren’t covered, you can browse further. + +Scroll down on the left, and click on “Upload coverage reports” +This will provide a link on the right, telling you where the coverage +upload went, in this case a link to +“https://storage.googleapis.com/envoy-pr/269d783/coverage/index.html” (which +will only be valid for some number of days). + +![coverage upload](upload.png) + +Clicking on the link provides a full color-annotated coverage report + +![coverage report](report.png) + +You can browse this report to the directory in question. In this particular +case the coverage issue was actually a coverage bug, where trailing braces in +tested switch statements are considered uncovered lines. Generally this will +instead provide a branch of code which simply needs unit tests. + +![coverage file](file.png) + + + diff --git a/source/docs/eclick.png b/source/docs/eclick.png new file mode 100644 index 0000000000000..d95dd06956de9 Binary files /dev/null and b/source/docs/eclick.png differ diff --git a/source/docs/file.png b/source/docs/file.png new file mode 100644 index 0000000000000..3e535e3a3f7b7 Binary files /dev/null and b/source/docs/file.png differ diff --git a/source/docs/pr_view.png b/source/docs/pr_view.png new file mode 100644 index 0000000000000..0e3fb8e338aae Binary files /dev/null and b/source/docs/pr_view.png differ diff --git a/source/docs/report.png b/source/docs/report.png new file mode 100644 index 0000000000000..0e994721fa32f Binary files /dev/null and b/source/docs/report.png differ diff --git a/source/docs/results.png b/source/docs/results.png new file mode 100644 index 0000000000000..2db903370cf88 Binary files /dev/null and b/source/docs/results.png differ diff --git a/source/docs/upload.png b/source/docs/upload.png new file mode 100644 index 0000000000000..6c109453b38ab Binary files /dev/null and b/source/docs/upload.png differ