PM: merge M3.2 deterministic supervision tests
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
51eba0b3cb
1 changed files with 20 additions and 9 deletions
|
|
@ -37,10 +37,13 @@ fn serial() -> MutexGuard<'static, ()> {
|
|||
.unwrap_or_else(std::sync::PoisonError::into_inner)
|
||||
}
|
||||
|
||||
/// Fast restarts, but request and initialize timeouts far beyond any
|
||||
/// restart sequence and beyond [`WAIT`], so under load a test fails on the
|
||||
/// event it waits for and never because a timeout raced the supervisor.
|
||||
fn options() -> ServerOptions {
|
||||
ServerOptions {
|
||||
request_timeout: Duration::from_secs(5),
|
||||
initialize_timeout: Duration::from_secs(5),
|
||||
request_timeout: Duration::from_secs(600),
|
||||
initialize_timeout: Duration::from_secs(600),
|
||||
restart: RestartPolicy {
|
||||
first_delay: Duration::from_millis(20),
|
||||
max_delay: Duration::from_millis(100),
|
||||
|
|
@ -190,7 +193,7 @@ fn typed_requests_and_errors() {
|
|||
.request_with(
|
||||
"fake/echo",
|
||||
json!({"x": 1}),
|
||||
Duration::from_secs(5),
|
||||
Duration::from_secs(600),
|
||||
Box::new(move |result| sender.send(result).unwrap()),
|
||||
)
|
||||
.unwrap();
|
||||
|
|
@ -369,10 +372,16 @@ fn crash_restarts_and_reopens_documents() {
|
|||
assert_eq!(delay, Duration::from_millis(300));
|
||||
server.did_change(&path, &[Edit::insert(3, "!")]).unwrap();
|
||||
wait_ready(&events);
|
||||
assert_eq!(
|
||||
wait_diagnostics(&events, &path),
|
||||
(Some(3), "two!".to_string())
|
||||
);
|
||||
let deadline = Instant::now() + WAIT;
|
||||
loop {
|
||||
let (version, text) = wait_diagnostics(&events, &path);
|
||||
if text == "two!" {
|
||||
assert_eq!(version, Some(3));
|
||||
break;
|
||||
}
|
||||
assert_eq!((version, text.as_str()), (Some(2), "two"));
|
||||
assert!(Instant::now() < deadline, "reopened text never arrived");
|
||||
}
|
||||
let echo = server.request("fake/echo", json!(5)).unwrap().wait();
|
||||
assert_eq!(echo.unwrap(), json!(5));
|
||||
server.shutdown();
|
||||
|
|
@ -398,7 +407,9 @@ fn gives_up_after_too_many_crashes() {
|
|||
let _serial = serial();
|
||||
let root = tempfile::tempdir().unwrap();
|
||||
let (server, events) = spawn(&["--exit-immediately"], root.path());
|
||||
let queued = server.request("fake/echo", Value::Null).unwrap();
|
||||
let queued = server
|
||||
.request_timeout("fake/echo", Value::Null, Duration::from_secs(3600))
|
||||
.unwrap();
|
||||
let (event, seen) = wait_for(&events, |e| {
|
||||
matches!(e, ServerEvent::Status(Status::Failed { .. }))
|
||||
});
|
||||
|
|
@ -432,7 +443,7 @@ fn shutdown_stops_and_fails_pending() {
|
|||
let sleeper = server.request("fake/sleep", Value::Null).unwrap();
|
||||
let started = Instant::now();
|
||||
server.shutdown();
|
||||
assert!(started.elapsed() < Duration::from_secs(4));
|
||||
assert!(started.elapsed() < Duration::from_secs(10));
|
||||
assert_eq!(sleeper.wait(), Err(LspError::Stopped));
|
||||
wait_for(&events, |e| *e == ServerEvent::Status(Status::Stopped));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue