re-enable previously disabled tests (#11821)

On Windows, `gix` will call the `git-credential-manager, but with
`stderr` set to `inherit` it makes any errors visible to the user,
just like `git` does.

```
1   1         Updating git repository `https://foo.bar/foo/bar`
    2    +warning: auto-detection of host provider took too long (>2000ms)
    3    +warning: see https://aka.ms/gcm/autodetect for more information.
    4    +fatal: A task was canceled.
    5    +warning: auto-detection of host provider took too long (>2000ms)
    6    +warning: see https://aka.ms/gcm/autodetect for more information.`
````

This, however, isn't what's desirable in tests sometimes, nor may
it be desirable in Cargo.

In the latest version of `gix`, it's possible to control `stderr`
which is now set on a per-test basis.

Also note that for `cargo` as a whole the default didn't change,
and stderr of spawned helper programs will remain visible in the
enclosing terminal.
This commit is contained in:
Sebastian Thiel 2023-12-05 21:14:38 +01:00
parent 50c0005a28
commit 49c48b88cc
No known key found for this signature in database
GPG key ID: 9CB5EE7895E8268B

View file

@ -105,11 +105,6 @@ fn setup_failed_auth_test() -> (SocketAddr, JoinHandle<()>, Arc<AtomicUsize>) {
// Tests that HTTP auth is offered from `credential.helper`.
#[cargo_test]
fn http_auth_offered() {
// TODO(Seb): remove this once possible.
if cargo_uses_gitoxide() {
// Without the fixes in https://github.com/Byron/gitoxide/releases/tag/gix-v0.41.0 this test is flaky.
return;
}
let (addr, t, connections) = setup_failed_auth_test();
let p = project()
.file(
@ -139,6 +134,7 @@ fn http_auth_offered() {
// This is a "contains" check because the last error differs by platform,
// may span multiple lines, and isn't relevant to this test.
p.cargo("check")
.env("GIX_CREDENTIALS_HELPER_STDERR", "0")
.with_status(101)
.with_stderr_contains(&format!(
"\
@ -372,11 +368,6 @@ Caused by:
#[cargo_test]
fn instead_of_url_printed() {
// TODO(Seb): remove this once possible.
if cargo_uses_gitoxide() {
// Without the fixes in https://github.com/Byron/gitoxide/releases/tag/gix-v0.41.0 this test is flaky.
return;
}
let (addr, t, _connections) = setup_failed_auth_test();
let config = paths::home().join(".gitconfig");
let mut config = git2::Config::open(&config).unwrap();
@ -403,6 +394,7 @@ fn instead_of_url_printed() {
.build();
p.cargo("check")
.env("GIX_CREDENTIALS_HELPER_STDERR", "0")
.with_status(101)
.with_stderr(&format!(
"\