Skip to content

coverage: Improve test coverage#24355

Merged
yanavlasov merged 16 commits intoenvoyproxy:mainfrom
tyxia:rlqs_11
Dec 13, 2022
Merged

coverage: Improve test coverage#24355
yanavlasov merged 16 commits intoenvoyproxy:mainfrom
tyxia:rlqs_11

Conversation

@tyxia
Copy link
Copy Markdown
Member

@tyxia tyxia commented Dec 5, 2022

Remove the boilerplate code that was added as TODO for future PRs and was not tested.
Also, restore the overall coverage back to 96.1%

This is a part of effort to address #24353

Signed-off-by: tyxia tyxia@google.com

Signed-off-by: tyxia <tyxia@google.com>
@repokitteh-read-only
Copy link
Copy Markdown

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #24355 was opened by tyxia.

see: more, trace.

tyxia added 2 commits December 5, 2022 16:16
Signed-off-by: tyxia <tyxia@google.com>
Signed-off-by: tyxia <tyxia@google.com>
@tyxia tyxia changed the title Improve test coverage coverage: Improve test coverage Dec 5, 2022
@tyxia
Copy link
Copy Markdown
Member Author

tyxia commented Dec 5, 2022

/assign @alyssawilk

@tyxia tyxia marked this pull request as ready for review December 5, 2022 18:19
@tyxia tyxia requested a review from yanavlasov as a code owner December 5, 2022 18:19
@alyssawilk alyssawilk assigned yanavlasov and unassigned alyssawilk Dec 5, 2022
@yanavlasov
Copy link
Copy Markdown
Contributor

Can you adjust the coverage threshold value for the filter, now the untested code was removed?

/wait-any

@alyssawilk
Copy link
Copy Markdown
Contributor

not just the filter but overall coverage and close off that bug, if this is sufficient

@yanavlasov
Copy link
Copy Markdown
Contributor

/wait

Signed-off-by: tyxia <tyxia@google.com>
@repokitteh-read-only
Copy link
Copy Markdown

CC @envoyproxy/coverage-shephards: FYI only for changes made to (test/per_file_coverage.sh).
envoyproxy/coverage-shephards assignee is @RyanTheOptimist

🐱

Caused by: #24355 was synchronize by tyxia.

see: more, trace.

@RyanTheOptimist
Copy link
Copy Markdown
Contributor

It seems like this leaves us teetering on the edge of 96.1. Why does source/extensions/filters/http/rate_limit_quota have such an incredibly low coverage limit? Looking at coverage output, it seems like it would be pretty trivial to write a unit test for XRateLimitHeaderUtils::convertRateLimitUnit and RateLimitFilterConfig::createRouteSpecificFilterConfigTyped in order to get the coverage for this directory up to normal.

https://storage.googleapis.com/envoy-pr/9cb3b98/coverage/source/extensions/filters/http/ratelimit/ratelimit_headers.cc.gcov.html
https://storage.googleapis.com/envoy-pr/9cb3b98/coverage/source/extensions/filters/http/ratelimit/config.cc.gcov.html

tyxia added 2 commits December 7, 2022 22:00
Signed-off-by: tyxia <tyxia@google.com>
Signed-off-by: tyxia <tyxia@google.com>
@tyxia
Copy link
Copy Markdown
Member Author

tyxia commented Dec 7, 2022

It seems like this leaves us teetering on the edge of 96.1. Why does source/extensions/filters/http/rate_limit_quota have such an incredibly low coverage limit? Looking at coverage output, it seems like it would be pretty trivial to write a unit test for XRateLimitHeaderUtils::convertRateLimitUnit and RateLimitFilterConfig::createRouteSpecificFilterConfigTyped in order to get the coverage for this directory up to normal.

