@@ -1828,53 +1828,55 @@ test_output_formats() {
18281828
18291829test_deploy_agent_cli () {
18301830 msg " =========================================="
1831- msg " Testing snapshot --deploy- agent CLI"
1831+ msg " Testing snapshot agent CLI flags "
18321832 msg " =========================================="
18331833
1834- # This test verifies the CLI flags work, not the actual deployment
1835- # (actual deployment is tested in test_snapshot)
1834+ # The snapshot command always deploys an agent Job.
1835+ # This test verifies the agent-related CLI flags are present and accepted.
18361836
1837- # Test 1: Help shows deploy-agent flag
1838- msg " --- Test: snapshot --help shows deploy-agent ---"
18391837 local help_output
18401838 help_output=$( " ${AICR_BIN} " snapshot --help 2>&1 )
1841- if echo " $help_output " | grep -q " deploy-agent" ; then
1842- detail " --deploy-agent flag documented"
1843- pass " cli/deploy-agent/help"
1839+
1840+ # Test 1: Help shows agent-related flags
1841+ msg " --- Test: snapshot --help shows agent flags ---"
1842+ local missing_flags=()
1843+ for flag in " --namespace" " --image" " --node-selector" " --toleration" " --timeout" " --cleanup" ; do
1844+ if ! echo " $help_output " | grep -q -- " $flag " ; then
1845+ missing_flags+=(" $flag " )
1846+ fi
1847+ done
1848+
1849+ if [ ${# missing_flags[@]} -eq 0 ]; then
1850+ detail " All agent flags documented"
1851+ pass " cli/agent-flags/help"
18441852 else
1845- fail " cli/deploy- agent/help" " --deploy-agent not in help output "
1853+ fail " cli/agent-flags /help" " Missing flags: ${missing_flags[*]} "
18461854 fi
18471855
1848- # Test 2: deploy-agent with namespace flag
1849- msg " --- Test: deploy-agent requires namespace ---"
1850- # Running without a cluster should fail gracefully
1851- echo -e " ${DIM} \$ aicr snapshot --deploy-agent --namespace test-ns --image test:latest (dry-run check)${NC} "
1856+ # Test 2: Agent flags are accepted (should fail with cluster error, not parse error)
1857+ msg " --- Test: agent flags accepted ---"
1858+ echo -e " ${DIM} \$ aicr snapshot --namespace test-ns --image test:latest (dry-run check)${NC} "
18521859
1853- # We can't actually run deploy-agent without proper cluster access,
1854- # but we can verify the flags are accepted
18551860 local deploy_output
1856- deploy_output=$( " ${AICR_BIN} " snapshot --deploy-agent -- namespace nonexistent-test-ns --image " test:latest" 2>&1 ) || true
1861+ deploy_output=$( " ${AICR_BIN} " snapshot --namespace nonexistent-test-ns --image " test:latest" 2>&1 ) || true
18571862
1858- # Should fail with cluster/namespace error, not flag parsing error
18591863 if echo " $deploy_output " | grep -qi " not found\|connection refused\|forbidden\|unauthorized\|cannot\|failed" ; then
18601864 detail " Flags accepted (expected cluster error)"
1861- pass " cli/deploy- agent/ flags"
1865+ pass " cli/agent- flags/accepted "
18621866 elif echo " $deploy_output " | grep -qi " unknown flag\|invalid\|usage" ; then
1863- fail " cli/deploy- agent/ flags" " Flag parsing error"
1867+ fail " cli/agent- flags/accepted " " Flag parsing error"
18641868 else
1865- # If it somehow succeeded or gave unexpected output
18661869 detail " Command executed (output: ${deploy_output: 0: 50} ...)"
1867- pass " cli/deploy- agent/ flags"
1870+ pass " cli/agent- flags/accepted "
18681871 fi
18691872
1870- # Test 3: Verify image flag is supported
1871- msg " --- Test: --image flag for deploy-agent ---"
1873+ # Test 3: Verify -- image flag is supported
1874+ msg " --- Test: --image flag ---"
18721875 if echo " $help_output " | grep -q -- " --image" ; then
18731876 detail " --image flag documented"
1874- pass " cli/deploy- agent/image-flag"
1877+ pass " cli/agent-flags /image-flag"
18751878 else
1876- warn " --image flag not found in help (may be optional)"
1877- pass " cli/deploy-agent/image-flag"
1879+ fail " cli/agent-flags/image-flag" " --image not in help output"
18781880 fi
18791881}
18801882
0 commit comments