File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -336,14 +336,15 @@ jobs:
336336 # Retry authentication until SQL Server finishes its internal upgrade process
337337 for i in {1..30}; do
338338 echo "Authentication attempt $i of 30..."
339- if sqlcmd -S localhost -U sa -P "$(TestAppPassword)" -Q "SELECT 1 AS test" -t 10 >/dev/null 2>&1; then
339+ # Force IPv4 TCP to avoid potential localhost/IPv6 resolution issues on agents
340+ if sqlcmd -S "tcp:127.0.0.1,1433" -U sa -P "$(TestAppPassword)" -Q "SELECT 1 AS test" -l 10 >/dev/null 2>&1; then
340341 echo "✅ SQL Server authentication successful after $i attempts!"
341342 break
342343 else
343344 if [ $i -eq 30 ]; then
344345 echo "❌ SQL Server authentication FAILED after 30 attempts!"
345346 echo "Final attempt with verbose output:"
346- sqlcmd -S localhost -U sa -P "$(TestAppPassword)" -Q "SELECT 1 AS test" -t 10
347+ sqlcmd -S "tcp:127.0.0.1,1433" -U sa -P "$(TestAppPassword)" -Q "SELECT 1 AS test" -l 10
347348 echo ""
348349 echo "Container logs:"
349350 docker logs $(docker ps -q --filter ancestor=mcr.microsoft.com/mssql/server:2022-latest)
@@ -392,6 +393,13 @@ jobs:
392393 grep -A 10 -B 2 "PASSWORD" testapp/settings.py
393394 displayName: Verify PASSWORD replacement
394395
396+ - script : |
397+ # Force Django DB host to IPv4 loopback to avoid IPv6 localhost resolution issues
398+ sed -i "s|\"HOST\": \"localhost\"|\"HOST\": \"127.0.0.1\"|g" testapp/settings.py
399+ echo "Updated DB HOST to 127.0.0.1"
400+ grep -n "\"HOST\"" -n testapp/settings.py
401+ displayName: Use IPv4 loopback for DB host
402+
395403 - script : tox -e $(tox.env)
396404 displayName : Run tox
397405
You can’t perform that action at this time.
0 commit comments