-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
identities: updated delegation causes replication failure
We have the following steps: * Peer 1 creates a Person document * Peer 2 replicates this Person * Peer 1 updates Person document * Peer 1 creates Project delegating to new Person document * Peer 2 attempts to replicate the Project, but fails with error below Error: ``` Revision 7bb4bbce268d89a62e1962f5dded7a9f68c9e665 of 4b84e8407d602317b01f22207908dbea1d9d4e17 not in ancestry path of eada5419806f643d402c92b790c9b471098f1e81 ``` Signed-off-by: Fintan Halpenny <[email protected]>
- Loading branch information
Showing
3 changed files
with
159 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ | |
|
||
mod collaboration; | ||
mod menage; | ||
mod updated_delegate; | ||
mod working_copy; |
84 changes: 84 additions & 0 deletions
84
test/src/test/integration/librad/scenario/updated_delegate.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
// Copyright © 2019-2020 The Radicle Foundation <[email protected]> | ||
// | ||
// This file is part of radicle-link, distributed under the GPLv3 with Radicle | ||
// Linking Exception. For full terms see the included LICENSE file. | ||
|
||
use std::ops::Index as _; | ||
|
||
use librad::git::storage::ReadOnlyStorage as _; | ||
|
||
use crate::{ | ||
logging, | ||
rad::{ | ||
identities::{TestPerson, TestProject}, | ||
testnet, | ||
}, | ||
}; | ||
|
||
fn config() -> testnet::Config { | ||
testnet::Config { | ||
num_peers: nonzero!(2usize), | ||
min_connected: 2, | ||
bootstrap: testnet::Bootstrap::from_env(), | ||
} | ||
} | ||
|
||
#[test] | ||
fn can_replicate_with_updated_delegate() { | ||
logging::init(); | ||
|
||
let net = testnet::run(config()).unwrap(); | ||
net.enter(async { | ||
let peer1 = net.peers().index(0); | ||
let peer2 = net.peers().index(1); | ||
|
||
let person = { | ||
let person = peer1 | ||
.using_storage(move |storage| TestPerson::create(&storage)) | ||
.await | ||
.unwrap() | ||
.unwrap(); | ||
person.pull(peer1, peer2).await.ok().unwrap(); | ||
person | ||
}; | ||
|
||
let has = peer2 | ||
.using_storage({ | ||
let urn = person.owner.urn(); | ||
move |storage| storage.has_urn(&urn) | ||
}) | ||
.await | ||
.unwrap() | ||
.unwrap(); | ||
assert!(has); | ||
|
||
let person = { | ||
let person = peer1 | ||
.using_storage(move |storage| person.update(&storage)) | ||
.await | ||
.unwrap() | ||
.unwrap(); | ||
person | ||
}; | ||
|
||
let proj = { | ||
let proj = peer1 | ||
.using_storage(move |storage| TestProject::from_test_person(storage, person)) | ||
.await | ||
.unwrap() | ||
.unwrap(); | ||
proj.pull(peer1, peer2).await.unwrap(); | ||
proj | ||
}; | ||
|
||
let has = peer2 | ||
.using_storage({ | ||
let urn = proj.project.urn(); | ||
move |storage| storage.has_urn(&urn) | ||
}) | ||
.await | ||
.unwrap() | ||
.unwrap(); | ||
assert!(has); | ||
}) | ||
} |