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)
|
.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 {
|
fn options() -> ServerOptions {
|
||||||
ServerOptions {
|
ServerOptions {
|
||||||
request_timeout: Duration::from_secs(5),
|
request_timeout: Duration::from_secs(600),
|
||||||
initialize_timeout: Duration::from_secs(5),
|
initialize_timeout: Duration::from_secs(600),
|
||||||
restart: RestartPolicy {
|
restart: RestartPolicy {
|
||||||
first_delay: Duration::from_millis(20),
|
first_delay: Duration::from_millis(20),
|
||||||
max_delay: Duration::from_millis(100),
|
max_delay: Duration::from_millis(100),
|
||||||
|
|
@ -190,7 +193,7 @@ fn typed_requests_and_errors() {
|
||||||
.request_with(
|
.request_with(
|
||||||
"fake/echo",
|
"fake/echo",
|
||||||
json!({"x": 1}),
|
json!({"x": 1}),
|
||||||
Duration::from_secs(5),
|
Duration::from_secs(600),
|
||||||
Box::new(move |result| sender.send(result).unwrap()),
|
Box::new(move |result| sender.send(result).unwrap()),
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
@ -369,10 +372,16 @@ fn crash_restarts_and_reopens_documents() {
|
||||||
assert_eq!(delay, Duration::from_millis(300));
|
assert_eq!(delay, Duration::from_millis(300));
|
||||||
server.did_change(&path, &[Edit::insert(3, "!")]).unwrap();
|
server.did_change(&path, &[Edit::insert(3, "!")]).unwrap();
|
||||||
wait_ready(&events);
|
wait_ready(&events);
|
||||||
assert_eq!(
|
let deadline = Instant::now() + WAIT;
|
||||||
wait_diagnostics(&events, &path),
|
loop {
|
||||||
(Some(3), "two!".to_string())
|
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();
|
let echo = server.request("fake/echo", json!(5)).unwrap().wait();
|
||||||
assert_eq!(echo.unwrap(), json!(5));
|
assert_eq!(echo.unwrap(), json!(5));
|
||||||
server.shutdown();
|
server.shutdown();
|
||||||
|
|
@ -398,7 +407,9 @@ fn gives_up_after_too_many_crashes() {
|
||||||
let _serial = serial();
|
let _serial = serial();
|
||||||
let root = tempfile::tempdir().unwrap();
|
let root = tempfile::tempdir().unwrap();
|
||||||
let (server, events) = spawn(&["--exit-immediately"], root.path());
|
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| {
|
let (event, seen) = wait_for(&events, |e| {
|
||||||
matches!(e, ServerEvent::Status(Status::Failed { .. }))
|
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 sleeper = server.request("fake/sleep", Value::Null).unwrap();
|
||||||
let started = Instant::now();
|
let started = Instant::now();
|
||||||
server.shutdown();
|
server.shutdown();
|
||||||
assert!(started.elapsed() < Duration::from_secs(4));
|
assert!(started.elapsed() < Duration::from_secs(10));
|
||||||
assert_eq!(sleeper.wait(), Err(LspError::Stopped));
|
assert_eq!(sleeper.wait(), Err(LspError::Stopped));
|
||||||
wait_for(&events, |e| *e == ServerEvent::Status(Status::Stopped));
|
wait_for(&events, |e| *e == ServerEvent::Status(Status::Stopped));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue