mirror of
https://github.com/azaion/detections.git
synced 2026-06-21 23:11:07 +00:00
Fixed tests
This commit is contained in:
@@ -7,6 +7,7 @@ COPY . .
|
|||||||
RUN python setup.py build_ext --inplace
|
RUN python setup.py build_ext --inplace
|
||||||
ENV PYTHONPATH=/app/src
|
ENV PYTHONPATH=/app/src
|
||||||
RUN adduser --disabled-password --no-create-home --gecos "" appuser \
|
RUN adduser --disabled-password --no-create-home --gecos "" appuser \
|
||||||
|
&& mkdir -p /app/Logs \
|
||||||
&& chown -R appuser /app
|
&& chown -R appuser /app
|
||||||
USER appuser
|
USER appuser
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ COPY . .
|
|||||||
RUN python3 setup.py build_ext --inplace
|
RUN python3 setup.py build_ext --inplace
|
||||||
ENV PYTHONPATH=/app/src
|
ENV PYTHONPATH=/app/src
|
||||||
RUN adduser --disabled-password --no-create-home --gecos "" appuser \
|
RUN adduser --disabled-password --no-create-home --gecos "" appuser \
|
||||||
|
&& mkdir -p /app/Logs \
|
||||||
&& chown -R appuser /app
|
&& chown -R appuser /app
|
||||||
USER appuser
|
USER appuser
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ COPY . .
|
|||||||
RUN BUILD_TENSORRT_EXTENSIONS=1 python3 setup.py build_ext --inplace
|
RUN BUILD_TENSORRT_EXTENSIONS=1 python3 setup.py build_ext --inplace
|
||||||
ENV PYTHONPATH=/app/src
|
ENV PYTHONPATH=/app/src
|
||||||
RUN adduser --disabled-password --no-create-home --gecos "" appuser \
|
RUN adduser --disabled-password --no-create-home --gecos "" appuser \
|
||||||
|
&& mkdir -p /app/Logs \
|
||||||
&& chown -R appuser /app
|
&& chown -R appuser /app
|
||||||
USER appuser
|
USER appuser
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|||||||
@@ -3,4 +3,5 @@ WORKDIR /app
|
|||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
COPY . .
|
COPY . .
|
||||||
|
RUN mkdir -p /app/Logs && chmod 0777 /app/Logs
|
||||||
CMD ["pytest", "--csv=/results/report.csv", "-v"]
|
CMD ["pytest", "--csv=/results/report.csv", "-v"]
|
||||||
|
|||||||
@@ -238,6 +238,15 @@ def image_empty_scene():
|
|||||||
return _read_media("image_empty_scene.jpg")
|
return _read_media("image_empty_scene.jpg")
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(scope="session")
|
||||||
|
def image_dense():
|
||||||
|
for name in ("image_dense.jpg", "image_dense01.jpg", "image_dense02.jpg"):
|
||||||
|
p = _media_dir() / name
|
||||||
|
if p.is_file():
|
||||||
|
return p.read_bytes()
|
||||||
|
pytest.skip("missing dense image fixture")
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="session")
|
@pytest.fixture(scope="session")
|
||||||
def video_short_path():
|
def video_short_path():
|
||||||
return str(_media_dir() / "video_test01.mp4")
|
return str(_media_dir() / "video_test01.mp4")
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ services:
|
|||||||
CLASSES_JSON_PATH: /app/classes.json
|
CLASSES_JSON_PATH: /app/classes.json
|
||||||
volumes:
|
volumes:
|
||||||
- ./fixtures:/media
|
- ./fixtures:/media
|
||||||
- ./logs:/app/Logs
|
- detections-logs:/app/Logs
|
||||||
shm_size: 512m
|
shm_size: 512m
|
||||||
mem_limit: 4g
|
mem_limit: 4g
|
||||||
networks:
|
networks:
|
||||||
@@ -52,7 +52,7 @@ services:
|
|||||||
CLASSES_JSON_PATH: /app/classes.json
|
CLASSES_JSON_PATH: /app/classes.json
|
||||||
volumes:
|
volumes:
|
||||||
- ./fixtures:/media
|
- ./fixtures:/media
|
||||||
- ./logs:/app/Logs
|
- detections-logs:/app/Logs
|
||||||
networks:
|
networks:
|
||||||
e2e-net:
|
e2e-net:
|
||||||
aliases:
|
aliases:
|
||||||
@@ -75,6 +75,7 @@ services:
|
|||||||
CLASSES_JSON_PATH: /app/classes.json
|
CLASSES_JSON_PATH: /app/classes.json
|
||||||
volumes:
|
volumes:
|
||||||
- ./fixtures:/media:ro
|
- ./fixtures:/media:ro
|
||||||
|
- detections-logs:/app/Logs
|
||||||
shm_size: 512m
|
shm_size: 512m
|
||||||
networks:
|
networks:
|
||||||
e2e-net:
|
e2e-net:
|
||||||
@@ -92,10 +93,11 @@ services:
|
|||||||
- mock-annotations
|
- mock-annotations
|
||||||
environment:
|
environment:
|
||||||
JWT_SECRET: test-secret-e2e-only
|
JWT_SECRET: test-secret-e2e-only
|
||||||
MEDIA_DIR: /app/fixtures
|
MEDIA_DIR: /media
|
||||||
volumes:
|
volumes:
|
||||||
- ./fixtures:/media
|
- ./fixtures:/media
|
||||||
- ./results:/results
|
- ./results:/results
|
||||||
|
- detections-logs:/app/Logs
|
||||||
networks:
|
networks:
|
||||||
- e2e-net
|
- e2e-net
|
||||||
command: ["pytest", "--csv=/results/report.csv", "-v"]
|
command: ["pytest", "--csv=/results/report.csv", "-v"]
|
||||||
@@ -103,3 +105,6 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
e2e-net:
|
e2e-net:
|
||||||
driver: bridge
|
driver: bridge
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
detections-logs:
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ def test_ft_p09_sse_event_delivery(
|
|||||||
data = json.loads(event.data)
|
data = json.loads(event.data)
|
||||||
collected.append(data)
|
collected.append(data)
|
||||||
first_event.set()
|
first_event.set()
|
||||||
if len(collected) >= 5:
|
if data.get("mediaStatus") in ("AIProcessed", "Error"):
|
||||||
break
|
break
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
thread_exc.append(e)
|
thread_exc.append(e)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import json
|
import json
|
||||||
|
import os
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
import uuid
|
import uuid
|
||||||
@@ -7,7 +8,9 @@ from pathlib import Path
|
|||||||
import pytest
|
import pytest
|
||||||
import sseclient
|
import sseclient
|
||||||
|
|
||||||
FIXTURES_DIR = Path(__file__).resolve().parent.parent / "fixtures"
|
FIXTURES_DIR = Path(
|
||||||
|
os.environ.get("MEDIA_DIR", Path(__file__).resolve().parent.parent / "fixtures")
|
||||||
|
)
|
||||||
_VIDEO = str(FIXTURES_DIR / "video_test01.mp4")
|
_VIDEO = str(FIXTURES_DIR / "video_test01.mp4")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user