Skip to content

Commit 10d03d6

Browse files
committed
chore: add a step to check if port is open
1 parent bb09c41 commit 10d03d6

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

.github/workflows/sleep-test.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,28 @@ jobs:
4040
shell: powershell
4141
run: |
4242
Start-Process -FilePath "./target/debug/examples/server" -RedirectStandardOutput "server.log" -RedirectStandardError "server-error.log" -NoNewWindow
43-
Start-Sleep -Seconds 10 # Give server time to start
43+
Start-Sleep -Seconds 5 # Give server time to start
44+
45+
- name: Wait for server to start
46+
shell: powershell
47+
run: |
48+
$timeout = 30
49+
$elapsed = 0
50+
do {
51+
$result = Test-NetConnection -ComputerName localhost -Port 5432 -InformationLevel Quiet
52+
if ($result) {
53+
Write-Host "Port 5432 is open!"
54+
break
55+
}
56+
Start-Sleep -Seconds 1
57+
$elapsed++
58+
Write-Host "Waiting for port 5432... ($elapsed/$timeout)"
59+
} while ($elapsed -lt $timeout)
60+
61+
if (-not $result) {
62+
Write-Host "Port 5432 did not open within $timeout seconds"
63+
exit 1
64+
}
4465
4566
- name: test sqlx
4667
run: cargo run --example sqlx

0 commit comments

Comments
 (0)