MCPcopy Create free account
hub / github.com/dtormoen/tsk-tsk / test_worker_pool_error_handling

Function test_worker_pool_error_handling

src/server/worker_pool.rs:322–349  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

320
321 #[tokio::test]
322 async fn test_worker_pool_error_handling() {
323 let pool = WorkerPool::new(2);
324
325 // Submit a job that will fail
326 let job = TestJob {
327 id: "failing-job".to_string(),
328 duration_ms: 10,
329 should_fail: true,
330 };
331
332 pool.try_submit(job).await.unwrap().unwrap();
333
334 // Wait for job to complete
335 sleep(Duration::from_millis(50)).await;
336
337 // Poll for completed jobs
338 let completed = pool.poll_completed().await;
339 assert_eq!(completed.len(), 1, "Should have 1 completed job");
340
341 assert!(completed[0].is_err());
342 assert!(
343 completed[0]
344 .as_ref()
345 .unwrap_err()
346 .message
347 .contains("failed as requested")
348 );
349 }
350
351 #[tokio::test]
352 async fn test_worker_pool_try_submit() {

Callers

nothing calls this directly

Calls 2

try_submitMethod · 0.80
poll_completedMethod · 0.80

Tested by

no test coverage detected