()
| 587 | |
| 588 | #[test] |
| 589 | fn test_has_deadlock() { |
| 590 | // Circular dependency: s1 depends on s2, s2 depends on s1 |
| 591 | let mut plan = ExecutionPlan::new("Test", Complexity::Simple); |
| 592 | plan.add_step(Task::new("s1", "Step 1").with_dependencies(vec!["s2".to_string()])); |
| 593 | plan.add_step(Task::new("s2", "Step 2").with_dependencies(vec!["s1".to_string()])); |
| 594 | |
| 595 | assert!(plan.has_deadlock()); |
| 596 | |
| 597 | // No deadlock when steps have no deps |
| 598 | let mut plan2 = ExecutionPlan::new("Test", Complexity::Simple); |
| 599 | plan2.add_step(Task::new("s1", "Step 1")); |
| 600 | assert!(!plan2.has_deadlock()); |
| 601 | |
| 602 | // Deadlock when dependency failed |
| 603 | let mut plan3 = ExecutionPlan::new("Test", Complexity::Simple); |
| 604 | plan3.add_step(Task::new("s1", "Step 1")); |
| 605 | plan3.add_step(Task::new("s2", "Step 2").with_dependencies(vec!["s1".to_string()])); |
| 606 | plan3.mark_status("s1", TaskStatus::Failed); |
| 607 | assert!(plan3.has_deadlock()); // s2 depends on s1 which failed, not completed |
| 608 | } |
| 609 | |
| 610 | #[test] |
| 611 | fn test_get_ready_steps_parallel() { |
nothing calls this directly
no test coverage detected