Skip to content

Commit

Permalink
Add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
ryardley committed Nov 23, 2024
1 parent 878f10a commit 89df735
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 9 additions & 2 deletions packages/ciphernode/p2p/src/bin/p2p_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ use std::{collections::HashSet, env, process};
use tokio::time::{sleep, timeout};
use tracing_subscriber::{prelude::*, EnvFilter};

// So this is a simple test to test our networking configuration
// Here we ensure we can send a gossipsub message to all connected nodes
// Each node is assigned a name alice, bob or charlie and expects to receive the other two
// names via gossipsub or the node will exit with an error code
// We have a docker test harness that runs the nodes and blocks things like mdns ports to ensure
// that basic discovery is working

#[tokio::main]
async fn main() -> Result<()> {
tracing_subscriber::registry()
Expand All @@ -18,7 +25,7 @@ async fn main() -> Result<()> {
.ok()
.and_then(|p| p.parse::<u16>().ok());

let maybe_dial = env::var("DIAL_TO")
let dial_to = env::var("DIAL_TO")
.ok()
.and_then(|p| p.parse::<String>().ok());

Expand All @@ -34,7 +41,7 @@ async fn main() -> Result<()> {
router.with_udp_port(port);
}

let peers: Vec<String> = maybe_dial.iter().cloned().collect();
let peers: Vec<String> = dial_to.iter().cloned().collect();

let router_task = tokio::spawn({
let name = name.clone();
Expand Down
2 changes: 0 additions & 2 deletions packages/ciphernode/p2p/tests/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@ FROM rust:1.81
RUN apt-get update && apt-get install -y iptables
WORKDIR /app
COPY ./p2p/tests/entrypoint.sh entrypoint.sh

COPY . .

RUN cargo build --bin p2p_test

0 comments on commit 89df735

Please sign in to comment.