Repository navigation
Testable net load... - #7139
Testable net load...#7139
Conversation
|
Woohoo! |
|
Ok, I've read through all of these changes. First off, the load_consumer/load split is great, and I really like the enum for all of the possible errors now. Great work there! Also, If the nossl stuff is causing you pain, go ahead and get rid of it. I don't believe anybody is using it. With regards to the question about boxing, what about something like this: trait HttpRequestor {
type Response: HttpResponse;
fn send(...) -> Result<Self::Response, LoadError>;
}I'm not super keen on the implementation of NetworkHttpRequester::Send. It feels to me like we could get away with a series of traits with associated types that return fn send(&self) -> Result<R, LoadError> {
R::create(&self.headers, &self.body, &self.method)
}where MockResponse is defined like: trait MockResponse {
fn create(&Headers, &Option<Vec<u8>>, &Method) -> Result<Self, LoadError>;
}I think that would allow the unit tests to stay slim like they currently are. Does that make sense? |
|
I agree that the I'll have a go at rejiggering it a bit. |
|
☔ The latest upstream changes (presumably #7225) made this pull request unmergeable. Please resolve the merge conflicts. |
f463071 to
d79b453
Compare
|
@samfoo Looking really good! Is this ready for review at this point, or are you intending to make more changes? |
|
Not quite ready yet, @jdm. Going to spend some time today finishing off adding the tests I want and any additional refactorings. |
98e07ca to
f7a55ac
Compare
|
@jdm, this should be ready to review now. |
|
Great! Unfortunately I'll be on vacation this week, and I can't promise that anybody else will be able to look at the changes before I get back. Apologies for the delay! |
f7a55ac to
87e5ef1
Compare
|
☔ The latest upstream changes (presumably #7265) made this pull request unmergeable. Please resolve the merge conflicts. |
87e5ef1 to
545683d
Compare
Testable net load... *The goal of this PR is to get early feedback on this before I go too far down the rabbit hole. This new code path is working, and there's several tests I've written as a proof of concept. There are still some regressions that I'll be fixing in the coming days.* I've abstracted out the request/response cycle so that it's no longer dependent on the Hyper request/response structs. Since request/response @ hyper are structs, not traits, it made mocking them for tests impossible. Current issues/concerns: * This relies on boxing the `HttpResponse` that gets returned from the `HttpRequester` because `HttpResponse` is unsized. I don't know if there's a more idiomatic rust-y way of doing this? * This relies on boxing the `Read` that is now returned from `load` for the same reason. * The devtools and resource manager channels are still passed into `load`. It might be easier to inject these as trait dependencies instead of chans as well? * Needs more tests. :tophat: #6727 <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7139) <!-- Reviewable:end -->
|
💔 Test failed - mac-rel-wpt |
|
|
Specifically: |
|
We should specifically check for the "http" scheme at https://github.com/servo/servo/pull/7139/files#diff-aa469beb5619907dbccd88364264b9b8R463, not anything that isn't "https". |
|
Urg. Yep. I saw that outcome when I ran locally and didn't realise it was a failure 😧 Will have to fix later today when I have time. |
|
@bors-servo: r+ |
|
📌 Commit 43e0c4a has been approved by |
Testable net load... *The goal of this PR is to get early feedback on this before I go too far down the rabbit hole. This new code path is working, and there's several tests I've written as a proof of concept. There are still some regressions that I'll be fixing in the coming days.* I've abstracted out the request/response cycle so that it's no longer dependent on the Hyper request/response structs. Since request/response @ hyper are structs, not traits, it made mocking them for tests impossible. Current issues/concerns: * This relies on boxing the `HttpResponse` that gets returned from the `HttpRequester` because `HttpResponse` is unsized. I don't know if there's a more idiomatic rust-y way of doing this? * This relies on boxing the `Read` that is now returned from `load` for the same reason. * The devtools and resource manager channels are still passed into `load`. It might be easier to inject these as trait dependencies instead of chans as well? * Needs more tests. :tophat: #6727 <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7139) <!-- Reviewable:end -->
|
💔 Test failed - mac-rel-css |
|
⚡ Previous build results for android, gonk, linux-dev, linux-rel, mac-dev-ref-unit, mac-rel-wpt are reusable. Rebuilding only mac-rel-css... |
|
☀️ Test successful - android, gonk, linux-dev, linux-rel, mac-dev-ref-unit, mac-rel-css, mac-rel-wpt |

The goal of this PR is to get early feedback on this before I go too far down the rabbit hole. This new code path is working, and there's several tests I've written as a proof of concept. There are still some regressions that I'll be fixing in the coming days.
I've abstracted out the request/response cycle so that it's no longer dependent on the Hyper request/response structs. Since request/response @ hyper are structs, not traits, it made mocking them for tests impossible.
Current issues/concerns:
HttpResponsethat gets returned from theHttpRequesterbecauseHttpResponseis unsized. I don't know if there's a more idiomatic rust-y way of doing this?Readthat is now returned fromloadfor the same reason.load. It might be easier to inject these as trait dependencies instead of chans as well?🎩
#6727