Skip to content

Commit 714eea9

Browse files
Fix tests
1 parent f609391 commit 714eea9

File tree

5 files changed

+37
-35
lines changed

5 files changed

+37
-35
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**/.venv

docker-compose-test.yaml

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,14 @@ services:
55
restart: on-failure
66
healthcheck:
77
test: >
8-
curl --fail -H "authorization: Bearer development" http://fishjam:5002/room || exit 1
8+
curl --fail-with-body -H "Authorization: Bearer 12345" http://fishjam:5002/admin/health
99
interval: 3s
1010
retries: 2
1111
timeout: 2s
1212
start_period: 30s
1313
environment:
1414
FJ_HOST: "fishjam:5002"
15-
FJ_INTEGRATED_TURN_IP: "${INTEGRATED_TURN_IP:-127.0.0.1}"
16-
FJ_INTEGRATED_TURN_LISTEN_IP: "0.0.0.0"
17-
FJ_INTEGRATED_TURN_PORT_RANGE: "50000-50050"
18-
FJ_INTEGRATED_TCP_TURN_PORT: "49999"
19-
FJ_SERVER_API_TOKEN: "development"
15+
FJ_ADMIN_TOKEN: "12345"
2016
FJ_PORT: 5002
2117
FJ_SECRET_KEY_BASE: "super-secret-key"
2218
FJ_SIP_IP: "127.0.0.1"
@@ -31,34 +27,21 @@ services:
3127
fishjam-prep:
3228
image: curlimages/curl:8.12.1
3329
command: >
34-
curl --fail-with-body -XPOST http://fishjam:5002/admin/user --json '{"id": "testuser", "token": "development"}'
30+
curl --fail-with-body -H "Authorization: Bearer 12345" -XPOST http://fishjam:5002/admin/user --json '{"id": "testuser", "token": "development"}'
3531
depends_on:
3632
fishjam:
3733
condition: service_healthy
3834

3935
test:
4036
container_name: test
41-
image: "cimg/python:${PYTHON_VERSION:-3.10}"
42-
command: sh -c "cd /app && \ poetry config virtualenvs.in-project false && \ poetry install --no-ansi && \ poetry run pytest -s"
37+
build:
38+
context: .
39+
dockerfile: tests/Dockerfile
40+
args:
41+
PYTHON_VERSION: ${PYTHON_VERSION:-3.10}
42+
command: poetry run pytest
4343
environment:
4444
DOCKER_TEST: "TRUE"
45-
ports:
46-
- "5000:5000"
47-
volumes:
48-
- .:/app
49-
depends_on:
50-
fishjam-prep:
51-
condition: service_completed_successfully
52-
53-
examples:
54-
container_name: examples
55-
image: "cimg/python:${PYTHON_VERSION:-3.10}"
56-
command: sh -c "cd /app && \ poetry config virtualenvs.in-project false && \ poetry cache clear pypi --all && \ poetry install --no-ansi && \ poetry run examples"
57-
environment:
58-
DOCKER_TEST: "TRUE"
59-
CI_LIMIT: "10"
60-
volumes:
61-
- .:/app
6245
depends_on:
6346
fishjam-prep:
6447
condition: service_completed_successfully

fishjam/_openapi_client/models/room_config.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class RoomConfig:
2020
"""Duration (in seconds) after which the peer will be removed if it is disconnected. If not provided, this feature is disabled."""
2121
peerless_purge_timeout: Union[Unset, None, int] = UNSET
2222
"""Duration (in seconds) after which the room will be removed if no peers are connected. If not provided, this feature is disabled."""
23-
room_type: Union[Unset, None, RoomConfigRoomType] = UNSET
23+
room_type: Union[Unset, RoomConfigRoomType] = RoomConfigRoomType.FULL_FEATURE
2424
"""The use-case of the room. If not provided, this defaults to full_feature."""
2525
video_codec: Union[Unset, None, RoomConfigVideoCodec] = UNSET
2626
"""Enforces video codec for each peer in the room"""
@@ -34,9 +34,9 @@ def to_dict(self) -> Dict[str, Any]:
3434
max_peers = self.max_peers
3535
peer_disconnected_timeout = self.peer_disconnected_timeout
3636
peerless_purge_timeout = self.peerless_purge_timeout
37-
room_type: Union[Unset, None, str] = UNSET
37+
room_type: Union[Unset, str] = UNSET
3838
if not isinstance(self.room_type, Unset):
39-
room_type = self.room_type.value if self.room_type else None
39+
room_type = self.room_type.value
4040

4141
video_codec: Union[Unset, None, str] = UNSET
4242
if not isinstance(self.video_codec, Unset):
@@ -73,10 +73,8 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
7373
peerless_purge_timeout = d.pop("peerlessPurgeTimeout", UNSET)
7474

7575
_room_type = d.pop("roomType", UNSET)
76-
room_type: Union[Unset, None, RoomConfigRoomType]
77-
if _room_type is None:
78-
room_type = None
79-
elif isinstance(_room_type, Unset):
76+
room_type: Union[Unset, RoomConfigRoomType]
77+
if isinstance(_room_type, Unset):
8078
room_type = UNSET
8179
else:
8280
room_type = RoomConfigRoomType(_room_type)

fishjam/api/_fishjam_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class RoomOptions:
6363
"""Enforces video codec for each peer in the room"""
6464
webhook_url: str | None = None
6565
"""URL where Fishjam notifications will be sent"""
66-
room_type: Literal["full_feature", "audio_only", "broadcaster"] | None = None
66+
room_type: Literal["full_feature", "audio_only", "broadcaster"] = "full_feature"
6767
"""The use-case of the room. If not provided, this defaults to full_feature."""
6868

6969

@@ -130,7 +130,7 @@ def create_room(self, options: RoomOptions | None = None) -> Room:
130130
peerless_purge_timeout=options.peerless_purge_timeout,
131131
video_codec=codec,
132132
webhook_url=options.webhook_url,
133-
room_type=options.room_type and RoomConfigRoomType(options.room_type),
133+
room_type=RoomConfigRoomType(options.room_type),
134134
)
135135

136136
room = cast(

tests/Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
ARG PYTHON_VERSION=3.10
2+
3+
FROM python:$PYTHON_VERSION-slim as builder
4+
5+
ARG POETRY_VERSION=2.1
6+
7+
ENV POETRY_HOME=/opt/poetry
8+
ENV POETRY_VIRTUALENVS_IN_PROJECT=1
9+
ENV POETRY_VIRTUALENVS_CREATE=1
10+
ENV PYTHONDONTWRITEBYTECODE=1
11+
ENV PYTHONUNBUFFERED=1
12+
ENV POETRY_CACHE_DIR=/opt/.cache
13+
14+
RUN pip install "poetry==${POETRY_VERSION}"
15+
16+
WORKDIR /app
17+
18+
COPY pyproject.toml poetry.lock /app/
19+
RUN poetry install --with=dev --no-root && rm -rf $POETRY_CACHE_DIR
20+
COPY . /app/

0 commit comments

Comments
 (0)