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

x/pkgsite: Add unit test to cover cache bypass by cookie #66947

Closed
behnambm opened this issue Apr 21, 2024 · 2 comments
Closed

x/pkgsite: Add unit test to cover cache bypass by cookie #66947

behnambm opened this issue Apr 21, 2024 · 2 comments

Comments

@behnambm
Copy link

What is the URL of the page with the issue?

https://github.com/golang/pkgsite/blob/ddbbf7b6745ea937506c52fefb4d4688b5f0665e/internal/middleware/caching.go#L148

What is your user agent?

Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36

Screenshot

No response

What did you do?

After running the tests I noticed that the cache middleware tests do not cover bypassing the cache by cookie.

What did you see happen?

image

What did you expect to see?

I propose to contribute a unit test covering the cache middleware bypass functionality with cookie settings in golang.org/x/pkgsite/internal/middleware/caching.go. This addition will elevate the test coverage from 73% to 75.7% and address an important yet uncovered part of the codebase.

Looking forward to collaborating on this enhancement.

@gopherbot gopherbot added this to the Unreleased milestone Apr 21, 2024
@findleyr
Copy link
Contributor

My guess is that this behavior is tested by integration tests, though I don't know.
I'm inclined to decline adding additional unit tests at this point, as the project is relatively stable, and unit tests are most useful during periods of active development. At this point, the cognitive overhead to review a unit test may not be worthwhile.

We aren't particularly concerned about unit test coverage percentage at this phase in the project's lifecycle.

So I don't encourage acting on this now. I'll defer to @jba if he would like to review a contribution here.

@jba
Copy link
Contributor

jba commented Apr 25, 2024

I agree with @findleyr. Thanks for your effort, though.

@findleyr findleyr closed this as not planned Won't fix, can't repro, duplicate, stale Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants