node: Test fetch comes from right place
Signed-off-by: Alexis Sellier <self@cloudhead.io>
This commit is contained in:
parent
825bd3f5e1
commit
a47463a664
|
|
@ -593,7 +593,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nakamoto-net"
|
name = "nakamoto-net"
|
||||||
version = "0.3.0"
|
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 = [
|
dependencies = [
|
||||||
"crossbeam-channel",
|
"crossbeam-channel",
|
||||||
"fastrand",
|
"fastrand",
|
||||||
|
|
@ -604,7 +604,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nakamoto-net-poll"
|
name = "nakamoto-net-poll"
|
||||||
version = "0.3.0"
|
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 = [
|
dependencies = [
|
||||||
"crossbeam-channel",
|
"crossbeam-channel",
|
||||||
"libc",
|
"libc",
|
||||||
|
|
@ -642,6 +642,17 @@ dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[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]]
|
[[package]]
|
||||||
name = "once_cell"
|
name = "once_cell"
|
||||||
version = "1.14.0"
|
version = "1.14.0"
|
||||||
|
|
@ -782,6 +793,7 @@ version = "0.2.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"bs58",
|
"bs58",
|
||||||
|
"byteorder",
|
||||||
"chrono",
|
"chrono",
|
||||||
"colored",
|
"colored",
|
||||||
"crossbeam-channel",
|
"crossbeam-channel",
|
||||||
|
|
@ -795,6 +807,7 @@ dependencies = [
|
||||||
"nakamoto-net",
|
"nakamoto-net",
|
||||||
"nakamoto-net-poll",
|
"nakamoto-net-poll",
|
||||||
"nonempty",
|
"nonempty",
|
||||||
|
"olpc-cjson",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"quickcheck",
|
"quickcheck",
|
||||||
"quickcheck_macros",
|
"quickcheck_macros",
|
||||||
|
|
@ -805,7 +818,6 @@ dependencies = [
|
||||||
"siphasher",
|
"siphasher",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"toml",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -1029,15 +1041,6 @@ version = "0.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
|
checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "toml"
|
|
||||||
version = "0.5.9"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7"
|
|
||||||
dependencies = [
|
|
||||||
"serde",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "typenum"
|
name = "typenum"
|
||||||
version = "1.15.0"
|
version = "1.15.0"
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,10 @@ tag = "cycle/2022-07-12"
|
||||||
|
|
||||||
[patch.crates-io.nakamoto-net]
|
[patch.crates-io.nakamoto-net]
|
||||||
git = "https://github.com/cloudhead/nakamoto"
|
git = "https://github.com/cloudhead/nakamoto"
|
||||||
branch = "master"
|
rev = "90cc3eac67aa5cfd5f42cf7cb1e2b155af3214fb"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
|
|
||||||
[patch.crates-io.nakamoto-net-poll]
|
[patch.crates-io.nakamoto-net-poll]
|
||||||
git = "https://github.com/cloudhead/nakamoto"
|
git = "https://github.com/cloudhead/nakamoto"
|
||||||
branch = "master"
|
rev = "90cc3eac67aa5cfd5f42cf7cb1e2b155af3214fb"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
|
|
|
||||||
|
|
@ -435,11 +435,16 @@ fn test_push_and_pull() {
|
||||||
// Alice announces her refs.
|
// Alice announces her refs.
|
||||||
// We now expect Eve to fetch Alice's project from Alice.
|
// We now expect Eve to fetch Alice's project from Alice.
|
||||||
// Then we expect Bob to fetch Alice's project from Eve.
|
// 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()));
|
alice.command(protocol::Command::AnnounceRefsUpdate(proj_id.clone()));
|
||||||
sim.run_while([&mut alice, &mut bob, &mut eve], |s| !s.is_settled());
|
sim.run_while([&mut alice, &mut bob, &mut eve], |s| !s.is_settled());
|
||||||
assert!(eve.storage().get(&proj_id).unwrap().is_some());
|
assert!(eve.storage().get(&proj_id).unwrap().is_some());
|
||||||
assert!(bob.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]
|
#[test]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue