Skip to content

Commit 152a0c2

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

File tree

1 file changed

+26
-30
lines changed

1 file changed

+26
-30
lines changed

tests/testsuite/git_auth.rs

+26-30
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) {
246246
"[..]failed to send request: [..]"
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,10 +300,21 @@ 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"
305+
"[..]Connection [..] by [..]"
306+
};
307+
format!(
308+
"\
309+
[UPDATING] git repository `ssh://{addr}/foo/bar`
310+
[ERROR] failed to get `bar` as a dependency of package `foo v0.0.1 ([ROOT]/foo)`
311+
312+
Caused by:
313+
failed to load source for dependency `bar`
314+
315+
Caused by:
316+
Unable to update ssh://{addr}/foo/bar
317+
307318
Caused by:
308319
failed to clone into: [ROOT]/home/.cargo/git/db/bar-[HASH]
309320
@@ -316,23 +327,8 @@ Caused by:
316327
An IO error occurred when talking to the server
317328
318329
Caused by:
319-
Connection closed by {} port {}
320-
",
321-
addr.ip(),
322-
addr.port()
323-
)
324-
};
325-
format!(
326-
"\
327-
[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}"
330+
{message}
331+
"
336332
)
337333
} else {
338334
format!(
@@ -391,9 +387,9 @@ fn net_err_suggests_fetch_with_cli() {
391387
.with_stderr_data(format!(
392388
"\
393389
[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)
390+
[WARNING] spurious network error (3 tries remaining): [..] resolve [..] needs-proxy.invalid: [..] known[..]
391+
[WARNING] spurious network error (2 tries remaining): [..] resolve [..] needs-proxy.invalid: [..] known[..]
392+
[WARNING] spurious network error (1 tries remaining): [..] resolve [..] needs-proxy.invalid: [..] known[..]
397393
[ERROR] failed to get `foo` as a dependency of package `foo v0.0.0 ([ROOT]/foo)`
398394
399395
Caused by:
@@ -417,9 +413,9 @@ Caused by:
417413
r" An IO error occurred when talking to the server
418414
419415
Caused by:
420-
ssh: Could not resolve hostname needs-proxy.invalid"
416+
ssh: Could not resolve hostname needs-proxy.invalid[..]"
421417
} else {
422-
" failed to resolve address for needs-proxy.invalid: Name or service not known; class=Net (12)"
418+
" failed to resolve address for needs-proxy.invalid: [..] known[..]; class=Net (12)"
423419
}
424420
))
425421
.run();
@@ -436,8 +432,8 @@ Caused by:
436432
.with_status(101)
437433
.with_stderr_data(str![[r#"
438434
[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
435+
[RUNNING] `git fetch --verbose --force --update-head-ok [..]ssh://needs-proxy.invalid/git[..] [..]+HEAD:refs/remotes/origin/HEAD[..]`
436+
ssh: Could not resolve hostname needs-proxy.invalid: [..] not known
441437
fatal: Could not read from remote repository.
442438
443439
Please make sure you have the correct access rights
@@ -454,7 +450,7 @@ Caused by:
454450
failed to fetch into: [ROOT]/home/.cargo/git/db/git-[HASH]
455451
456452
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)
453+
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)
458454
459455
"#]])
460456
.with_stderr_does_not_contain("[..]try enabling `git-fetch-with-cli`[..]")

0 commit comments

Comments
 (0)