#!/usr/bin/env bash # Test: argo-train.sh --multi-seed N --folds K --dry-run emits one # WorkflowTask per (seed, fold) pair (N * K total). # # This is the validation surface for the Plan 5 Task 1A multi-seed Argo DAG — # verifies the matrix is generated correctly without submitting to a live # cluster. set -euo pipefail # Resolve repo root from this script's location so the test runs from any cwd. SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" REPO_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)" cd "${REPO_ROOT}" # Dry-run: --multi-seed 3 --folds 2 should emit a workflow with 6 training jobs. output=$(./scripts/argo-train.sh dqn --multi-seed 3 --folds 2 --dry-run 2>&1) actual_count=$(echo "$output" | grep -c "kind: WorkflowTask" || true) expected=6 if [[ "$actual_count" -ne "$expected" ]]; then echo "FAIL: expected $expected jobs (3 seeds x 2 folds), got $actual_count" echo "--- output ---" echo "$output" exit 1 fi echo "PASS: multi-seed harness produces $expected jobs for 3x2 matrix" # Backward-compat: --multi-seed 1 --folds 1 must NOT emit WorkflowTask lines # (single-job path uses the existing template, no DAG matrix). output_single=$(./scripts/argo-train.sh dqn --multi-seed 1 --folds 1 --dry-run 2>&1) single_tasks=$(echo "$output_single" | grep -c "kind: WorkflowTask" || true) if [[ "$single_tasks" -ne 0 ]]; then echo "FAIL: single-job dry-run should not emit multi-seed DAG tasks (got $single_tasks)" exit 1 fi echo "PASS: single-job dry-run preserves existing single-template path"