Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
:5555 {
handle /socket/peer/websocket* {
reverse_proxy fishtank:8080
}

handle /socket/agent/websocket* {
reverse_proxy fishtank:8080
}

handle {
reverse_proxy fishjam:5002
}
}
60 changes: 44 additions & 16 deletions docker-compose-test.yaml
Original file line number Diff line number Diff line change
@@ -1,36 +1,60 @@
services:
fishjam:
image: "ghcr.io/fishjam-cloud/fishjam:${TAG:-edge-88258de-1764324482}"
image: ghcr.io/fishjam-cloud/fishjam:edge
container_name: fishjam
restart: on-failure
healthcheck:
test: >
curl --fail-with-body -H "Authorization: Bearer 12345" http://fishjam:5002/admin/health
curl --fail-with-body -H "Authorization: Bearer admin"
http://fishjam:5002/admin/health || exit 1
interval: 3s
retries: 2
timeout: 2s
start_period: 30s
environment:
FJ_HOST: "fishjam:5002"
FJ_ADMIN_TOKEN: "12345"
FJ_ADMIN_TOKEN: "admin"
FJ_PORT: 5002
FJ_SECRET_KEY_BASE: "super-secret-key"
FJ_TEST_USER_TOKEN: "development"
FJ_CHECK_ORIGIN: "false"
# Fisthank
FJ_FISHTANK_TOKEN: "foo"
FJ_FISHTANK_ADDRESS: fishtank:50051
# Broadcaster
FJ_BROADCASTING_ENABLED: "true"
FJ_BROADCASTER_URL: "http://broadcaster:4000"
FJ_BROADCASTER_TOKEN: "broadcaster_token"
FJ_BROADCASTER_WHIP_TOKEN: "whip_token"
# Dev
LOG_LEVEL: "debug"

ports:
- "5002:5002"
- "49999:49999"
- "50000-50050:50000-50050/udp"

fishjam-prep:
image: curlimages/curl:8.12.1
command: >
curl --fail-with-body -H "Authorization: Bearer 12345" -XPOST http://fishjam:5002/admin/user --json '{"id": "testuser", "token": "development"}'
depends_on:
fishjam:
condition: service_healthy
fishtank:
image: ghcr.io/fishjam-cloud/fishtank:edge
container_name: fishtank
restart: on-failure
environment:
FT_FISHJAM_NOTIFICATIONS_ENDPOINT: http://fishjam:5002/notifications/fishtank
FT_FISHJAM_TOKEN: "foo"
FT_STRUCTURED_LOGGING: true
healthcheck:
interval: 3s
retries: 2
timeout: 2s
start_period: 30s
ports:
- "8080:8080"

caddy:
image: caddy
container_name: caddy
restart: unless-stopped
ports:
- 5555:5555
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro

test:
container_name: test
Expand All @@ -39,9 +63,13 @@ services:
dockerfile: tests/Dockerfile
args:
PYTHON_VERSION: ${PYTHON_VERSION:-3.11}
command: uv run pytest
command: uv run pytest -s -vv
environment:
DOCKER_TEST: "TRUE"
depends_on:
fishjam-prep:
condition: service_completed_successfully
fishtank:
condition: service_healthy
fishjam:
condition: service_healthy
caddy:
condition: service_started
4 changes: 2 additions & 2 deletions tests/agent/test_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
)
from fishjam.events.allowed_notifications import AllowedNotification

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


Expand Down
4 changes: 2 additions & 2 deletions tests/test_notifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
from tests.support.peer_socket import PeerSocket
from tests.support.webhook_notifier import run_server

HOST = "fishjam" if os.getenv("DOCKER_TEST") == "TRUE" else "localhost"
FISHJAM_URL = f"http://{HOST}:5002"
FISHJAM_HOST = "caddy" if os.getenv("DOCKER_TEST") == "TRUE" else "localhost"
FISHJAM_URL = f"http://{FISHJAM_HOST}:5555"
FISHJAM_ID = FISHJAM_URL
SERVER_API_TOKEN = os.getenv("MANAGEMENT_TOKEN", "development")
WEBHOOK_ADDRESS = "test" if os.getenv("DOCKER_TEST") == "TRUE" else "localhost"
Expand Down
16 changes: 9 additions & 7 deletions tests/test_room_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
VideoCodec,
)

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

MAX_PEERS = 10
Expand Down Expand Up @@ -64,7 +64,7 @@ def test_no_params(self, room_api: FishjamClient):
room = room_api.create_room()

config = RoomConfig(
max_peers=None,
max_peers=0,
webhook_url=None,
room_type=RoomType(CONFERENCE),
video_codec=VideoCodec.H264,
Expand Down Expand Up @@ -127,7 +127,9 @@ def test_invalid_id(self, room_api: FishjamClient):

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


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

config = RoomConfig(
max_peers=None,
max_peers=0,
webhook_url=None,
room_type=RoomType(CONFERENCE),
video_codec=VideoCodec.H264,
Expand Down Expand Up @@ -261,7 +263,7 @@ def test_valid(self, room_api: FishjamClient):
def test_invalid(self, room_api: FishjamClient):
room = room_api.create_room()

with pytest.raises(BadRequestError):
with pytest.raises(NotFoundError):
room_api.create_livestream_viewer_token(room.id)


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

with pytest.raises(BadRequestError):
with pytest.raises(NotFoundError):
room_api.create_livestream_streamer_token(room.id)