Merge branch 'main' into madlittlemods/soft-limit-account-session-management

This commit is contained in:
Eric Eastwood committed 2026-05-14 14:47:59 -05:00
commit a2ed694f28
2 files changed
+15 -6

No files matched your search

+2 -2
View File
@@ -1269,8 +1269,8 @@ mod tests {
}
"###);
// Reset the state, to reset rate limits
let state = state.reset().await;
// Restart, to reset rate limits
let state = state.restart().await;
// Try to login with a wrong password.
let request = Request::post("/_matrix/client/v3/login").json(serde_json::json!({
+13 -4
View File
@@ -300,12 +300,18 @@ impl TestState {
queue.process_all_jobs_in_tests().await.unwrap();
}
/// Reset the test utils to a fresh state, with the same configuration.
pub async fn reset(self) -> Self {
/// Restart the app with the same configuration.
///
/// To change the config, mutate `TestState.site_config` before calling this
/// function.
pub async fn restart(self) -> Self {
let site_config = self.site_config.clone();
let pool = self.repository_factory.pool();
let task_tracker = self.task_tracker.clone();
// Retain the homeserver connection so we keep the in-memory state
let homeserver_connection = self.homeserver_connection.clone();
// This should trigger the cancellation drop guard
drop(self);
@@ -313,9 +319,12 @@ impl TestState {
task_tracker.close();
task_tracker.wait().await;
Self::from_pool_with_site_config(pool, site_config)
let mut state = Self::from_pool_with_site_config(pool, site_config)
.await
.unwrap()
.unwrap();
// Restore the homeserver connection so we keep the in-memory state
state.homeserver_connection = homeserver_connection;
state
}
pub async fn request<B>(&self, request: Request<B>) -> Response<String>