https://storage.googleapis.com/envoy-pr/9cb3b98/coverage/source/extensions/filters/http/ratelimit/ratelimit_headers.cc.gcov.html https://storage.googleapis.com/envoy-pr/9cb3b98/coverage/source/extensions/filters/http/ratelimit/config.cc.gcov.html

rate_limit_qutoa is a WIP that only partially implemented/merged due to large amount of code it requires and the spirit of small CLs. But these already merged code is needed so that I can continue the development as Github doesn't really support chained CLs. Since it is unfinished work, it has some boilerplate code required by compilation and for my future PRs but not tested.

The links you mentioned are for rateLimit which has nothing to do with rate_limit_quota here. The coverage for rate_limit_quota was at 86.2%. I added some more so it should be over 90% (Also some of line are coverage tool's false positive )

For the WIP, I feel it might be more worthy to continue the next phase development so that the code will be covered in next PRs.
Please let me know your thoughts

@RyanTheOptimist
Copy link
Copy Markdown
Contributor

rate_limit_qutoa is a WIP that only partially implemented/merged due to large amount of code it requires and the spirit of small CLs. But these already merged code is needed so that I can continue the development as Github doesn't really support chained CLs. Since it is unfinished work, it has some boilerplate code required by compilation and for my future PRs but not tested.

The links you mentioned are for rateLimit which has nothing to do with rate_limit_quota here. The coverage for rate_limit_quota was at 86.2%. I added some more so it should be over 90% (Also some of line are coverage tool's false positive )

Oh, sheesh. Yes, you're right. Is the correct coverage for this PR is here? That seems to show 86.2% not 90%. Is that what you expect? In any case, can you update test/per_file_coverage.sh to the correct currently value (either 86.2% or 90% or whatever it is)?

For the WIP, I feel it might be more worthy to continue the next phase development so that the code will be covered in next PRs. Please let me know your thoughts

If we have a directory that is below the limit, we can easily lower the threshold for that directory in test/per_file_coverage.sh, as we've done. But the problem with that is that this counts against the global project coverage limits. So by keeping rate_limit_quota below the limit, we're making it more likely that some other PR might cause us to drop down below the global limit. This causes pain for the entire project. Can we remove the untested methods from the tree until we're ready to use them (in follow up PRs)?

tyxia added 3 commits December 8, 2022 01:06
Signed-off-by: tyxia <tyxia@google.com>
Signed-off-by: tyxia <tyxia@google.com>
Signed-off-by: tyxia <tyxia@google.com>
@tyxia
Copy link
Copy Markdown
Member Author

tyxia commented Dec 8, 2022

Hi @RyanTheOptimist, I updated the code to increase test coverage, rate_limit_quota is now at 95% https://storage.googleapis.com/envoy-pr/761a7cc/coverage/index.html. I updated the limit to 94% though in case there are any flaky issues and will adjust after future PRs are landed.
The only lines left are dead code caused by exhaustive switch statement. I will think about updating this switch statement in next PR.

PTAL. Thanks!

tyxia added 2 commits December 8, 2022 14:19
Signed-off-by: tyxia <tyxia@google.com>
Signed-off-by: tyxia <tyxia@google.com>
RyanTheOptimist
RyanTheOptimist previously approved these changes Dec 8, 2022
Copy link
Copy Markdown
Contributor

@RyanTheOptimist RyanTheOptimist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Thanks for doing this.

Signed-off-by: tyxia <tyxia@google.com>
@tyxia
Copy link
Copy Markdown
Member Author

tyxia commented Dec 9, 2022

/retest

@repokitteh-read-only
Copy link
Copy Markdown

Retrying Azure Pipelines:
Check envoy-presubmit isn't fully completed, but will still attempt retrying.
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #24355 (comment) was created by @tyxia.

see: more, trace.

Signed-off-by: tyxia <tyxia@google.com>
@tyxia
Copy link
Copy Markdown
Member Author

tyxia commented Dec 9, 2022

The failed coverage is caused by Code coverage for source/common/common/posix is lower than limit of 94.5 (92.7), which was adjusted in #24458. Thus, I think this is not ready to be bumped? I reverted it in this PR.

@tyxia
Copy link
Copy Markdown
Member Author

tyxia commented Dec 9, 2022

I figured that in order to unblock the presubmit test faster, I probably should have a separate PR to fix posix test coverage rather than include it in this PR which has many other things already. So I send out #24463

@tyxia tyxia requested review from RyanTheOptimist and removed request for yanavlasov December 9, 2022 15:58
@tyxia
Copy link
Copy Markdown
Member Author

tyxia commented Dec 9, 2022

/assign @yanavlasov

Sorry I didn't remove the request, I just click a request review from Ryan button and somehow Github removed it :(

@RyanTheOptimist
Copy link
Copy Markdown
Contributor

Hm. Even though #24463 has landed, this PR still includes a change to source/common/common/posix. Is that expected?

@tyxia
Copy link
Copy Markdown
Member Author

tyxia commented Dec 12, 2022

Hm. Even though #24463 has landed, this PR still includes a change to source/common/common/posix. Is that expected?

Yea, The change in this PR for posix is exactly same as #24463. It is gone now after I merge with main.

@yanavlasov yanavlasov merged commit ad688d9 into envoyproxy:main Dec 13, 2022
@alyssawilk
Copy link
Copy Markdown
Contributor

Unfortunately I'm not quite sure the coverage results worked:
Checking per-extension coverage
/source/test/run_envoy_bazel_coverage.sh: line 121: ./test/per_file_coverage.sh: Permission denied
Per-extension coverage passed.
I don't think it was your PR but I'm not sure if the number here is correct as CI functionally didn't run in at least one pass. I'm fixing in #24529 and we'll see how it goes

@phlax
Copy link
Copy Markdown
Member

phlax commented Dec 14, 2022

for ref the permissions were changed in 614d03a

@alyssawilk
Copy link
Copy Markdown
Contributor

thankfully all good, coverage runs restored cleanly :-)

@tyxia tyxia deleted the rlqs_11 branch December 14, 2022 16:54
@tyxia tyxia mentioned this pull request Dec 14, 2022
jpsim added a commit that referenced this pull request Dec 14, 2022
…-tools

* origin/main: (59 commits)
  Make IsOkAndHolds matcher work with submatchers (#24498)
  ios: fix platform key value store (#24532)
  make ClusterInfo::traffic_stats_ a unique_ptr, so that later we can lazy-init it later. (#24406)
  quic: splitting into client and server (#24513)
  fixing coverage (#24529)
  ci: Add `examplesOnly` condition (#24465)
  ci: sonatype_nexus_upload.py: remove unused format argument (#24471)
  deps: Bump `build_bazel_rules_apple` -> 1.1.3 (#24527)
  deps: Bump `com_github_nghttp2_nghttp2` -> 1.51.0 (#24525)
  deps: Bump `rules_license` -> 0.0.4 (#24523)
  build(deps): bump sphinxcontrib-httpdomain from 1.8.0 to 1.8.1 in /mobile/docs (#24126)
  build(deps): bump github/codeql-action from 2.1.35 to 2.1.36 (#24473)
  build(deps): bump openpolicyagent/opa from 0.47.2-istio to 0.47.3-istio in /examples/ext_authz (#24514)
  build(deps): bump node from `80844b6` to `2770c78` in /examples/ext_authz/auth/http-service (#24515)
  build(deps): bump abseil-cpp to latest version (#24386)
  xDS: add xDS config tracker extension point (#23485)
  kafka: add shared consumer manager (#24494)
  coverage: Improve test coverage (#24355)
  deps: Bump `rules_python` -> 0.16.1 (#24344)
  ci: revert disable running the Objective-C integration app (#24478)" (#24496)
  ...

Signed-off-by: JP Simard <jp@jpsim.com>
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.

5 participants