Skip to content
Merged
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
2 changes: 2 additions & 0 deletions projects/fal/src/fal/toolkit/file/_local_uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
if TYPE_CHECKING:
import httpx

# Keep in sync with infra/modules/nomad_jobs/jobs.tf and isolate-cloud's
# projects/isolate_controller/src/isolate_controller/scheduler/nomad/forger.py.
DEFAULT_SOCKET_PATH = "/run/fal-upload/upload.sock"
_TIMEOUT = 300
_CONNECT_TIMEOUT = 5
Expand Down
16 changes: 16 additions & 0 deletions projects/fal/tests/unit/toolkit/file/test_local_uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,22 @@
STARTED = {**ACCEPTED, "upload_id": "session-id", "state": "receiving"}


@pytest.mark.parametrize("socket_path", [None, "/tmp/custom-uploader.sock"])
def test_client_socket_path(monkeypatch, socket_path):
monkeypatch.delenv("CDN_UPLOADER_SOCKET_PATH", raising=False)
if socket_path is not None:
monkeypatch.setenv("CDN_UPLOADER_SOCKET_PATH", socket_path)
transport = Mock(wraps=httpx.HTTPTransport)
monkeypatch.setattr(httpx, "HTTPTransport", transport)

with _local_uploader._new_client():
pass

assert transport.call_args.kwargs["uds"] == (
socket_path if socket_path is not None else "/run/fal-upload/upload.sock"
)


@pytest.fixture
def transport(monkeypatch):
requests = []
Expand Down
Loading