Skip to content

Commit 4411656

Browse files
committed
test pass issues
1 parent a7ba415 commit 4411656

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

azure-pipelines.yml

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ jobs:
144144
displayName: Restart SQL Server
145145
146146
- powershell: |
147-
(Get-Content -ReadCount 0 testapp\settings.py) -replace 'MyPassword42', '$(TestAppPassWord)' | Set-Content testapp\settings.py
147+
(Get-Content -ReadCount 0 testapp\settings.py) -replace 'MyPassword42', '$(TestAppPassword)' | Set-Content testapp\settings.py
148148
displayName: Change PASSWORD in settings.py
149149
150150
- powershell: |
@@ -345,6 +345,43 @@ jobs:
345345
sed -i 's/MyPassword42/$(TestAppPassword)/g' testapp/settings.py
346346
displayName: Change PASSWORD in settings.py
347347
348+
- script: |
349+
echo "Verifying password replacement..."
350+
if grep -q "MyPassword42" testapp/settings.py; then
351+
echo "ERROR: Password replacement failed - MyPassword42 still found"
352+
exit 1
353+
else
354+
echo "Password replacement successful"
355+
fi
356+
echo "Database configuration:"
357+
grep -A 10 -B 2 "PASSWORD" testapp/settings.py
358+
displayName: Verify PASSWORD replacement
359+
360+
- script: |
361+
echo "Testing Django database connection..."
362+
python -c "
363+
import os
364+
import sys
365+
import django
366+
from django.conf import settings
367+
from django.db import connection
368+
369+
# Add testapp to Python path
370+
sys.path.insert(0, '/mnt/vss/_work/1/s')
371+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'testapp.settings')
372+
django.setup()
373+
374+
try:
375+
with connection.cursor() as cursor:
376+
cursor.execute('SELECT 1')
377+
result = cursor.fetchone()
378+
print(f'Database connection successful: {result}')
379+
except Exception as e:
380+
print(f'Database connection failed: {e}')
381+
sys.exit(1)
382+
"
383+
displayName: Test database connection
384+
348385
- script: tox -e $(tox.env)
349386
displayName: Run tox
350387

0 commit comments

Comments
 (0)