Skip to content

Commit

Permalink
test: Migrate git_auth to snapbox - gitoxide/mac/win
Browse files Browse the repository at this point in the history
  • Loading branch information
dieterplex committed Jul 2, 2024
1 parent f74e430 commit 152a0c2
Showing 1 changed file with 26 additions and 30 deletions.
56 changes: 26 additions & 30 deletions tests/testsuite/git_auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,14 +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) {
"[..]failed to send request: [..]"
} 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 {
"[..]SSL [ERROR][..]"
}
Expand Down Expand Up @@ -300,10 +300,21 @@ 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()
"[..]onnect[..]"
} else {
format!(
r"
"[..]Connection [..] by [..]"
};
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]
Expand All @@ -316,23 +327,8 @@ Caused by:
An IO error occurred when talking to the server
Caused by:
Connection closed by {} port {}
",
addr.ip(),
addr.port()
)
};
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
{message}"
{message}
"
)
} else {
format!(
Expand Down Expand Up @@ -391,9 +387,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 @@ -417,9 +413,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 @@ -436,8 +432,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 @@ -454,7 +450,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 152a0c2

Please sign in to comment.