use tokio::time::{Duration, timeout};
use crate::app_server::AppServerInbound;
use crate::storage::PRIMARY_RUNTIME_ID;
use super::super::events::handle_app_server_message;
use super::support::{bootstrap_test_state, primary_runtime};
#[tokio::test]
async fn app_server_starting_message_updates_status_without_deadlock() {
let state = bootstrap_test_state().await;
timeout(
Duration::from_secs(2),
handle_app_server_message(
&state,
AppServerInbound::Starting {
runtime_id: PRIMARY_RUNTIME_ID.to_string(),
},
),
)
.await
.expect("处理 Starting 消息超时")
.expect("处理 Starting 消息失败");
let runtime = primary_runtime(&state).await;
let status = runtime.status.read().await.clone();
assert_eq!(status.status, "starting");
assert_eq!(status.app_server_handshake.state, "starting");
}