From 1c9528e38f149215df0ad12711ce7193ee8f8c88 Mon Sep 17 00:00:00 2001 From: Youngjoon Lee Date: Mon, 6 Nov 2023 08:47:15 +0900 Subject: [PATCH] Fix occasional port conflict in CLI integration test (#504) --- tests/src/tests/cli.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/src/tests/cli.rs b/tests/src/tests/cli.rs index e5f2a126..98fc5218 100644 --- a/tests/src/tests/cli.rs +++ b/tests/src/tests/cli.rs @@ -4,7 +4,7 @@ use nomos_cli::{ }; use std::time::Duration; use tempfile::NamedTempFile; -use tests::{nodes::nomos::Pool, MixNode, Node, NomosNode, SpawnConfig}; +use tests::{get_available_port, nodes::nomos::Pool, MixNode, Node, NomosNode, SpawnConfig}; const TIMEOUT_SECS: u64 = 20; @@ -16,7 +16,10 @@ async fn disseminate_blob() { // kill the node so that we can reuse its network config nodes[1].stop(); - let network_config = nodes[1].config().network.clone(); + let mut network_config = nodes[1].config().network.clone(); + // use a new port because the old port is sometimes not closed immediately + network_config.backend.inner.port = get_available_port(); + let mut file = NamedTempFile::new().unwrap(); let config_path = file.path().to_owned(); serde_yaml::to_writer(&mut file, &network_config).unwrap();