Skip to content

Commit 55c5c09

Browse files
committed
test: Migrate git_auth to snapbox - gitoxide/mac/win
1 parent f74e430 commit 55c5c09

File tree

1 file changed

+16
-39
lines changed

1 file changed

+16
-39
lines changed

tests/testsuite/git_auth.rs

+16-39
Original file line numberDiff line numberDiff line change
@@ -241,14 +241,14 @@ Caused by:
241241
An IO error occurred when talking to the server
242242
243243
Caused by:
244-
[35] SSL connect error (schannel: failed to receive handshake, SSL/TLS connection failed)"
244+
[35] SSL connect error ([..])"
245245
} else if cfg!(windows) {
246-
"[..]failed to send request: [..]"
246+
"[..]failed to send request: [..]\n..."
247247
} else if cfg!(target_os = "macos") {
248248
// macOS is difficult to tests as some builds may use Security.framework,
249249
// while others may use OpenSSL. In that case, let's just not verify the error
250250
// message here.
251-
"[..]"
251+
"..."
252252
} else {
253253
"[..]SSL [ERROR][..]"
254254
}
@@ -300,39 +300,16 @@ fn ssh_something_happens() {
300300
// "[..]banner exchange: Connection to 127.0.0.1 [..]"
301301
// banner exchange: Connection to 127.0.0.1 port 62250: Software caused connection abort
302302
// But since there is no common meaningful sequence or word, we can only match a small telling sequence of characters.
303-
"onnect".to_string()
303+
"[..]onnect[..]"
304304
} else {
305-
format!(
306-
r"
307-
Caused by:
308-
failed to clone into: [ROOT]/home/.cargo/git/db/bar-[HASH]
309-
310-
Caused by:
311-
network failure seems to have happened
312-
if a proxy or similar is necessary `net.git-fetch-with-cli` may help here
313-
https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli
314-
315-
Caused by:
316-
An IO error occurred when talking to the server
317-
318-
Caused by:
319-
Connection closed by {} port {}
320-
",
321-
addr.ip(),
322-
addr.port()
323-
)
305+
"[..]Connection [..] by [..]\n..."
324306
};
325307
format!(
326308
"\
327309
[UPDATING] git repository `ssh://{addr}/foo/bar`
328-
[ERROR] failed to get `bar` as a dependency of package `foo v0.0.1 ([ROOT]/foo)`
329-
330-
Caused by:
331-
failed to load source for dependency `bar`
332-
333-
Caused by:
334-
Unable to update ssh://{addr}/foo/bar
335-
{message}"
310+
...
311+
{message}
312+
"
336313
)
337314
} else {
338315
format!(
@@ -391,9 +368,9 @@ fn net_err_suggests_fetch_with_cli() {
391368
.with_stderr_data(format!(
392369
"\
393370
[UPDATING] git repository `ssh://needs-proxy.invalid/git`
394-
[WARNING] spurious network error (3 tries remaining): failed to resolve address for needs-proxy.invalid: Name or service not known; class=Net (12)
395-
[WARNING] spurious network error (2 tries remaining): failed to resolve address for needs-proxy.invalid: Name or service not known; class=Net (12)
396-
[WARNING] spurious network error (1 tries remaining): failed to resolve address for needs-proxy.invalid: Name or service not known; class=Net (12)
371+
[WARNING] spurious network error (3 tries remaining): [..] resolve [..] needs-proxy.invalid: [..] known[..]
372+
[WARNING] spurious network error (2 tries remaining): [..] resolve [..] needs-proxy.invalid: [..] known[..]
373+
[WARNING] spurious network error (1 tries remaining): [..] resolve [..] needs-proxy.invalid: [..] known[..]
397374
[ERROR] failed to get `foo` as a dependency of package `foo v0.0.0 ([ROOT]/foo)`
398375
399376
Caused by:
@@ -417,9 +394,9 @@ Caused by:
417394
r" An IO error occurred when talking to the server
418395
419396
Caused by:
420-
ssh: Could not resolve hostname needs-proxy.invalid"
397+
ssh: Could not resolve hostname needs-proxy.invalid[..]"
421398
} else {
422-
" failed to resolve address for needs-proxy.invalid: Name or service not known; class=Net (12)"
399+
" failed to resolve address for needs-proxy.invalid: [..] known[..]; class=Net (12)"
423400
}
424401
))
425402
.run();
@@ -436,8 +413,8 @@ Caused by:
436413
.with_status(101)
437414
.with_stderr_data(str![[r#"
438415
[UPDATING] git repository `ssh://needs-proxy.invalid/git`
439-
[RUNNING] `git fetch --verbose --force --update-head-ok 'ssh://needs-proxy.invalid/git' '+HEAD:refs/remotes/origin/HEAD'`
440-
ssh: Could not resolve hostname needs-proxy.invalid: Name or service not known
416+
[RUNNING] `git fetch --verbose --force --update-head-ok [..]ssh://needs-proxy.invalid/git[..] [..]+HEAD:refs/remotes/origin/HEAD[..]`
417+
ssh: Could not resolve hostname needs-proxy.invalid: [..] not known
441418
fatal: Could not read from remote repository.
442419
443420
Please make sure you have the correct access rights
@@ -454,7 +431,7 @@ Caused by:
454431
failed to fetch into: [ROOT]/home/.cargo/git/db/git-[HASH]
455432
456433
Caused by:
457-
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)
434+
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)
458435
459436
"#]])
460437
.with_stderr_does_not_contain("[..]try enabling `git-fetch-with-cli`[..]")

0 commit comments

Comments
 (0)