Skip to content

Commit f134db0

Browse files
committed
Fix tests
1 parent 8136187 commit f134db0

File tree

5 files changed

+70
-27
lines changed

5 files changed

+70
-27
lines changed

Caddyfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
:5555 {
2+
handle /socket/peer/websocket* {
3+
reverse_proxy fishtank:8080
4+
}
5+
6+
handle /socket/agent/websocket* {
7+
reverse_proxy fishtank:8080
8+
}
9+
10+
handle {
11+
reverse_proxy fishjam:5002
12+
}
13+
}

docker-compose-test.yaml

Lines changed: 44 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,60 @@
11
services:
22
fishjam:
3-
image: "ghcr.io/fishjam-cloud/fishjam:${TAG:-edge-88258de-1764324482}"
3+
image: ghcr.io/fishjam-cloud/fishjam:edge
44
container_name: fishjam
55
restart: on-failure
66
healthcheck:
77
test: >
8-
curl --fail-with-body -H "Authorization: Bearer 12345" http://fishjam:5002/admin/health
8+
curl --fail-with-body -H "Authorization: Bearer admin"
9+
http://fishjam:5002/admin/health || exit 1
910
interval: 3s
1011
retries: 2
1112
timeout: 2s
1213
start_period: 30s
1314
environment:
1415
FJ_HOST: "fishjam:5002"
15-
FJ_ADMIN_TOKEN: "12345"
16+
FJ_ADMIN_TOKEN: "admin"
1617
FJ_PORT: 5002
17-
FJ_SECRET_KEY_BASE: "super-secret-key"
18+
FJ_TEST_USER_TOKEN: "development"
19+
FJ_CHECK_ORIGIN: "false"
20+
# Fisthank
21+
FJ_FISHTANK_TOKEN: "foo"
22+
FJ_FISHTANK_ADDRESS: fishtank:50051
23+
# Broadcaster
1824
FJ_BROADCASTING_ENABLED: "true"
1925
FJ_BROADCASTER_URL: "http://broadcaster:4000"
2026
FJ_BROADCASTER_TOKEN: "broadcaster_token"
2127
FJ_BROADCASTER_WHIP_TOKEN: "whip_token"
28+
# Dev
29+
LOG_LEVEL: "debug"
30+
2231
ports:
2332
- "5002:5002"
24-
- "49999:49999"
25-
- "50000-50050:50000-50050/udp"
2633

27-
fishjam-prep:
28-
image: curlimages/curl:8.12.1
29-
command: >
30-
curl --fail-with-body -H "Authorization: Bearer 12345" -XPOST http://fishjam:5002/admin/user --json '{"id": "testuser", "token": "development"}'
31-
depends_on:
32-
fishjam:
33-
condition: service_healthy
34+
fishtank:
35+
image: ghcr.io/fishjam-cloud/fishtank:edge
36+
container_name: fishtank
37+
restart: on-failure
38+
environment:
39+
FT_FISHJAM_NOTIFICATIONS_ENDPOINT: http://fishjam:5002/notifications/fishtank
40+
FT_FISHJAM_TOKEN: "foo"
41+
FT_STRUCTURED_LOGGING: true
42+
healthcheck:
43+
interval: 3s
44+
retries: 2
45+
timeout: 2s
46+
start_period: 30s
47+
ports:
48+
- "8080:8080"
49+
50+
caddy:
51+
image: caddy
52+
container_name: caddy
53+
restart: unless-stopped
54+
ports:
55+
- 5555:5555
56+
volumes:
57+
- ./Caddyfile:/etc/caddy/Caddyfile:ro
3458

3559
test:
3660
container_name: test
@@ -39,9 +63,13 @@ services:
3963
dockerfile: tests/Dockerfile
4064
args:
4165
PYTHON_VERSION: ${PYTHON_VERSION:-3.11}
42-
command: uv run pytest
66+
command: uv run pytest -s -vv
4367
environment:
4468
DOCKER_TEST: "TRUE"
4569
depends_on:
46-
fishjam-prep:
47-
condition: service_completed_successfully
70+
fishtank:
71+
condition: service_healthy
72+
fishjam:
73+
condition: service_healthy
74+
caddy:
75+
condition: service_started

