0.3.5-alpha.8.fix.1

This commit is contained in:
2026-09-22 07:37:57 +02:00
parent 7f139f631e
commit 17d9e18dcd
6 changed files with 189 additions and 41 deletions

View File

@@ -19,34 +19,46 @@ fn fallback_policy_is_narrow_and_excludes_ambiguous_connect_failures() {
#[tokio::test(flavor = "current_thread")]
async fn selector_prefers_webtransport_and_falls_back_only_for_classified_errors() {
let preferred = super::select_preferred_transport(
|| async {
return std::result::Result::<u8, game_realtime_transport_lib::TransportError>::Ok(7);
|| {
return async {
return std::result::Result::<u8, game_realtime_transport_lib::TransportError>::Ok(7);
};
},
|| async {
return std::result::Result::<u8, game_realtime_transport_lib::TransportError>::Err(test_error("fallback must not run"));
|| {
return async {
return std::result::Result::<u8, game_realtime_transport_lib::TransportError>::Err(test_error("fallback must not run"));
};
},
)
.await;
assert!(matches!(preferred, std::result::Result::Ok(super::SelectedConnection::WebTransport(7))), "WebTransport success must remain preferred");
let fallback = super::select_preferred_transport(
|| async {
return std::result::Result::<u8, game_realtime_transport_lib::TransportError>::Err(game_realtime_transport_lib::TransportError::new(
game_realtime_transport_lib::TransportErrorKind::Timeout,
"forced timeout",
));
|| {
return async {
return std::result::Result::<u8, game_realtime_transport_lib::TransportError>::Err(game_realtime_transport_lib::TransportError::new(
game_realtime_transport_lib::TransportErrorKind::Timeout,
"forced timeout",
));
};
},
|| async {
return std::result::Result::<u8, game_realtime_transport_lib::TransportError>::Ok(9);
|| {
return async {
return std::result::Result::<u8, game_realtime_transport_lib::TransportError>::Ok(9);
};
},
)
.await;
assert!(matches!(fallback, std::result::Result::Ok(super::SelectedConnection::WebSocket(9))), "classified timeout must select WebSocket fallback");
let non_fallback = super::select_preferred_transport(
|| async {
return std::result::Result::<u8, game_realtime_transport_lib::TransportError>::Err(test_error("visible primary error"));
|| {
return async {
return std::result::Result::<u8, game_realtime_transport_lib::TransportError>::Err(test_error("visible primary error"));
};
},
|| async {
return std::result::Result::<u8, game_realtime_transport_lib::TransportError>::Ok(11);
|| {
return async {
return std::result::Result::<u8, game_realtime_transport_lib::TransportError>::Ok(11);
};
},
)
.await;