-
Notifications
You must be signed in to change notification settings - Fork 98
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
Replace httpmock with hyper #190
Conversation
This has been done wherever it would reduce the number of lines needed
// The panic_rx channel is to make sure the test fails if the server panics. | ||
// If the server panics, the message is not sent and the recv call panics. |
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.
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.
I'm not in that server (and can't tell which server it is) so I can't view that message
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.
It is in tokio's discord server which has channels for hyper, h3, reqwest and more.
540eb94
to
f153c3c
Compare
4bd46f6
to
88dfdf7
Compare
The problem with An easy fix is to enable the An even easier fix is to change the |
See #190 (comment) for why the test was failing on x86_64-unknown-linux-gnu before this change
I managed to get the integration tests working on ARM: /// Cargo-cross for ARM runs tests using qemu.
///
/// It sets an environment variable like this:
/// CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_RUNNER=qemu-arm
fn find_runner() -> Option<String> {
for (key, value) in std::env::vars() {
if key.starts_with("CARGO_TARGET_") && key.ends_with("_RUNNER") && !value.is_empty() {
return Some(value);
}
}
None
}
fn get_base_command() -> Command {
let mut cmd;
let path = assert_cmd::cargo::cargo_bin("xh");
if let Some(runner) = find_runner() {
cmd = Command::new(runner);
cmd.arg(path);
} else {
cmd = Command::new(path);
}
cmd.env("HOME", "");
#[cfg(target_os = "windows")]
cmd.env("XH_TEST_MODE_WIN_HOME_DIR", "");
cmd
} |
Co-authored-by: Jan Verbeek <jan.verbeek@posteo.nl>
…remove-httpmock
Woohoo! I can't believe that integration tests are finally working for ARM. How does the solution work? are there any docs I can refer to? Oh, and should we get rid of the |
I don't know if it's documented anywhere (and how safely we can rely on it). Cross uses qemu to run binaries for other architectures. You prefix a command with e.g. Cross fiddles with cargo to make sure your test binaries are run through qemu. But we build our own commands and they aren't fixed automatically. I had a suspicion it was something like this, and discovered the details and this solution by panicking in the tests with the output of I think this would've worked before cross-rs/cross#122, when it still used binfmt and didn't need to make the runner explicit.
Yeah, I think we no longer have a need for it. |
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.
This looks great! I also like the online-tests
feature.
I noticed some inconsistency between writing http::Response
and hyper::Response
, use http::Response;
could clean things up. But that doesn't really matter.
// The panic_rx channel is to make sure the test fails if the server panics. | ||
// If the server panics, the message is not sent and the recv call panics. |
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.
I'm not in that server (and can't tell which server it is) so I can't view that message
Co-authored-by: Jan Verbeek <jan.verbeek@posteo.nl>
I'm ok with merging now and re-enabling the test after chromium/badssl.com#482 is fixed. |
Also introduces a feature flag named
online-tests
that can be used to filter out tests that require an internet connection.Resolves #186