()
| 132 | |
| 133 | #[test(tokio::test(flavor = "multi_thread", worker_threads = 2))] |
| 134 | async fn test_two_nodes() -> Result<()> { |
| 135 | let mut test_runner_a = TestRunnerBuilder::new().build().await?; |
| 136 | let mut test_runner_b = TestRunnerBuilder::new().build().await?; |
| 137 | let addrs_b = vec![test_runner_b.addr.clone()]; |
| 138 | debug!(?test_runner_a.peer_id, ?test_runner_b.peer_id, "peer ids"); |
| 139 | |
| 140 | let peer_id_a = test_runner_a.client.local_peer_id().await?; |
| 141 | assert_eq!(test_runner_a.peer_id, peer_id_a); |
| 142 | let peer_id_b = test_runner_b.client.local_peer_id().await?; |
| 143 | assert_eq!(test_runner_b.peer_id, peer_id_b); |
| 144 | |
| 145 | // connect |
| 146 | test_runner_a.client.connect(peer_id_b, addrs_b).await?; |
| 147 | |
| 148 | timeout( |
| 149 | Duration::from_millis(500), |
| 150 | wait_bi_connected(&mut test_runner_a, &mut test_runner_b), |
| 151 | ) |
| 152 | .await |
| 153 | .context("waiting for a and b to connect")?; |
| 154 | |
| 155 | assert!(is_bi_connected(&test_runner_a, &test_runner_b).await?); |
| 156 | |
| 157 | Ok(()) |
| 158 | } |
| 159 | |
| 160 | #[test(tokio::test(flavor = "multi_thread", worker_threads = 2))] |
| 161 | async fn test_three_nodes() -> Result<()> { |
nothing calls this directly
no test coverage detected