fix: harden OpenSim session readiness
This commit is contained in:
@@ -196,6 +196,7 @@ fn test_policy() -> ReconnectPolicy {
|
||||
ReconnectPolicy {
|
||||
initial_delay: Duration::from_secs(1),
|
||||
maximum_delay: Duration::from_secs(8),
|
||||
readiness_timeout: Duration::from_secs(30),
|
||||
stable_reset_after: Duration::from_secs(10),
|
||||
shutdown_deadline: Duration::from_secs(2),
|
||||
jitter_basis_points: 0,
|
||||
@@ -413,6 +414,38 @@ async fn transport_connection_is_distinct_from_full_agent_readiness() {
|
||||
handle.shutdown().await.expect("shutdown");
|
||||
}
|
||||
|
||||
#[tokio::test(start_paused = true)]
|
||||
async fn readiness_timeout_logs_out_and_retries_instead_of_staying_degraded() {
|
||||
let plans = [
|
||||
LoginPlan::Success {
|
||||
after: Duration::ZERO,
|
||||
signals: VecDeque::new(),
|
||||
},
|
||||
LoginPlan::Success {
|
||||
after: Duration::ZERO,
|
||||
signals: VecDeque::from([(Duration::ZERO, SessionSignal::Ready)]),
|
||||
},
|
||||
];
|
||||
let (backend, stats) = FakeBackend::new(plans);
|
||||
let mut policy = test_policy();
|
||||
policy.readiness_timeout = Duration::from_secs(5);
|
||||
let erased: Arc<dyn GridSessionBackend> = backend;
|
||||
let mut handle = SessionSupervisor::new(erased, policy, 32, 256)
|
||||
.expect("supervisor")
|
||||
.start();
|
||||
|
||||
wait_state(&handle, SessionState::Degraded).await;
|
||||
tokio::time::advance(Duration::from_secs(5)).await;
|
||||
settle().await;
|
||||
wait_state(&handle, SessionState::Backoff).await;
|
||||
assert_eq!(stats.logouts.load(Ordering::Acquire), 1);
|
||||
tokio::time::advance(Duration::from_secs(1)).await;
|
||||
settle().await;
|
||||
wait_state(&handle, SessionState::Online).await;
|
||||
handle.shutdown().await.expect("shutdown");
|
||||
assert_eq!(stats.active_sessions.load(Ordering::Acquire), 0);
|
||||
}
|
||||
|
||||
#[tokio::test(start_paused = true)]
|
||||
async fn shutdown_covers_degraded_authentication_blocked_stopped_and_online_states() {
|
||||
let cases = [
|
||||
|
||||
Reference in New Issue
Block a user