Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
node: Test fetch comes from right place
Alexis Sellier committed 3 years ago
commit a47463a664afacdc8ee5df2d32842d4ce0bc8ec7
parent 825bd3f5e1e4856b914d4446c05151ddf3904e78
3 files changed +23 -15
modified Cargo.lock
@@ -593,7 +593,7 @@ dependencies = [
[[package]]
name = "nakamoto-net"
version = "0.3.0"
-
source = "git+https://github.com/cloudhead/nakamoto?branch=master#90cc3eac67aa5cfd5f42cf7cb1e2b155af3214fb"
+
source = "git+https://github.com/cloudhead/nakamoto?rev=90cc3eac67aa5cfd5f42cf7cb1e2b155af3214fb#90cc3eac67aa5cfd5f42cf7cb1e2b155af3214fb"
dependencies = [
 "crossbeam-channel",
 "fastrand",
@@ -604,7 +604,7 @@ dependencies = [
[[package]]
name = "nakamoto-net-poll"
version = "0.3.0"
-
source = "git+https://github.com/cloudhead/nakamoto?branch=master#90cc3eac67aa5cfd5f42cf7cb1e2b155af3214fb"
+
source = "git+https://github.com/cloudhead/nakamoto?rev=90cc3eac67aa5cfd5f42cf7cb1e2b155af3214fb#90cc3eac67aa5cfd5f42cf7cb1e2b155af3214fb"
dependencies = [
 "crossbeam-channel",
 "libc",
@@ -643,6 +643,17 @@ dependencies = [
]

[[package]]
+
name = "olpc-cjson"
+
version = "0.1.1"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "72ca49fe685014bbf124ee547da94ed7bb65a6eb9dc9c4711773c081af96a39c"
+
dependencies = [
+
 "serde",
+
 "serde_json",
+
 "unicode-normalization",
+
]
+

+
[[package]]
name = "once_cell"
version = "1.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -782,6 +793,7 @@ version = "0.2.0"
dependencies = [
 "anyhow",
 "bs58",
+
 "byteorder",
 "chrono",
 "colored",
 "crossbeam-channel",
@@ -795,6 +807,7 @@ dependencies = [
 "nakamoto-net",
 "nakamoto-net-poll",
 "nonempty",
+
 "olpc-cjson",
 "once_cell",
 "quickcheck",
 "quickcheck_macros",
@@ -805,7 +818,6 @@ dependencies = [
 "siphasher",
 "tempfile",
 "thiserror",
-
 "toml",
]

[[package]]
@@ -1030,15 +1042,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"

[[package]]
-
name = "toml"
-
version = "0.5.9"
-
source = "registry+https://github.com/rust-lang/crates.io-index"
-
checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7"
-
dependencies = [
-
 "serde",
-
]
-

-
[[package]]
name = "typenum"
version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
modified Cargo.toml
@@ -11,10 +11,10 @@ tag = "cycle/2022-07-12"

[patch.crates-io.nakamoto-net]
git = "https://github.com/cloudhead/nakamoto"
-
branch = "master"
+
rev = "90cc3eac67aa5cfd5f42cf7cb1e2b155af3214fb"
version = "0.3.0"

[patch.crates-io.nakamoto-net-poll]
git = "https://github.com/cloudhead/nakamoto"
-
branch = "master"
+
rev = "90cc3eac67aa5cfd5f42cf7cb1e2b155af3214fb"
version = "0.3.0"
modified node/src/test/tests.rs
@@ -435,11 +435,16 @@ fn test_push_and_pull() {
    // Alice announces her refs.
    // We now expect Eve to fetch Alice's project from Alice.
    // Then we expect Bob to fetch Alice's project from Eve.
-
    // TODO: Check that Bob is fetching from Eve and not Alice, via an event.
    alice.command(protocol::Command::AnnounceRefsUpdate(proj_id.clone()));
    sim.run_while([&mut alice, &mut bob, &mut eve], |s| !s.is_settled());
    assert!(eve.storage().get(&proj_id).unwrap().is_some());
    assert!(bob.storage().get(&proj_id).unwrap().is_some());
+
    assert_matches!(
+
        sim.events(&bob.ip).next(),
+
        Some(protocol::Event::RefsFetched { from, .. })
+
        if from == eve.git_url(),
+
        "Bob fetched from Eve"
+
    );
}

#[test]