Count only the refusals that come after the host's update in the features test
The last wait of the test asked for file lists until one was refused locally and took the first refusal on the bus. The asks made before the HostUpdate reached SessionLink are refused too while the server's list stands, and their events can still be unread on the bus, so the wait could end before the update had been applied. It accepts a refusal of a request made after the update only. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2bee828022
commit
5df011f08c
1 file changed
+7
-2
@@ -2236,16 +2236,21 @@ async fn the_features_of_a_server_are_the_hosts_narrowed_by_the_servers_list() {
|
||||
})
|
||||
.await;
|
||||
|
||||
// The host narrows what it offers this user.
|
||||
// The host narrows what it offers this user. A refusal counts only for a
|
||||
// request made after the update: the earlier ones were answered by the host's
|
||||
// wider set (or, before the server lifted its list, refused for that).
|
||||
let update = v1::HostUpdate { features: vec!["voice".into(), "chat".into()], limits: None };
|
||||
handle.push(v1::Push { body: Some(v1::push::Body::HostUpdate(update)) }).unwrap();
|
||||
let after = request;
|
||||
within("the narrower set to apply", async {
|
||||
loop {
|
||||
request += 1;
|
||||
ask(request);
|
||||
tokio::time::sleep(Duration::from_millis(20)).await;
|
||||
while let Ok(event) = bus.try_recv() {
|
||||
if refused(&event) {
|
||||
if matches!(&event, Event::FileList { request, .. } if *request > after)
|
||||
&& refused(&event)
|
||||
{
|
||||
return Some(());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user