0.3.5-alpha.8.fix.1
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user