Skip to content

Commit 77dab31

Browse files
authored
Merge pull request #26 from godon-dev/feature_targets
feat: add target subcommands and CI tests
2 parents 7afe44f + 4b74808 commit 77dab31

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,14 @@ jobs:
198198
-d '{"name":"test","credentialType":"ssh_private_key","content":"test_key_content"}' \
199199
http://localhost:4010/credentials 2>&1 | head -10 || echo "POST /credentials failed"
200200
201+
echo "Testing /targets:"
202+
curl -v http://localhost:4010/targets 2>&1 | head -10 || echo "/targets failed"
203+
204+
echo "Testing POST /targets:"
205+
curl -X POST -H "Content-Type: application/json" \
206+
-d '{"name":"test","targetType":"ssh","address":"10.0.0.1"}' \
207+
http://localhost:4010/targets 2>&1 | head -10 || echo "POST /targets failed"
208+
201209
echo "=== Prism setup complete ==="
202210
203211
- name: Integration tests against Prism mock
@@ -321,6 +329,43 @@ jobs:
321329
$BINARY_PATH --hostname=localhost --port=4010 --debug breeder list
322330
echo "✅ --debug flag works"
323331
332+
# === Target Command Tests ===
333+
echo ""
334+
echo "=== Testing Target Commands ==="
335+
336+
# Test target list
337+
echo "Testing: target list"
338+
$BINARY_PATH --hostname=localhost --port=4010 target list
339+
340+
# Create test target YAML file
341+
echo 'name: "test-web-server"' > test_target.yml
342+
echo 'targetType: "ssh"' >> test_target.yml
343+
echo 'address: "192.168.1.100"' >> test_target.yml
344+
echo 'username: "deploy"' >> test_target.yml
345+
echo 'description: "Test web server"' >> test_target.yml
346+
347+
# Test target create
348+
echo "Testing: target create"
349+
$BINARY_PATH --hostname=localhost --port=4010 target create --file=test_target.yml
350+
351+
# Test target show with mock UUID
352+
echo "Testing: target show"
353+
$BINARY_PATH --hostname=localhost --port=4010 target show --id=550e8400-e29b-41d4-a716-446655440022
354+
355+
# Test target delete
356+
echo "Testing: target delete"
357+
$BINARY_PATH --hostname=localhost --port=4010 target delete --id=550e8400-e29b-41d4-a716-446655440022
358+
359+
# Test help shows target commands
360+
echo "Testing: help shows target commands"
361+
$BINARY_PATH --help | grep -q "target" && echo "✅ Target commands documented in help" || echo "❌ Target commands missing from help"
362+
363+
echo "Testing: JSON output for target list"
364+
$BINARY_PATH --hostname=localhost --port=4010 --output=json target list
365+
366+
echo "Testing: YAML output for target list"
367+
$BINARY_PATH --hostname=localhost --port=4010 --output=yaml target list
368+
324369
# === Error Handling Tests ===
325370
echo ""
326371
echo "=== Testing Error Handling ==="

0 commit comments

Comments
 (0)