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

Tests fail when run with --all-features #2463

Closed
gretchenfrage opened this issue Oct 29, 2024 · 0 comments · Fixed by #2464
Closed

Tests fail when run with --all-features #2463

gretchenfrage opened this issue Oct 29, 2024 · 0 comments · Fixed by #2464

Comments

@gretchenfrage
Copy link
Contributor

On current master (797df2b96a88ee49a636337f87beebe87f6212fe) with Rust 1.82 (rustc 1.82.0 (f6e511eec 2024-10-15), cargo 1.82.0 (8f40fc59f 2024-08-21)), although a regular run of cargo test works fine, attempting to run RUSTFLAGS='--cfg reqwest_unstable' cargo test --all-features --tests fails with the following errors (which would have just warnings if not escalated by deny directives):

Errors
warning: variable does not need to be mutable
   --> src/blocking/client.rs:619:20
    |
619 |     pub fn add_crl(mut self, crl: CertificateRevocationList) -> ClientBuilder {
    |                    ----^^^^
    |                    |
    |                    help: remove this `mut`
    |
    = note: `#[warn(unused_mut)]` on by default

warning: variable does not need to be mutable
   --> src/blocking/client.rs:632:9
    |
632 |         mut self,
    |         ----^^^^
    |         |
    |         help: remove this `mut`

error: variable does not need to be mutable
   --> src/blocking/client.rs:619:20
    |
619 |     pub fn add_crl(mut self, crl: CertificateRevocationList) -> ClientBuilder {
    |                    ----^^^^
    |                    |
    |                    help: remove this `mut`
    |
note: the lint level is defined here
   --> src/lib.rs:4:24
    |
4   | #![cfg_attr(test, deny(warnings))]
    |                        ^^^^^^^^
    = note: `#[deny(unused_mut)]` implied by `#[deny(warnings)]`

error: variable does not need to be mutable
   --> src/blocking/client.rs:632:9
    |
632 |         mut self,
    |         ----^^^^
    |         |
    |         help: remove this `mut`

error: could not compile `reqwest` (lib test) due to 2 previous errors

Those errors can be fixed with the following diff:

Diff
diff --git a/src/blocking/client.rs b/src/blocking/client.rs
index 7b5caff..4db9e42 100644
--- a/src/blocking/client.rs
+++ b/src/blocking/client.rs
@@ -616,7 +616,7 @@ impl ClientBuilder {
     /// This requires the `rustls-tls(-...)` Cargo feature enabled.
     #[cfg(feature = "__rustls")]
     #[cfg_attr(docsrs, doc(cfg(feature = "rustls-tls")))]
-    pub fn add_crl(mut self, crl: CertificateRevocationList) -> ClientBuilder {
+    pub fn add_crl(self, crl: CertificateRevocationList) -> ClientBuilder {
         self.with_inner(move |inner| inner.add_crl(crl))
     }
 
@@ -629,7 +629,7 @@ impl ClientBuilder {
     #[cfg(feature = "__rustls")]
     #[cfg_attr(docsrs, doc(cfg(feature = "rustls-tls")))]
     pub fn add_crls(
-        mut self,
+        self,
         crls: impl IntoIterator<Item = CertificateRevocationList>,
     ) -> ClientBuilder {
         self.with_inner(move |inner| inner.add_crls(crls))

However, this still results in a failure of the async_impl_file_part test:

---- async_impl_file_part stdout ----
thread 'test(async_impl_file_part)-support-server' panicked at tests/multipart.rs:211:37:
no entry found for key "transfer-encoding"
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'async_impl_file_part' panicked at tests/multipart.rs:228:10:
called `Result::unwrap()` on an `Err` value: reqwest::Error { kind: Request, url: "http://127.0.0.1:43241/multipart/3", source: hyper_util::client::legacy::Error(SendRequest, hyper::Error(Io, Os { code: 104, kind: ConnectionReset, message: "Connection reset by peer" })) }

That test was added in cc3dd510c0cb50ee03be217ea864d84e744658d1 ("Add file function to async::multipart (#2106)", Aug/31/2024), which is currently master~14. In that commit, running RUSTFLAGS='--cfg reqwest_unstable' cargo test --all-features --tests does not error.

It is at commit aba01ff7df33a3f29e3f7fdbd24ee90390276335 ("feat: Add support for Certificate Revocation Lists (#2433)", Oct/18/2024), which is currently master~4, that the compilation error appears when running the tests. However, as of that commit, if the compilation error is patched, the tests do not error.

It it as commit 598f8574cb428bb03b487e0abfd8169a594dd2db ("Add content length to async_impl::multipart file streams (#2459)", Oct/27/2024), which is currently master~2, that the test failure appears even with the patched test.

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 a pull request may close this issue.

1 participant