Skip to content

Commit

Permalink
Merge pull request #3072 from jarhodes314/bug/flaky-bridge-unit-tests
Browse files Browse the repository at this point in the history
test: retry connecting to broker in bridge test proxy
  • Loading branch information
jarhodes314 authored Aug 21, 2024
2 parents 162f9a8 + 6a57685 commit e0f1082
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion crates/extensions/tedge_mqtt_bridge/tests/bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,12 @@ impl Proxy {
let mut stop = stop_rx.clone();
stop.mark_unchanged();
if let Ok((mut socket, _)) = listener.accept().await {
let mut conn = tokio::net::TcpStream::connect(&target).await.unwrap();
let mut conn = loop {
let Ok(conn) = tokio::net::TcpStream::connect(&target).await else {
continue;
};
break conn;
};
tokio::spawn(async move {
let (mut read_socket, mut write_socket) = socket.split();
let (mut read_conn, mut write_conn) = conn.split();
Expand Down

0 comments on commit e0f1082

Please sign in to comment.