mirror of
https://github.com/hinto-janai/cuprate.git
synced 2025-01-10 04:44:50 +00:00
fix tests
This commit is contained in:
parent
0fe82b1c76
commit
719f4cd64d
9 changed files with 25 additions and 9 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -776,6 +776,7 @@ version = "0.1.0"
|
|||
dependencies = [
|
||||
"async-trait",
|
||||
"borsh",
|
||||
"cfg-if",
|
||||
"cuprate-helper",
|
||||
"cuprate-pruning",
|
||||
"cuprate-test-utils",
|
||||
|
|
|
@ -210,7 +210,6 @@ unseparated_literal_suffix = "deny"
|
|||
unnecessary_safety_doc = "deny"
|
||||
unnecessary_safety_comment = "deny"
|
||||
unnecessary_self_imports = "deny"
|
||||
tests_outside_test_module = "deny"
|
||||
string_to_string = "deny"
|
||||
rest_pat_in_fully_bound_structs = "deny"
|
||||
redundant_type_annotations = "deny"
|
||||
|
|
|
@ -21,6 +21,7 @@ futures = { workspace = true, features = ["std"] }
|
|||
async-trait = { workspace = true }
|
||||
tower = { workspace = true, features = ["util", "tracing"] }
|
||||
|
||||
cfg-if = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
tracing = { workspace = true, features = ["std", "attributes"] }
|
||||
hex-literal = { workspace = true }
|
||||
|
|
|
@ -231,7 +231,7 @@ pub async fn ping<N: NetworkZone>(addr: N::Addr) -> Result<u64, HandshakeError>
|
|||
}
|
||||
|
||||
/// This function completes a handshake with the requested peer.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[expect(clippy::too_many_arguments)]
|
||||
async fn handshake<Z: NetworkZone, AdrBook, CSync, PSync, ProtoHdlr, BrdcstStrmMkr, BrdcstStrm>(
|
||||
req: DoHandshakeRequest<Z>,
|
||||
|
||||
|
|
|
@ -56,6 +56,15 @@
|
|||
//! .unwrap();
|
||||
//! # });
|
||||
//! ```
|
||||
|
||||
cfg_if::cfg_if! {
|
||||
// Used in `tests/`
|
||||
if #[cfg(test)] {
|
||||
use cuprate_test_utils as _;
|
||||
use hex as _;
|
||||
}
|
||||
}
|
||||
|
||||
use std::{fmt::Debug, future::Future, hash::Hash};
|
||||
|
||||
use futures::{Sink, Stream};
|
||||
|
@ -65,9 +74,6 @@ use cuprate_wire::{
|
|||
NetworkAddress,
|
||||
};
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
pub mod client;
|
||||
mod constants;
|
||||
pub mod error;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
//! This file contains a test for a handshake with monerod but uses fragmented messages.
|
||||
|
||||
#![expect(unused_crate_dependencies, reason = "external test module")]
|
||||
|
||||
use std::{
|
||||
net::SocketAddr,
|
||||
pin::Pin,
|
||||
|
@ -29,7 +31,7 @@ use cuprate_wire::{
|
|||
BasicNodeData, Message, MoneroWireCodec,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
use cuprate_p2p_core::{
|
||||
client::{
|
||||
handshaker::HandshakerBuilder, ConnectRequest, Connector, DoHandshakeRequest,
|
||||
InternalPeerID,
|
|
@ -1,8 +1,10 @@
|
|||
#![expect(unused_crate_dependencies, reason = "external test module")]
|
||||
|
||||
use std::{sync::Arc, time::Duration};
|
||||
|
||||
use tokio::sync::Semaphore;
|
||||
|
||||
use crate::handles::HandleBuilder;
|
||||
use cuprate_p2p_core::handles::HandleBuilder;
|
||||
|
||||
#[test]
|
||||
fn send_ban_signal() {
|
|
@ -1,3 +1,5 @@
|
|||
#![expect(unused_crate_dependencies, reason = "external test module")]
|
||||
|
||||
use std::time::Duration;
|
||||
|
||||
use futures::StreamExt;
|
||||
|
@ -15,7 +17,7 @@ use cuprate_test_utils::{
|
|||
};
|
||||
use cuprate_wire::{common::PeerSupportFlags, BasicNodeData, MoneroWireCodec};
|
||||
|
||||
use crate::{
|
||||
use cuprate_p2p_core::{
|
||||
client::{
|
||||
handshaker::HandshakerBuilder, ConnectRequest, Connector, DoHandshakeRequest,
|
||||
InternalPeerID,
|
||||
|
@ -24,6 +26,7 @@ use crate::{
|
|||
};
|
||||
|
||||
#[tokio::test]
|
||||
#[expect(clippy::significant_drop_tightening)]
|
||||
async fn handshake_cuprate_to_cuprate() {
|
||||
// Tests a Cuprate <-> Cuprate handshake by making 2 handshake services and making them talk to
|
||||
// each other.
|
|
@ -1,10 +1,12 @@
|
|||
#![expect(unused_crate_dependencies, reason = "external test module")]
|
||||
|
||||
use tower::{Service, ServiceExt};
|
||||
|
||||
use cuprate_helper::network::Network;
|
||||
use cuprate_test_utils::monerod::monerod;
|
||||
use cuprate_wire::{common::PeerSupportFlags, protocol::GetObjectsRequest, BasicNodeData};
|
||||
|
||||
use crate::{
|
||||
use cuprate_p2p_core::{
|
||||
client::{handshaker::HandshakerBuilder, ConnectRequest, Connector},
|
||||
protocol::{PeerRequest, PeerResponse},
|
||||
ClearNet, ProtocolRequest, ProtocolResponse,
|
Loading…
Reference in a new issue