Skip to content
Closed
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
34 changes: 20 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -227,20 +227,26 @@ jobs:
echo "Testing: help shows --insecure flag"
$BINARY_PATH --help | grep -q "insecure" && echo "✅ --insecure flag documented in help" || echo "❌ --insecure flag missing from help"

# Create test YAML files using echo
echo 'meta:' > test_breeder.yml
echo ' configVersion: "0.2"' >> test_breeder.yml
echo 'breeder:' >> test_breeder.yml
echo ' type: "linux_performance"' >> test_breeder.yml
echo 'settings:' >> test_breeder.yml
echo ' sysctl:' >> test_breeder.yml
echo ' vm.swappiness:' >> test_breeder.yml
echo ' constraints:' >> test_breeder.yml
echo ' lower: 0' >> test_breeder.yml
echo ' upper: 100' >> test_breeder.yml

echo "Testing: breeder create"
$BINARY_PATH --hostname=localhost --port=4010 breeder create --name="test-breeder" --file=test_breeder.yml
# Fetch real config from upstream godon repository to catch JSON truncation bugs
curl -s https://raw.githubusercontent.com/godon-dev/godon/refs/heads/master/examples/network.yml -o test_breeder.yml

echo "Testing: breeder create with real upstream config"
CREATE_OUTPUT=$($BINARY_PATH --hostname=localhost --port=4010 breeder create --name="test-breeder" --file=test_breeder.yml 2>&1)
CREATE_EXIT_CODE=$?

echo "Create exit code: $CREATE_EXIT_CODE"
echo "Create output: $CREATE_OUTPUT"

# Check for JSON truncation bug
if [ $CREATE_EXIT_CODE -ne 0 ]; then
echo "❌ Breeder create failed!"
if echo "$CREATE_OUTPUT" | grep -q "Invalid JSON"; then
echo "🐛 Detected JSON truncation bug - config too large or malformed"
fi
exit 1
else
echo "✅ Breeder create succeeded"
fi

# Test breeder show with a mock UUID
echo "Testing: breeder show"
Expand Down
15 changes: 15 additions & 0 deletions src/godon/breeder.nim
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ proc createBreeder*(client: GodonClient, request: BreederCreateRequest): ApiResp
"name": request.name,
"config": request.config
}

# Debug: Show what we're about to send
when defined(debug):
echo "DEBUG: Sending JSON to ", url
echo "DEBUG: JSON string length: ", ($jsonData).len
echo "DEBUG: Full JSON: ", $jsonData

echo "Sending JSON: ", $jsonData
client.httpClient.headers = newHttpHeaders({"Content-Type": "application/json"})
let response = client.httpClient.post(url, $jsonData)
Expand All @@ -43,6 +50,14 @@ proc createBreederFromYamlWithName*(client: GodonClient, yamlContent: string, na

let configNode = jsonNodes[0]

# Debug: Show parsed structure
when defined(debug):
echo "DEBUG: Parsed YAML to JsonNode"
echo "DEBUG: ConfigNode keys: ", configNode.keys
echo "DEBUG: ConfigNode kind: ", configNode.kind
echo "DEBUG: YAML content length: ", yamlContent.len
echo "DEBUG: JsonNode size: ", $$configNode.len

# Create BreederCreateRequest with name from parameter and config from YAML
let request = BreederCreateRequest(
name: name,
Expand Down