Name the replaced session and the refused stream in tests of their own

The tail of a_reconnect_finds_the_state_the_first_session_left (a connect
while connected replaces the session) and the end of
commands_reach_the_host_as_requests (a host without streams is not asked
for one) are tests of their own now, so that each name says what is
checked.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
faumarayandClaude Sonnet 5.5 committed 2026-10-24 05:56:28 +03:00
1 parent dd9140e1ea
commit b92379d01b
1 file changed
+23 -7
+23 -7
View File
@@ -559,8 +559,16 @@ async fn commands_reach_the_host_as_requests() {
let list = request_after(&handle, before, "the file list", list_of(v1::EntityKind::File)).await;
let Some(Op::List(list)) = list.request.op else { unreachable!() };
assert_eq!((list.parent, list.path.as_str()), (GAMES, "/docs/"));
}
// The host has no streams: the engine refuses them before any request.
/// A host that offers no streams is not asked for one: the engine refuses
/// `StartStream` itself, with an error, before any request leaves. (The other
/// local refusal of a missing feature, the file list, is in
/// `a_host_update_changes_what_the_engine_asks_for`.)
#[tokio::test(flavor = "multi_thread")]
async fn a_host_without_streams_is_not_asked_for_one() {
let mut h = Harness::start();
let handle = h.connect().await;
let count = handle.requests().len();
let setup = voelin_core::stream::StreamSetup { name: "screen".into(), ..Default::default() };
h.engine.send(Command::StartStream { session: SESSION, setup, auto_accept: true });
@@ -1329,15 +1337,23 @@ async fn a_reconnect_finds_the_state_the_first_session_left() {
// (That the history has each message once, and that a replayed message
// older than `Dedup`'s 4 s is not shown again, are the business of the
// ignored tests below.)
}
// Connecting while connected replaces the session at once.
/// Asking to connect while connected replaces the session at once: the host
/// sees the old session closed by us, and the engine follows the new one.
#[tokio::test(flavor = "multi_thread")]
async fn connecting_while_connected_replaces_the_session() {
let mut h = Harness::start();
let first = h.connect().await;
h.ask_connect();
let connector = h.connector.clone();
eventually(WAIT, "the third session", || connector.sessions().len() == 3).await;
let third = connector.last_session().expect("a third session");
h.state(|s| s.own_client == Some(third.participant_id() as u16)).await;
eventually(WAIT, "the second session to be closed", || second.close_reason().is_some()).await;
assert_eq!(second.close_reason(), Some(CloseReason::Local(v1::CloseCode::Normal)));
eventually(WAIT, "the second session", || connector.sessions().len() == 2).await;
let second = connector.last_session().expect("a second session");
assert_ne!(second.participant_id(), first.participant_id());
h.state(|s| s.own_client == Some(second.participant_id() as u16)).await;
eventually(WAIT, "the first session to be closed", || first.close_reason().is_some()).await;
assert_eq!(first.close_reason(), Some(CloseReason::Local(v1::CloseCode::Normal)));
assert!(second.close_reason().is_none(), "the new session is open");
}
/// What a host that sends the window of a CHAT scope again makes of a