Skip to content

Commit

Permalink
re-enable previously disabled tests with Windows-specific fix
Browse files Browse the repository at this point in the history
On Windows, `gix` will call the `git-credential-manager, but with
`stderr` set to `inherit` which 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.

For now, it seems easiest to disable this particular feature that
issues the warning messages, even though a future `gix` update
should allow to control what to do with `stderr`.
  • Loading branch information
Byron committed Dec 5, 2023
1 parent a5fa676 commit 2006e84
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions tests/testsuite/git_auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -139,6 +134,8 @@ 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")
// TODO(Seb): remove this once `gix` lets callers control what to do with `stderr`.
.env("GCM_AUTODETECT_TIMEOUT", "-1")
.with_status(101)
.with_stderr_contains(&format!(
"\
Expand Down Expand Up @@ -372,11 +369,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();
Expand All @@ -403,6 +395,8 @@ fn instead_of_url_printed() {
.build();

p.cargo("check")
// TODO(Seb): remove this once `gix` lets callers control what to do with `stderr`.
.env("GCM_AUTODETECT_TIMEOUT", "-1")
.with_status(101)
.with_stderr(&format!(
"\
Expand Down

0 comments on commit 2006e84

Please sign in to comment.