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

Function test_retry_task_queued_error

src/task_manager.rs:541–574  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

539
540 #[tokio::test]
541 async fn test_retry_task_queued_error() {
542 // Set up test environment
543 let (config, test_repo, ctx) = setup_test_environment().await.unwrap();
544 let repo_root = test_repo.path().to_path_buf();
545
546 // Create a queued task (should not be retryable)
547 let task_id = "efgh5678".to_string();
548 let task_dir = config.task_dir(&task_id);
549
550 // Add queued task via storage API
551 let task = Task {
552 id: task_id.clone(),
553 repo_root,
554 name: "queued-task".to_string(),
555 branch_name: format!("tsk/{task_id}"),
556 copied_repo_path: Some(task_dir.join("repo")),
557 ..Task::test_default()
558 };
559 let storage = ctx.task_storage();
560 storage.add_task(task).await.unwrap();
561
562 // Create TaskManager and try to retry a queued task
563 let task_manager = TaskManager::new(&ctx).unwrap();
564
565 let result = task_manager
566 .retry_task(&task_id, false, RetryOverrides::default(), &ctx)
567 .await;
568 assert!(result.is_err());
569 assert!(
570 result
571 .unwrap_err()
572 .contains("Cannot retry a task that hasn't been executed yet")
573 );
574 }
575
576 #[tokio::test]
577 async fn test_clean_tasks_with_id_matching() {

Callers

nothing calls this directly

Calls 6

setup_test_environmentFunction · 0.85
pathMethod · 0.80
task_dirMethod · 0.80
task_storageMethod · 0.80
add_taskMethod · 0.80
retry_taskMethod · 0.80

Tested by

no test coverage detected