De-flake admin test

This commit is contained in:
Till Faelligen 2023-03-27 15:46:12 +02:00
parent e1c901e655
commit b70c1f70fd
No known key found for this signature in database
GPG key ID: ACCDC9606D472758

View file

@ -262,6 +262,25 @@ func TestAdminEvacuateRoom(t *testing.T) {
} }
}) })
} }
// Wait for the FS API to have consumed every message
js, _ := natsInstance.Prepare(processCtx, &cfg.Global.JetStream)
timeout := time.After(time.Second)
for {
select {
case <-timeout:
t.Fatalf("FS API didn't process all events in time")
default:
}
info, err := js.ConsumerInfo(cfg.Global.JetStream.Prefixed(jetstream.OutputRoomEvent), cfg.Global.JetStream.Durable("FederationAPIRoomServerConsumer")+"Pull")
if err != nil {
time.Sleep(time.Millisecond * 10)
continue
}
if info.NumPending == 0 && info.NumAckPending == 0 {
break
}
}
}) })
} }