From 72fa08f6cfc87d978142826366713b56c14880b9 Mon Sep 17 00:00:00 2001 From: plebhash Date: Tue, 10 Dec 2024 13:25:48 +0700 Subject: [PATCH] use Sniffer::wait_for_message_count on tproxy test.. WARNING: this commit is just to illustrate how to unblock #1262 DO NOT CHERRY PICK, we still need to fix unnecessary JDC logic --- roles/tests-integration/tests/pool_integration.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/roles/tests-integration/tests/pool_integration.rs b/roles/tests-integration/tests/pool_integration.rs index 09c33d3e18..e4b66791d0 100644 --- a/roles/tests-integration/tests/pool_integration.rs +++ b/roles/tests-integration/tests/pool_integration.rs @@ -1,6 +1,6 @@ mod common; -use std::{convert::TryInto, time::Duration}; +use std::convert::TryInto; use common::{InterceptMessage, MessageDirection}; use const_sv2::MESSAGE_TYPE_SETUP_CONNECTION_ERROR; @@ -8,7 +8,6 @@ use roles_logic_sv2::{ common_messages_sv2::{Protocol, SetupConnection, SetupConnectionError}, parsers::{CommonMessages, Mining, PoolMessages, TemplateDistribution}, }; -use tokio::time::sleep; // This test starts a Template Provider and a Pool, and checks if they exchange the correct // messages upon connection. @@ -118,7 +117,9 @@ async fn translation_proxy() { let jdc_addr = common::start_jdc(pool_jdc_sniffer_addr, tp_addr, jds_addr).await; let mining_proxy_addr = common::start_sv2_translator(jdc_addr).await; let _ = common::start_mining_device_sv1(mining_proxy_addr).await; - sleep(Duration::from_secs(3)).await; + + // todo: fix the unecessary jdc logic + pool_jdc_sniffer.wait_for_message_count(MessageDirection::ToUpstream, 4).await; assert_common_message!( &pool_jdc_sniffer.next_message_from_downstream(),