-
Notifications
You must be signed in to change notification settings - Fork 566
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
test: add cache testing suite #3842
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note these aren't compliance tests, we don't need to pass 100% of these. Arguably we shouldn't since some of the tests aren't even applicable to Undici.
If these tests are targeting fetch, and fetch is a browser spec, why wouldn't some of the tests be applicable?
They aren't targeting fetch. It has tests for every part of the stack that can implement caching. They're written in js w/ fetch so that they can be ran in browsers, but browsers aren't the only thing the tests cover. A lot of the behaviors do overlap, however, there are still things specific to servers or cdns. There are also tests for things that rfc9111 obsoletes (such as using the |
What I mean is that the tests explicitly use fetch and it tests browser caching behavior (every http request made through browsers is done through fetch, at least in the specs). Anything that doesn't work would seem like a bug to me. In the fetch spec, the http cache is built a layer above fetch, whereas in undici it's a layer below. For example, in multiple parts of the spec we are meant to query the cache directly (see http-network-or-cache-fetch). There are multiple situations where headers may get added to requests/responses, or the internal request is modified in some way that will cause bugs or deviate from browser behavior. It's not a huge issue, as it's opt-in and not built specifically for fetch, but it does feel weird to not implement the caching steps in the spec, but still use fetch to test it.
Is there anything specific?
Is lack of pragma support intentional, because it's obsolete? Is there no plan on adding support for it? |
They're mostly tests for
It was intentionally left out, right now there aren't any plans to add it. |
So it does look like we can run tests that only apply to browsers, which should skip the cdn tests |
9e6819f
to
9781332
Compare
Why did you lift the entirety of the source code of that project? What's the long term maintainability strategy? Either:
Anyhow, I would recommend not to use |
31354d9
to
9f8f8d2
Compare
Closes nodejs#3852 Closes nodejs#3869 Signed-off-by: flakey5 <73616808+flakey5@users.noreply.github.com>
9f8f8d2
to
5662d57
Compare
We can't - it hasn't been updated in 4 years and there seem to be relevant tests added and fixed in that time.
afaict the tests are specifically vendored for use in browsers and the |
In addition to what @KhafraDev said, there's a fix I needed to make to the source (re http-tests/cache-tests#139)
+1 |
Signed-off-by: flakey5 <73616808+flakey5@users.noreply.github.com>
Marking this ready for review now for the sake of getting the fixes so far in before the v7 release. The current status is ~53-55% tests are passing. Roughly 20% of the tests are failing but marked as optional. Another roughly 20% of the tests are failing and aren't marked as optional, however, their behaviors either are optional according to RFC9111 or they're obsolete/deprecated behaviors. There are 3-4 that are failing that are an exception to this, however, any time I reproduce the tests outside of the test runner w/ the same parameters they pass 🤷 . A handful of other tests fail as well since we don't have support for status codes other than 200 and 307 which will come later. |
Signed-off-by: flakey5 <73616808+flakey5@users.noreply.github.com>
Co-authored-by: Khafra <maitken033380023@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
This adds the test suite from https://cache-tests.fyi to test the cache interceptor.
Note these aren't compliance tests, we don't need to pass 100% of these. Arguably we shouldn't since some of the tests aren't even applicable to Undici (i.e. cdn-specific, we can skip these though). However, I do think we should try to rely on these in CI.
Current issues:
TypeError: fetch failed
, mostly socket & http protocol issues)Closes #3852
Closes #3869
cc @mcollina @ronag