tests/agent/test_agent.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
)
1616
from fishjam.events.allowed_notifications import AllowedNotification
1717

18-
HOST = "fishjam" if os.getenv("DOCKER_TEST") == "TRUE" else "localhost"
19-
FISHJAM_ID = f"http://{HOST}:5002"
18+
HOST = "caddy" if os.getenv("DOCKER_TEST") == "TRUE" else "localhost"
19+
FISHJAM_ID = f"http://{HOST}:5555"
2020
SERVER_API_TOKEN = os.getenv("MANAGEMENT_TOKEN", "development")
2121

2222

tests/test_notifier.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
from tests.support.peer_socket import PeerSocket
2424
from tests.support.webhook_notifier import run_server
2525

26-
HOST = "fishjam" if os.getenv("DOCKER_TEST") == "TRUE" else "localhost"
27-
FISHJAM_URL = f"http://{HOST}:5002"
26+
FISHJAM_HOST = "caddy" if os.getenv("DOCKER_TEST") == "TRUE" else "localhost"
27+
FISHJAM_URL = f"http://{FISHJAM_HOST}:5555"
2828
FISHJAM_ID = FISHJAM_URL
2929
SERVER_API_TOKEN = os.getenv("MANAGEMENT_TOKEN", "development")
3030
WEBHOOK_ADDRESS = "test" if os.getenv("DOCKER_TEST") == "TRUE" else "localhost"

tests/test_room_api.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
VideoCodec,
2828
)
2929

30-
HOST = "fishjam" if os.getenv("DOCKER_TEST") == "TRUE" else "localhost"
31-
FISHJAM_ID = f"http://{HOST}:5002"
30+
HOST = "caddy" if os.getenv("DOCKER_TEST") == "TRUE" else "localhost"
31+
FISHJAM_ID = f"http://{HOST}:5555"
3232
MANAGEMENT_TOKEN = os.getenv("MANAGEMENT_TOKEN", "development")
3333

3434
MAX_PEERS = 10
@@ -64,7 +64,7 @@ def test_no_params(self, room_api: FishjamClient):
6464
room = room_api.create_room()
6565

6666
config = RoomConfig(
67-
max_peers=None,
67+
max_peers=0,
6868
webhook_url=None,
6969
room_type=RoomType(CONFERENCE),
7070
video_codec=VideoCodec.H264,
@@ -127,7 +127,9 @@ def test_invalid_id(self, room_api: FishjamClient):
127127

128128
def test_id_not_found(self, room_api: FishjamClient):
129129
with pytest.raises(NotFoundError):
130-
room_api.delete_room("515c8b52-168b-4b39-a227-4d6b4f102a56")
130+
room_api.delete_room(
131+
"7ef-a0b0-6db20b2ef65c-7a696f6d6f-70726f64756374696f6e-6e6f6e6f6465406e6f686f7374"
132+
)
131133

132134

133135
class TestGetAllRooms:
@@ -144,7 +146,7 @@ def test_valid(self, room_api: FishjamClient):
144146
room = room_api.create_room()
145147

146148
config = RoomConfig(
147-
max_peers=None,
149+
max_peers=0,
148150
webhook_url=None,
149151
room_type=RoomType(CONFERENCE),
150152
video_codec=VideoCodec.H264,
@@ -261,7 +263,7 @@ def test_valid(self, room_api: FishjamClient):
261263
def test_invalid(self, room_api: FishjamClient):
262264
room = room_api.create_room()
263265

264-
with pytest.raises(BadRequestError):
266+
with pytest.raises(NotFoundError):
265267
room_api.create_livestream_viewer_token(room.id)
266268

267269

@@ -275,5 +277,5 @@ def test_valid(self, room_api: FishjamClient):
275277
def test_invalid(self, room_api: FishjamClient):
276278
room = room_api.create_room()
277279

278-
with pytest.raises(BadRequestError):
280+
with pytest.raises(NotFoundError):
279281
room_api.create_livestream_streamer_token(room.id)

0 commit comments

Comments
 (0)