()
| 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() { |
nothing calls this directly
no test coverage detected