Skip to content

Commit 9d91f25

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

File tree

1 file changed

+17
-39
lines changed

1 file changed

+17
-39
lines changed

tests/testsuite/git_auth.rs

+17-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,17 @@ 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 [..]"
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+
...
313+
"
336314
)
337315
} else {
338316
format!(
@@ -391,9 +369,9 @@ fn net_err_suggests_fetch_with_cli() {
391369
.with_stderr_data(format!(
392370
"\
393371
[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)
372+
[WARNING] spurious network error (3 tries remaining): [..] resolve [..] needs-proxy.invalid: [..] known[..]
373+
[WARNING] spurious network error (2 tries remaining): [..] resolve [..] needs-proxy.invalid: [..] known[..]
374+
[WARNING] spurious network error (1 tries remaining): [..] resolve [..] needs-proxy.invalid: [..] known[..]
397375
[ERROR] failed to get `foo` as a dependency of package `foo v0.0.0 ([ROOT]/foo)`
398376
399377
Caused by:
@@ -417,9 +395,9 @@ Caused by:
417395
r" An IO error occurred when talking to the server
418396
419397
Caused by:
420-
ssh: Could not resolve hostname needs-proxy.invalid"
398+
ssh: Could not resolve hostname needs-proxy.invalid[..]"
421399
} else {
422-
" failed to resolve address for needs-proxy.invalid: Name or service not known; class=Net (12)"
400+
" failed to resolve address for needs-proxy.invalid: [..] known[..]; class=Net (12)"
423401
}
424402
))
425403
.run();
@@ -436,8 +414,8 @@ Caused by:
436414
.with_status(101)
437415
.with_stderr_data(str![[r#"
438416
[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
417+
[RUNNING] `git fetch --verbose --force --update-head-ok [..]ssh://needs-proxy.invalid/git[..] [..]+HEAD:refs/remotes/origin/HEAD[..]`
418+
ssh: Could not resolve hostname needs-proxy.invalid: [..] not known
441419
fatal: Could not read from remote repository.
442420
443421
Please make sure you have the correct access rights
@@ -454,7 +432,7 @@ Caused by:
454432
failed to fetch into: [ROOT]/home/.cargo/git/db/git-[HASH]
455433
456434
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)
435+
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)
458436
459437
"#]])
460438
.with_stderr_does_not_contain("[..]try enabling `git-fetch-with-cli`[..]")

0 commit comments

Comments
 (0)