Skip to content

Commit 2ff5b83

Browse files
committed
test: Migrate git_auth to snapbox - compat fix
1 parent 792e301 commit 2ff5b83

File tree

1 file changed

+30
-31
lines changed

1 file changed

+30
-31
lines changed

tests/testsuite/git_auth.rs

+30-31
Original file line numberDiff line numberDiff line change
@@ -241,16 +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-
r"\
247-
failed to send request: A connection with the server could not be established
248-
; class=Os (2)"
246+
" failed to send request: A connection with the server could not be established\n ; class=Os (2)"
249247
} else if cfg!(target_os = "macos") {
250248
// macOS is difficult to tests as some builds may use Security.framework,
251249
// while others may use OpenSSL. In that case, let's just not verify the error
252250
// message here.
253-
"[..]"
251+
"..."
254252
} else {
255253
r" SSL [ERROR] syscall failure: ; class=Os (2)"
256254
}
@@ -302,39 +300,40 @@ fn ssh_something_happens() {
302300
// "[..]banner exchange: Connection to 127.0.0.1 [..]"
303301
// banner exchange: Connection to 127.0.0.1 port 62250: Software caused connection abort
304302
// But since there is no common meaningful sequence or word, we can only match a small telling sequence of characters.
305-
"onnect".to_string()
306-
} else {
307303
format!(
308-
r"
309-
Caused by:
310-
failed to clone into: [ROOT]/home/.cargo/git/db/bar-[HASH]
311-
312-
Caused by:
313-
network failure seems to have happened
314-
if a proxy or similar is necessary `net.git-fetch-with-cli` may help here
315-
https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli
316-
317-
Caused by:
318-
An IO error occurred when talking to the server
319-
320-
Caused by:
321-
Connection closed by {} port {}
322-
",
304+
" banner exchange: Connection to {} port {}: Software caused connection abort",
323305
addr.ip(),
324306
addr.port()
325307
)
308+
} else {
309+
"[..]Connection closed by [..]".to_string()
326310
};
327311
format!(
328312
"\
329313
[UPDATING] git repository `ssh://{addr}/foo/bar`
314+
...
330315
[ERROR] failed to get `bar` as a dependency of package `foo v0.0.1 ([ROOT]/foo)`
331316
332317
Caused by:
333318
failed to load source for dependency `bar`
334319
335320
Caused by:
336321
Unable to update ssh://{addr}/foo/bar
337-
{message}"
322+
323+
Caused by:
324+
failed to clone into: [ROOT]/home/.cargo/git/db/bar-[HASH]
325+
326+
Caused by:
327+
network failure seems to have happened
328+
if a proxy or similar is necessary `net.git-fetch-with-cli` may help here
329+
https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli
330+
331+
Caused by:
332+
An IO error occurred when talking to the server
333+
334+
Caused by:
335+
{message}
336+
"
338337
)
339338
} else {
340339
format!(
@@ -393,9 +392,9 @@ fn net_err_suggests_fetch_with_cli() {
393392
.with_stderr_data(format!(
394393
"\
395394
[UPDATING] git repository `ssh://needs-proxy.invalid/git`
396-
[WARNING] spurious network error (3 tries remaining): failed to resolve address for needs-proxy.invalid: Name or service not known; class=Net (12)
397-
[WARNING] spurious network error (2 tries remaining): failed to resolve address for needs-proxy.invalid: Name or service not known; class=Net (12)
398-
[WARNING] spurious network error (1 tries remaining): failed to resolve address for needs-proxy.invalid: Name or service not known; class=Net (12)
395+
[WARNING] spurious network error (3 tries remaining): [..] resolve [..] needs-proxy.invalid: [..] known[..]
396+
[WARNING] spurious network error (2 tries remaining): [..] resolve [..] needs-proxy.invalid: [..] known[..]
397+
[WARNING] spurious network error (1 tries remaining): [..] resolve [..] needs-proxy.invalid: [..] known[..]
399398
[ERROR] failed to get `foo` as a dependency of package `foo v0.0.0 ([ROOT]/foo)`
400399
401400
Caused by:
@@ -419,9 +418,9 @@ Caused by:
419418
r" An IO error occurred when talking to the server
420419
421420
Caused by:
422-
ssh: Could not resolve hostname needs-proxy.invalid"
421+
ssh: Could not resolve hostname needs-proxy.invalid[..]"
423422
} else {
424-
" failed to resolve address for needs-proxy.invalid: Name or service not known; class=Net (12)"
423+
" failed to resolve address for needs-proxy.invalid: [..] known[..]; class=Net (12)"
425424
}
426425
))
427426
.run();
@@ -438,8 +437,8 @@ Caused by:
438437
.with_status(101)
439438
.with_stderr_data(str![[r#"
440439
[UPDATING] git repository `ssh://needs-proxy.invalid/git`
441-
[RUNNING] `git fetch --verbose --force --update-head-ok 'ssh://needs-proxy.invalid/git' '+HEAD:refs/remotes/origin/HEAD'`
442-
ssh: Could not resolve hostname needs-proxy.invalid: Name or service not known
440+
[RUNNING] `git fetch --verbose --force --update-head-ok [..]ssh://needs-proxy.invalid/git[..] [..]+HEAD:refs/remotes/origin/HEAD[..]`
441+
ssh: Could not resolve hostname needs-proxy.invalid: [..] not known
443442
fatal: Could not read from remote repository.
444443
445444
Please make sure you have the correct access rights
@@ -456,7 +455,7 @@ Caused by:
456455
failed to fetch into: [ROOT]/home/.cargo/git/db/git-[HASH]
457456
458457
Caused by:
459-
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)
458+
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)
460459
461460
"#]])
462461
.with_stderr_does_not_contain("[..]try enabling `git-fetch-with-cli`[..]")

0 commit comments

Comments
 (0)