Skip to content

Commit a0582a9

Browse files
Add SQL Server readiness check to pr-validation workflow
Co-authored-by: dlevy-msft-sql <[email protected]>
1 parent 88eab73 commit a0582a9

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

.github/workflows/pr-validation.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,14 @@ jobs:
2323
export SQLCMDPASSWORD=$(date +%s|sha256sum|base64|head -c 32)
2424
export SQLCMDUSER=sa
2525
docker run -m 2GB -e ACCEPT_EULA=1 -d --name sql2022 -p:1433:1433 -e SA_PASSWORD=$SQLCMDPASSWORD mcr.microsoft.com/mssql/server:2022-latest
26+
echo "Waiting for SQL Server to be ready..."
27+
for i in {1..60}; do
28+
if docker exec sql2022 /opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P "$SQLCMDPASSWORD" -C -Q "SELECT 1" &>/dev/null; then
29+
echo "SQL Server is ready!"
30+
break
31+
fi
32+
echo "Attempt $i: SQL Server not ready yet, waiting..."
33+
sleep 2
34+
done
2635
cd ../..
2736
go test -v ./...

0 commit comments

Comments
 (0)