Skip to content

Commit f50de01

Browse files
committed
Fix formatting and improve error handling in CLI tests within GitHub Actions workflow
1 parent 7ca9674 commit f50de01

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

.github/workflows/test-mcp-server.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -328,27 +328,27 @@ jobs:
328328
echo "Testing CLI commands..."
329329
330330
# Test compile from file
331-
echo "[filename: Cargo.toml]\n[package]\nname = \"test\"\nversion = \"0.1.0\"[filename: src/main.rs]\nfn main() { println!(\"Hello\"); }" > test_project.txt
331+
echo "[filename: Cargo.toml]\n[package]\nname = \"test\"\nversion = \"0.1.0\"\n\n[filename: src/main.rs]\nfn main() { println!(\"Hello\"); }" > test_project.txt
332332
333333
python -m cli.main --server http://localhost:8001 compile --code test_project.txt
334334
335335
# Test compile from project ID
336336
python -m cli.main --server http://localhost:8001 compile --project test-123
337337
338338
# Test fix from file
339-
python -m cli.main --server http://localhost:8001 fix --code test_project.--description "test project" --max-attempts 2
339+
python -m cli.main --server http://localhost:8001 fix --code test_project.txt --description "test project" --max-attempts 2
340340
341341
# Test fix from project ID
342-
python -m cli.main --server http://localhost:8001 fix --project test-123 --descript"test project" --max-attempts 2
342+
python -m cli.main --server http://localhost:8001 fix --project test-123 --description "test project" --max-attempts 2
343343
344344
# Test status command
345345
python -m cli.main --server http://localhost:8001 status --project test-123
346346
347347
# Test cat command
348-
python -m cli.main --server http://localhost:8001 cat --project test-123 --file main.rs
348+
python -m cli.main --server http://localhost:8001 cat --project test-123 --file src/main.rs
349349
350350
# Test download command (should fail gracefully with mock server)
351-
python -m cli.main --server http://localhost:8001 download --project test-123 || e"Download failed as expected with mock server"
351+
python -m cli.main --server http://localhost:8001 download --project test-123 || echo "Download failed as expected with mock server"
352352
353353
# Clean up
354354
kill $MOCK_PID 2>/dev/null || true
@@ -360,16 +360,16 @@ jobs:
360360
echo "Testing CLI error handling..."
361361
362362
# Test missing required arguments
363-
python -m cli.main compile 2>&1 | grep -q "Error: Must specify either --code--project" && echo "Missing args error handled ✅" || exit 1
363+
python -m cli.main compile 2>&1 | grep -q "Error: Must specify either --code or --project" && echo "Missing args error handled ✅" || exit 1
364364
365365
# Test conflicting arguments
366-
python -m cli.main compile --code test.txt --project test-123 2>&1 | grep -q "ErrCannot specify both --code and --project" && echo "Conflicting args error hand✅" || exit 1
366+
python -m cli.main compile --code test.txt --project test-123 2>&1 | grep -q "Error: Cannot specify both --code and --project" && echo "Conflicting args error handled ✅" || exit 1
367367
368368
# Test non-existent file
369-
python -m cli.main compile --code nonexistent.txt 2>&1 | grep -q "File not found"echo "File not found error handled ✅" || exit 1
369+
python -m cli.main compile --code nonexistent.txt 2>&1 | grep -q "File not found" && echo "File not found error handled ✅" || exit 1
370370
371371
# Test non-existent project
372-
python -m cli.main --server http://localhost:8001 compile --project nonexistent 2>&grep -q "Project not found" && echo "Project not found error handled ✅" || exit 1
372+
python -m cli.main --server http://localhost:8001 compile --project nonexistent 2>&1 | grep -q "Project not found" && echo "Project not found error handled ✅" || exit 1
373373
374374
echo "CLI error handling tests completed ✅"
375375
- name: Test CLI JSON output
@@ -384,7 +384,7 @@ jobs:
384384
# Test JSON output
385385
python -m cli.main --server http://localhost:8001 version --json | python -c "import json, sys; json.load(sys.stdin); print('JSON output valid ✅')"
386386
387-
python -m cli.main --server http://localhost:8001 compile --code test_project.--json | python -c "import json, sys; json.load(sys.stdin); print('Compile JSON outvalid ✅')"
387+
python -m cli.main --server http://localhost:8001 compile --code test_project.txt --json | python -c "import json, sys; json.load(sys.stdin); print('Compile JSON output valid ✅')"
388388
389389
# Clean up
390390
kill $MOCK_PID 2>/dev/null || true

0 commit comments

Comments
 (0)