Skip to content

Commit ec97323

Browse files
committed
fix: Windows E2E - use 127.0.0.1 instead of localhost, fix $pid reserved var
- Use 127.0.0.1 instead of localhost for curl health checks (Windows CI runners may not resolve localhost to the loopback interface) - Rename $pid to $serverPid in PowerShell cleanup ($pid is read-only)
1 parent e7cd9a8 commit ec97323

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

.github/workflows/e2e-tests.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ jobs:
146146
run: |
147147
max_attempts=30
148148
attempt=0
149-
until curl -sf http://localhost:3000/ > /dev/null 2>&1; do
149+
until curl -sf http://127.0.0.1:3000/ > /dev/null 2>&1; do
150150
attempt=$((attempt + 1))
151151
if [ $attempt -ge $max_attempts ]; then
152152
echo "::error::Server failed to start after $max_attempts attempts (60s)"
@@ -187,16 +187,16 @@ jobs:
187187
shell: bash
188188
run: |
189189
# Test index.html is served at root
190-
status=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:3000/)
190+
status=$(curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:3000/)
191191
if [ "$status" != "200" ]; then
192192
echo "::error::GET / returned HTTP $status (expected 200)"
193193
exit 1
194194
fi
195195
196196
# Test index.html contains expected content
197-
if ! curl -sf http://localhost:3000/ | grep -q "FlashForge Web UI"; then
197+
if ! curl -sf http://127.0.0.1:3000/ | grep -q "FlashForge Web UI"; then
198198
echo "::error::GET / did not contain 'FlashForge Web UI'"
199-
curl -s http://localhost:3000/ | head -20
199+
curl -s http://127.0.0.1:3000/ | head -20
200200
exit 1
201201
fi
202202
echo "✓ Static file serving works"
@@ -206,21 +206,21 @@ jobs:
206206
shell: bash
207207
run: |
208208
# Auth status endpoint
209-
status=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:3000/api/auth/status)
209+
status=$(curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:3000/api/auth/status)
210210
if [ "$status" != "200" ]; then
211211
echo "::error::GET /api/auth/status returned HTTP $status (expected 200)"
212212
exit 1
213213
fi
214214
215-
response=$(curl -sf http://localhost:3000/api/auth/status)
215+
response=$(curl -sf http://127.0.0.1:3000/api/auth/status)
216216
if ! echo "$response" | jq '.' > /dev/null 2>&1; then
217217
echo "::error::Auth status API returned invalid JSON: $response"
218218
exit 1
219219
fi
220220
echo "✓ GET /api/auth/status - valid JSON response"
221221
222222
# Login endpoint
223-
login_response=$(curl -s -w "\n%{http_code}" -X POST http://localhost:3000/api/auth/login \
223+
login_response=$(curl -s -w "\n%{http_code}" -X POST http://127.0.0.1:3000/api/auth/login \
224224
-H "Content-Type: application/json" \
225225
-d '{"password":"changeme"}')
226226
login_body=$(echo "$login_response" | sed '$d')
@@ -241,7 +241,7 @@ jobs:
241241
echo "✓ POST /api/auth/login - login successful"
242242
243243
# 404 handler for unknown API routes
244-
unknown_status=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:3000/api/nonexistent)
244+
unknown_status=$(curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:3000/api/nonexistent)
245245
if [ "$unknown_status" != "404" ]; then
246246
echo "::error::GET /api/nonexistent returned HTTP $unknown_status (expected 404)"
247247
exit 1
@@ -256,11 +256,11 @@ jobs:
256256
shell: pwsh
257257
run: |
258258
if (Test-Path server.pid) {
259-
$pid = Get-Content server.pid
260-
$proc = Get-Process -Id $pid -ErrorAction SilentlyContinue
259+
$serverPid = (Get-Content server.pid).Trim()
260+
$proc = Get-Process -Id $serverPid -ErrorAction SilentlyContinue
261261
if ($proc) {
262-
Stop-Process -Id $pid -Force
263-
Write-Host "Stopped server (PID: $pid)"
262+
Stop-Process -Id $serverPid -Force
263+
Write-Host "Stopped server (PID: $serverPid)"
264264
} else {
265265
Write-Host "Process already exited"
266266
}

0 commit comments

Comments
 (0)