2019-11-25 02:42:45 +00:00
|
|
|
//! Tests for network configuration.
|
|
|
|
|
2019-09-12 17:14:29 +00:00
|
|
|
use cargo_test_support::project;
|
2016-05-12 01:34:15 +00:00
|
|
|
|
2019-06-05 18:52:53 +00:00
|
|
|
#[cargo_test]
|
2016-05-25 20:55:42 +00:00
|
|
|
fn net_retry_loads_from_config() {
|
2018-07-20 11:47:47 +00:00
|
|
|
let p = project()
|
2018-03-14 15:17:44 +00:00
|
|
|
.file(
|
|
|
|
"Cargo.toml",
|
|
|
|
r#"
|
2022-09-22 19:50:54 +00:00
|
|
|
[package]
|
2020-09-27 00:59:58 +00:00
|
|
|
name = "foo"
|
|
|
|
version = "0.0.1"
|
|
|
|
authors = []
|
2016-05-12 01:34:15 +00:00
|
|
|
|
2020-09-27 00:59:58 +00:00
|
|
|
[dependencies.bar]
|
|
|
|
git = "http://127.0.0.1:11/foo/bar"
|
|
|
|
"#,
|
2018-12-08 11:19:47 +00:00
|
|
|
)
|
|
|
|
.file("src/main.rs", "")
|
2018-03-14 15:17:44 +00:00
|
|
|
.file(
|
|
|
|
".cargo/config",
|
|
|
|
r#"
|
2020-09-27 00:59:58 +00:00
|
|
|
[net]
|
|
|
|
retry=1
|
|
|
|
[http]
|
|
|
|
timeout=1
|
|
|
|
"#,
|
2018-12-08 11:19:47 +00:00
|
|
|
)
|
|
|
|
.build();
|
2016-05-12 01:34:15 +00:00
|
|
|
|
2023-02-16 00:11:55 +00:00
|
|
|
p.cargo("check -v")
|
2018-08-28 09:20:03 +00:00
|
|
|
.with_status(101)
|
|
|
|
.with_stderr_contains(
|
2018-03-14 15:17:44 +00:00
|
|
|
"[WARNING] spurious network error \
|
|
|
|
(1 tries remaining): [..]",
|
2018-12-08 11:19:47 +00:00
|
|
|
)
|
|
|
|
.run();
|
2016-05-25 20:55:42 +00:00
|
|
|
}
|
2016-05-12 01:34:15 +00:00
|
|
|
|
2019-06-05 18:52:53 +00:00
|
|
|
#[cargo_test]
|
2016-05-25 20:55:42 +00:00
|
|
|
fn net_retry_git_outputs_warning() {
|
2018-07-20 11:47:47 +00:00
|
|
|
let p = project()
|
2018-03-14 15:17:44 +00:00
|
|
|
.file(
|
|
|
|
"Cargo.toml",
|
|
|
|
r#"
|
2022-09-22 19:50:54 +00:00
|
|
|
[package]
|
2020-09-27 00:59:58 +00:00
|
|
|
name = "foo"
|
|
|
|
version = "0.0.1"
|
|
|
|
authors = []
|
2016-05-12 01:34:15 +00:00
|
|
|
|
2020-09-27 00:59:58 +00:00
|
|
|
[dependencies.bar]
|
|
|
|
git = "http://127.0.0.1:11/foo/bar"
|
|
|
|
"#,
|
2018-12-08 11:19:47 +00:00
|
|
|
)
|
|
|
|
.file(
|
2018-03-14 15:17:44 +00:00
|
|
|
".cargo/config",
|
|
|
|
r#"
|
2020-09-27 00:59:58 +00:00
|
|
|
[http]
|
|
|
|
timeout=1
|
|
|
|
"#,
|
2018-12-08 11:19:47 +00:00
|
|
|
)
|
|
|
|
.file("src/main.rs", "")
|
2017-07-22 03:12:21 +00:00
|
|
|
.build();
|
2016-05-12 01:34:15 +00:00
|
|
|
|
2023-02-16 00:11:55 +00:00
|
|
|
p.cargo("check -v -j 1")
|
2018-08-28 09:20:03 +00:00
|
|
|
.with_status(101)
|
|
|
|
.with_stderr_contains(
|
|
|
|
"[WARNING] spurious network error \
|
|
|
|
(2 tries remaining): [..]",
|
2018-12-08 11:19:47 +00:00
|
|
|
)
|
|
|
|
.with_stderr_contains("[WARNING] spurious network error (1 tries remaining): [..]")
|
2018-08-28 09:20:03 +00:00
|
|
|
.run();
|
2016-05-25 20:55:42 +00:00
|
|
|
}
|