Changes on the server.json format and the API (#562)

This commit is contained in:
Radoslav Dimitrov 2025-09-29 23:30:35 +03:00 • committed by GitHub
commit b21c6f564d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4056 additions and 5608 deletions

View file

@ -98,25 +98,25 @@ test_servers() {
echo "Response Summary:"
echo "$http_response" | jq '.servers | length' | xargs echo "Total registries:"
# Display a prettier formatted summary - fixed to use lowercase property name
echo "servers Names:"
echo "$http_response" | jq -r '.servers[].name'
# Display a prettier formatted summary
echo "Server Names:"
echo "$http_response" | jq -r '.servers[].server.name'
# Show the metadata with next cursor if available
echo -e "\nPagination Metadata:"
echo "$http_response" | jq '.metadata'
# Show more detailed output with all fields
echo -e "\nservers Details:"
echo -e "\nServer Details:"
echo "$http_response" | jq '.'
echo "servers request successful"
echo "Servers request successful"
echo "-------------------------------------"
return 0
else
echo "Response:"
echo "$http_response" | jq '.' 2>/dev/null || echo "$http_response"
echo "servers request failed"
echo "Servers request failed"
echo "-------------------------------------"
return 1
fi
@ -135,37 +135,37 @@ test_servers_with_limit() {
if [[ $status_code == 2* ]]; then
# Verify the response contains the right number of items (or not more than the limit)
item_count=$(echo "$http_response" | jq '.data | length')
item_count=$(echo "$http_response" | jq '.servers | length')
echo "Response has $item_count items (requested limit: $limit)"
# Verify we're not exceeding the limit
if [[ $item_count -gt $limit ]]; then
echo "ERROR: Response contains more items ($item_count) than the requested limit ($limit)"
return 1
fi
# Parse and display JSON with jq
echo "Response Summary:"
# Display a prettier formatted summary
echo "servers Names:"
echo "$http_response" | jq -r '.data[].name'
echo "Server Names:"
echo "$http_response" | jq -r '.servers[].server.name'
# Show the metadata with next cursor if available
echo -e "\nPagination Metadata:"
echo "$http_response" | jq '.metadata'
# Show more detailed output with all fields
echo -e "\nservers Details:"
echo -e "\nServer Details:"
echo "$http_response" | jq '.'
echo "servers request with limit successful"
echo "Servers request with limit successful"
echo "-------------------------------------"
return 0
else
echo "Response:"
echo "$http_response" | jq '.' 2>/dev/null || echo "$http_response"
echo "servers request with limit failed"
echo "Servers request with limit failed"
echo "-------------------------------------"
return 1
fi

View file

@ -169,9 +169,9 @@ if [[ "${status_code:0:1}" == "2" ]]; then
echo "Response:"
echo "$http_response" | jq '.' 2>/dev/null || echo "$http_response"
# Check for server added message and extract UUID
# Check for server added message and extract server name
message=$(echo "$http_response" | jq -r '.message // empty' 2>/dev/null)
server_id=$(echo "$http_response" | jq -r '.id // .server_id // empty' 2>/dev/null)
server_name=$(echo "$http_response" | jq -r '.server.name // .name // empty' 2>/dev/null)
# Validate the response contains success indicators
success_indicators=0
@ -184,28 +184,28 @@ if [[ "${status_code:0:1}" == "2" ]]; then
fi
fi
if [[ ! -z "$server_id" && "$server_id" != "null" && "$server_id" != "empty" ]]; then
echo "✓ Server UUID received: $server_id"
# Validate UUID format (basic check for UUID pattern)
if [[ "$server_id" =~ ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$ ]]; then
if [[ ! -z "$server_name" && "$server_name" != "null" && "$server_name" != "empty" ]]; then
echo "✓ Server name received: $server_name"
# Validate server name format (should contain a namespace like 'domain/name')
if [[ "$server_name" == *"/"* ]]; then
((success_indicators++))
echo "✓ Server ID appears to be a valid UUID format"
echo "✓ Server name appears to be a valid namespaced format"
else
echo "⚠ Server ID format may not be a standard UUID: $server_id"
((success_indicators++)) # Still count as success if we got an ID
echo "⚠ Server name format may not contain namespace: $server_name"
((success_indicators++)) # Still count as success if we got a name
fi
fi
if [[ $success_indicators -ge 2 ]]; then
echo ""
echo "🎉 PUBLISH TEST PASSED!"
echo " ✓ Server successfully published with ID: $server_id"
echo " ✓ Server successfully published with name: $server_name"
echo " ✓ Success message: $message"
else
echo ""
echo "❌ PUBLISH TEST FAILED!"
echo " Expected: Success message about server being added AND a server UUID"
echo " Received: message='$message', id='$server_id'"
echo " Expected: Success message about server being added AND a server name"
echo " Received: message='$message', name='$server_name'"
exit 1
fi