Skip to content

Commit

Permalink
test: Migrate git_auth to snapbox - compat fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dieterplex committed Jul 1, 2024
1 parent 792e301 commit 573d64e
Showing 1 changed file with 28 additions and 30 deletions.
58 changes: 28 additions & 30 deletions tests/testsuite/git_auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,16 +241,14 @@ Caused by:
An IO error occurred when talking to the server
Caused by:
[35] SSL connect error (schannel: failed to receive handshake, SSL/TLS connection failed)"
[35] SSL connect error ([..])"
} else if cfg!(windows) {
r"\
failed to send request: A connection with the server could not be established
; class=Os (2)"
" failed to send request: A connection with the server could not be established\n ; class=Os (2)"
} else if cfg!(target_os = "macos") {
// macOS is difficult to tests as some builds may use Security.framework,
// while others may use OpenSSL. In that case, let's just not verify the error
// message here.
"[..]"
"..."
} else {
r" SSL [ERROR] syscall failure: ; class=Os (2)"
}
Expand Down Expand Up @@ -302,38 +300,38 @@ fn ssh_something_happens() {
// "[..]banner exchange: Connection to 127.0.0.1 [..]"
// banner exchange: Connection to 127.0.0.1 port 62250: Software caused connection abort
// But since there is no common meaningful sequence or word, we can only match a small telling sequence of characters.
"onnect".to_string()
} else {
format!(
r"
Caused by:
failed to clone into: [ROOT]/home/.cargo/git/db/bar-[HASH]
Caused by:
network failure seems to have happened
if a proxy or similar is necessary `net.git-fetch-with-cli` may help here
https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli
Caused by:
An IO error occurred when talking to the server
Caused by:
Connection closed by {} port {}
",
" banner exchange: Connection to {} port {}: Software caused connection abort",
addr.ip(),
addr.port()
)
} else {
"[..]Connection closed by [..]".to_string()
};
format!(
"\
[UPDATING] git repository `ssh://{addr}/foo/bar`
...
[ERROR] failed to get `bar` as a dependency of package `foo v0.0.1 ([ROOT]/foo)`
Caused by:
failed to load source for dependency `bar`
Caused by:
Unable to update ssh://{addr}/foo/bar
Caused by:
failed to clone into: [ROOT]/home/.cargo/git/db/bar-[HASH]
Caused by:
network failure seems to have happened
if a proxy or similar is necessary `net.git-fetch-with-cli` may help here
https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli
Caused by:
An IO error occurred when talking to the server
Caused by:
{message}"
)
} else {
Expand Down Expand Up @@ -393,9 +391,9 @@ fn net_err_suggests_fetch_with_cli() {
.with_stderr_data(format!(
"\
[UPDATING] git repository `ssh://needs-proxy.invalid/git`
[WARNING] spurious network error (3 tries remaining): failed to resolve address for needs-proxy.invalid: Name or service not known; class=Net (12)
[WARNING] spurious network error (2 tries remaining): failed to resolve address for needs-proxy.invalid: Name or service not known; class=Net (12)
[WARNING] spurious network error (1 tries remaining): failed to resolve address for needs-proxy.invalid: Name or service not known; class=Net (12)
[WARNING] spurious network error (3 tries remaining): [..] resolve [..] needs-proxy.invalid: [..] known[..]
[WARNING] spurious network error (2 tries remaining): [..] resolve [..] needs-proxy.invalid: [..] known[..]
[WARNING] spurious network error (1 tries remaining): [..] resolve [..] needs-proxy.invalid: [..] known[..]
[ERROR] failed to get `foo` as a dependency of package `foo v0.0.0 ([ROOT]/foo)`
Caused by:
Expand All @@ -419,9 +417,9 @@ Caused by:
r" An IO error occurred when talking to the server
Caused by:
ssh: Could not resolve hostname needs-proxy.invalid"
ssh: Could not resolve hostname needs-proxy.invalid[..]"
} else {
" failed to resolve address for needs-proxy.invalid: Name or service not known; class=Net (12)"
" failed to resolve address for needs-proxy.invalid: [..] known[..]; class=Net (12)"
}
))
.run();
Expand All @@ -438,8 +436,8 @@ Caused by:
.with_status(101)
.with_stderr_data(str![[r#"
[UPDATING] git repository `ssh://needs-proxy.invalid/git`
[RUNNING] `git fetch --verbose --force --update-head-ok 'ssh://needs-proxy.invalid/git' '+HEAD:refs/remotes/origin/HEAD'`
ssh: Could not resolve hostname needs-proxy.invalid: Name or service not known
[RUNNING] `git fetch --verbose --force --update-head-ok [..]ssh://needs-proxy.invalid/git[..] [..]+HEAD:refs/remotes/origin/HEAD[..]`
ssh: Could not resolve hostname needs-proxy.invalid: [..] not known
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
Expand All @@ -456,7 +454,7 @@ Caused by:
failed to fetch into: [ROOT]/home/.cargo/git/db/git-[HASH]
Caused by:
process didn't exit successfully: `git fetch --verbose --force --update-head-ok 'ssh://needs-proxy.invalid/git' '+HEAD:refs/remotes/origin/HEAD'` ([EXIT_STATUS]: 128)
process didn't exit successfully: `git fetch --verbose --force --update-head-ok [..]ssh://needs-proxy.invalid/git[..] [..]+HEAD:refs/remotes/origin/HEAD[..]` ([EXIT_STATUS]: 128)
"#]])
.with_stderr_does_not_contain("[..]try enabling `git-fetch-with-cli`[..]")
Expand Down

0 comments on commit 573d64e

Please sign in to comment.