Get around circular-dependency
This was causing an issue in rust-analyzer, and probably would fail in other ways via cargo. In any case it wasn't a good idea. Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
This commit is contained in:
parent
e258c72eca
commit
308112618f
|
|
@ -1687,7 +1687,6 @@ dependencies = [
|
|||
"radicle-cob",
|
||||
"radicle-crypto",
|
||||
"radicle-git-ext",
|
||||
"radicle-node",
|
||||
"radicle-ssh",
|
||||
"serde",
|
||||
"serde_json",
|
||||
|
|
|
|||
|
|
@ -213,6 +213,8 @@ mod tests {
|
|||
|
||||
use super::*;
|
||||
use crate::identity::Id;
|
||||
use crate::node::Handle;
|
||||
use crate::node::Node;
|
||||
use crate::test;
|
||||
|
||||
#[test]
|
||||
|
|
@ -247,4 +249,29 @@ mod tests {
|
|||
assert!(handle.updates.lock().unwrap().contains(proj));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_track_untrack() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
let socket = tmp.path().join("node.sock");
|
||||
let proj = test::arbitrary::gen::<Id>(1);
|
||||
|
||||
thread::spawn({
|
||||
let socket = socket.clone();
|
||||
let handle = crate::test::handle::Handle::default();
|
||||
|
||||
move || crate::control::listen(socket, handle)
|
||||
});
|
||||
|
||||
let handle = loop {
|
||||
if let Ok(conn) = Node::connect(&socket) {
|
||||
break conn;
|
||||
}
|
||||
};
|
||||
|
||||
assert!(handle.track(&proj).unwrap());
|
||||
assert!(!handle.track(&proj).unwrap());
|
||||
assert!(handle.untrack(&proj).unwrap());
|
||||
assert!(!handle.untrack(&proj).unwrap());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ edition = "2021"
|
|||
|
||||
[features]
|
||||
default = []
|
||||
test = ["quickcheck", "radicle-crypto/test", "radicle-node/test"]
|
||||
test = ["quickcheck", "radicle-crypto/test"]
|
||||
sql = ["sqlite"]
|
||||
|
||||
[dependencies]
|
||||
|
|
@ -67,8 +67,3 @@ quickcheck = { version = "1", default-features = false }
|
|||
path = "../radicle-crypto"
|
||||
version = "0"
|
||||
features = ["test"]
|
||||
|
||||
[dev-dependencies.radicle-node]
|
||||
path = "../radicle-node"
|
||||
version = "0"
|
||||
features = ["test"]
|
||||
|
|
|
|||
|
|
@ -131,38 +131,3 @@ impl Handle for Node {
|
|||
pub fn connect<P: AsRef<Path>>(path: P) -> Result<Node, Error> {
|
||||
Node::connect(path)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::thread;
|
||||
|
||||
use super::*;
|
||||
use crate::test;
|
||||
|
||||
#[test]
|
||||
fn test_track_untrack() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
let socket = tmp.path().join("node.sock");
|
||||
let proj = test::arbitrary::gen::<Id>(1);
|
||||
|
||||
thread::spawn({
|
||||
use radicle_node as node;
|
||||
|
||||
let socket = socket.clone();
|
||||
let handle = node::test::handle::Handle::default();
|
||||
|
||||
move || node::control::listen(socket, handle)
|
||||
});
|
||||
|
||||
let handle = loop {
|
||||
if let Ok(conn) = Node::connect(&socket) {
|
||||
break conn;
|
||||
}
|
||||
};
|
||||
|
||||
assert!(handle.track(&proj).unwrap());
|
||||
assert!(!handle.track(&proj).unwrap());
|
||||
assert!(handle.untrack(&proj).unwrap());
|
||||
assert!(!handle.untrack(&proj).unwrap());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue