fix: apply Docker 24 network workaround and smoke tests to production deploy #64
@@ -294,10 +294,41 @@ jobs:
|
||||
|
||||
- name: Run smoke tests
|
||||
run: |
|
||||
bash scripts/smoke-test-dashboard.sh dev
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "❌ Smoke tests failed! Check logs above."
|
||||
docker logs nas-dashboard-dev --tail 100
|
||||
exit 1
|
||||
fi
|
||||
echo "✅ Smoke tests passed"
|
||||
echo "=== Running smoke tests via docker exec ==="
|
||||
|
||||
# Test 1: Health check
|
||||
echo "1. Testing health endpoint..."
|
||||
docker exec nas-dashboard-dev python3 -c "import urllib.request,json; d=json.loads(urllib.request.urlopen('http://localhost:4000/api/health',timeout=5).read()); assert d['status']=='ok', f'unexpected: {d}'" && echo "✅ Health check passed" || { echo "❌ Health check failed"; docker logs nas-dashboard-dev --tail 50; exit 1; }
|
||||
|
||||
# Test 2: Frontend loads
|
||||
echo "2. Testing frontend loads..."
|
||||
docker exec nas-dashboard-dev python3 -c "import urllib.request; html=urllib.request.urlopen('http://localhost:4000/',timeout=5).read().decode(); assert 'NAS Dashboard' in html, f'missing NAS Dashboard'" && echo "✅ Frontend loads" || { echo "❌ Frontend failed to load"; exit 1; }
|
||||
|
||||
# Test 3: API endpoints require auth
|
||||
echo "3. Testing API endpoints require auth..."
|
||||
docker exec nas-dashboard-dev python3 -c "
|
||||
import urllib.request, json
|
||||
try:
|
||||
resp = urllib.request.urlopen('http://localhost:4000/api/conversations/dates', timeout=5)
|
||||
data = resp.read().decode()
|
||||
assert 'Not authenticated' in data or 'detail' in data, f'unexpected: {data[:200]}'
|
||||
except urllib.error.HTTPError as e:
|
||||
assert e.code in (401, 403), f'expected 401/403, got {e.code}'
|
||||
" && echo "✅ API requires auth" || { echo "❌ Auth check failed"; exit 1; }
|
||||
|
||||
# Test 4: Double /api/ prefix bug (non-failing)
|
||||
echo "4. Testing for double /api/ prefix bug..."
|
||||
docker exec nas-dashboard-dev python3 -c "
|
||||
import urllib.request
|
||||
try:
|
||||
urllib.request.urlopen('http://localhost:4000/api/api/conversations/dates', timeout=5)
|
||||
print('WARNING: /api/api/ returned 200')
|
||||
except urllib.error.HTTPError as e:
|
||||
assert e.code == 404, f'expected 404, got {e.code}'
|
||||
print('OK: /api/api/ returned 404')
|
||||
" && echo "✅ No double /api/ prefix bug" || echo "⚠️ Double API prefix warning"
|
||||
|
||||
# Test 5: Container health already verified in previous step
|
||||
|
||||
echo ""
|
||||
echo "=== All smoke tests passed! ==="
|
||||
|
||||
@@ -4,7 +4,7 @@ services:
|
||||
container_name: nas-dashboard-dev
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "127.0.0.1:4001:4000"
|
||||
- "4001:4000"
|
||||
environment:
|
||||
- DOCKER_HOST=tcp://docker-socket-proxy:2375
|
||||
- GITEA_URL=http://gitea:3000
|
||||
|
||||
Reference in New Issue
Block a user