File: net_config.rs

package info (click to toggle)
cargo 0.47.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 47,072 kB
  • sloc: python: 2,029; javascript: 848; sh: 822; ansic: 111; ruby: 89; makefile: 70
file content (74 lines) | stat: -rw-r--r-- 1,610 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//! Tests for network configuration.

use cargo_test_support::project;

#[allow(dead_code)]
fn net_retry_loads_from_config() {
    let p = project()
        .file(
            "Cargo.toml",
            r#"
            [project]
            name = "foo"
            version = "0.0.1"
            authors = []

            [dependencies.bar]
            git = "http://127.0.0.1:11/foo/bar"
        "#,
        )
        .file("src/main.rs", "")
        .file(
            ".cargo/config",
            r#"
        [net]
        retry=1
        [http]
        timeout=1
         "#,
        )
        .build();

    p.cargo("build -v")
        .with_status(101)
        .with_stderr_contains(
            "[WARNING] spurious network error \
             (1 tries remaining): [..]",
        )
        .run();
}

#[allow(dead_code)]
fn net_retry_git_outputs_warning() {
    let p = project()
        .file(
            "Cargo.toml",
            r#"
            [project]
            name = "foo"
            version = "0.0.1"
            authors = []

            [dependencies.bar]
            git = "http://127.0.0.1:11/foo/bar"
        "#,
        )
        .file(
            ".cargo/config",
            r#"
        [http]
        timeout=1
         "#,
        )
        .file("src/main.rs", "")
        .build();

    p.cargo("build -v -j 1")
        .with_status(101)
        .with_stderr_contains(
            "[WARNING] spurious network error \
             (2 tries remaining): [..]",
        )
        .with_stderr_contains("[WARNING] spurious network error (1 tries remaining): [..]")
        .run();
}