Skip to content

Commit 77f3ede

Browse files
committed
Fix: improve test code to wait for server start.
1 parent ca3c8e2 commit 77f3ede

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

server/src/ide/vscode/tests.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,16 +199,20 @@ async fn _prep_test(
199199
// Ensure the webserver is running.
200200
let _ = &*WEBSERVER_HANDLE;
201201
let now = SystemTime::now();
202-
while now.elapsed().unwrap().as_millis() < 100 {
202+
let mut started = false;
203+
while now.elapsed().unwrap().as_millis() < 500 {
203204
if minreq::get(format!("http://127.0.0.1:{IP_PORT}/ping",))
204205
.send()
205206
.is_ok_and(|response| response.as_bytes() == b"pong")
206207
{
208+
started = true;
207209
break;
208210
}
209211
sleep(Duration::from_millis(10)).await;
210212
}
211213

214+
assert!(started, "Webserver failed to start.");
215+
212216
// Connect to the VSCode IDE websocket.
213217
let ws_ide = connect_async_ide(connection_id).await;
214218
let ws_client = connect_async_client(connection_id).await;

0 commit comments

Comments
 (0)