Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/cortex-cli/src/agent_cmd/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
#[cfg(test)]
mod tests {
use crate::agent_cmd::cli::{CopyArgs, ExportArgs};
use crate::agent_cmd::loader::{
load_builtin_agents, parse_frontmatter, read_file_with_encoding,
};
use crate::agent_cmd::loader::{load_builtin_agents, parse_frontmatter};
use crate::agent_cmd::types::AgentMode;
use crate::utils::file::read_file_with_encoding;

#[test]
fn test_read_file_with_utf8() {
Expand Down
12 changes: 10 additions & 2 deletions src/cortex-cli/src/dag_cmd/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ use super::helpers::{
use super::scheduler::DagScheduler;
use super::types::{DagOutputFormat, ExecutionStrategy};

pub(super) fn task_count_label(count: usize) -> String {
if count == 1 {
"1 task".to_string()
} else {
format!("{} tasks", count)
}
}

/// Create a DAG from specification.
pub async fn run_create(args: DagCreateArgs) -> Result<()> {
let spec = load_spec(&args.file)?;
Expand Down Expand Up @@ -362,8 +370,8 @@ pub async fn run_validate(args: DagValidateArgs) -> Result<()> {
match dag.topological_sort() {
Ok(order) => {
print_success(&format!(
"✓ DAG is valid ({} tasks, no cycles detected)",
dag.len()
"✓ DAG is valid ({}, no cycles detected)",
task_count_label(dag.len())
));

if args.verbose {
Expand Down
7 changes: 7 additions & 0 deletions src/cortex-cli/src/dag_cmd/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use super::types::{DagSpecInput, TaskSpecInput};
use cortex_agents::task::{DagHydrator, Task, TaskId, TaskSpec};
use std::collections::HashMap;

use super::commands::task_count_label;
use super::executor::TaskExecutor;

#[test]
Expand Down Expand Up @@ -78,6 +79,12 @@ fn test_dag_creation_with_cycle_detection() {
assert!(result.is_err());
}

#[test]
fn test_dag_validate_task_count_label_uses_singular_for_one_task() {
assert_eq!(task_count_label(1), "1 task");
assert_eq!(task_count_label(2), "2 tasks");
}

#[tokio::test]
async fn test_task_executor() {
let executor = TaskExecutor::new(30, false);
Expand Down