Skip to content
Merged
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
39 changes: 39 additions & 0 deletions actions/setup/sh/convert_gateway_config_codex_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ trap "rm -rf $TEST_DIR" EXIT
echo "=== Testing convert_gateway_config_codex.sh ==="
echo ""

# Set required environment variables for all tests
export MCP_GATEWAY_DOMAIN="host.docker.internal"
export MCP_GATEWAY_PORT="80"

# Create the output directory the script writes to
mkdir -p /tmp/gh-aw/mcp-config

# Test 1: Basic gateway output conversion
echo "Test 1: Convert basic gateway output with Authorization headers"
mkdir -p "$TEST_DIR/mcp-config"
Expand Down Expand Up @@ -78,6 +85,13 @@ if ! grep -q 'persistence = "none"' /tmp/gh-aw/mcp-config/config.toml; then
exit 1
fi

# Check that URLs are correctly formatted with domain and port
if ! grep -q 'url = "http://host.docker.internal:80/mcp/github"' /tmp/gh-aw/mcp-config/config.toml; then
echo "✗ FAIL: URL not correctly formatted for github server"
cat /tmp/gh-aw/mcp-config/config.toml
exit 1
fi

echo "✓ PASS: Basic gateway output conversion"
echo ""

Expand Down Expand Up @@ -119,4 +133,29 @@ else
fi
echo ""

# Test 5: Error handling - missing MCP_GATEWAY_DOMAIN
echo "Test 5: Error handling for missing MCP_GATEWAY_DOMAIN"
export MCP_GATEWAY_OUTPUT="$TEST_DIR/gateway-output.json"
unset MCP_GATEWAY_DOMAIN
if bash "$SCRIPT_PATH" > /dev/null 2>&1; then
echo "✗ FAIL: Script should fail when MCP_GATEWAY_DOMAIN is not set"
exit 1
else
echo "✓ PASS: Script correctly fails when MCP_GATEWAY_DOMAIN is not set"
fi
export MCP_GATEWAY_DOMAIN="host.docker.internal"
echo ""

# Test 6: Error handling - missing MCP_GATEWAY_PORT
echo "Test 6: Error handling for missing MCP_GATEWAY_PORT"
unset MCP_GATEWAY_PORT
if bash "$SCRIPT_PATH" > /dev/null 2>&1; then
echo "✗ FAIL: Script should fail when MCP_GATEWAY_PORT is not set"
exit 1
else
echo "✓ PASS: Script correctly fails when MCP_GATEWAY_PORT is not set"
fi
export MCP_GATEWAY_PORT="80"
echo ""

echo "=== All tests passed ==="
Loading