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

Function test_worker_pool_basic_execution

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

Source from the content-addressed store, hash-verified

203
204 #[tokio::test]
205 async fn test_worker_pool_basic_execution() {
206 let pool = WorkerPool::new(2);
207
208 // Submit a simple job
209 let job = TestJob {
210 id: "test-1".to_string(),
211 duration_ms: 10,
212 should_fail: false,
213 };
214
215 pool.try_submit(job).await.unwrap().unwrap();
216
217 // Wait for the job to complete
218 sleep(Duration::from_millis(50)).await;
219
220 // Poll for completed jobs
221 let completed = pool.poll_completed().await;
222 assert_eq!(completed.len(), 1, "Should have 1 completed job");
223 assert!(completed[0].is_ok());
224 assert!(completed[0].as_ref().unwrap().success);
225 assert_eq!(completed[0].as_ref().unwrap().job_id, "test-1");
226 }
227
228 #[tokio::test]
229 async fn test_worker_pool_concurrent_execution() {

Callers

nothing calls this directly

Calls 2

try_submitMethod · 0.80
poll_completedMethod · 0.80

Tested by

no test coverage detected