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
22 changes: 22 additions & 0 deletions launch/core/platforms/windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,20 @@
import queue
import uuid


# Go integration tests use ``fakerepo`` as a deliberately unreachable local
# registry. Keep it off the evaluator's outbound proxy so the test observes
# the expected direct socket error instead of a proxy-generated EOF.
DEFAULT_WINDOWS_CONTAINER_NO_PROXY = "localhost,127.0.0.1,::1,fakerepo"


def get_windows_container_no_proxy() -> str:
"""Return the container proxy bypass list, honoring an explicit override."""
return os.environ.get(
"SWE_WINDOWS_CONTAINER_NO_PROXY", DEFAULT_WINDOWS_CONTAINER_NO_PROXY
)


import docker
from docker.models.containers import Container

Expand Down Expand Up @@ -159,6 +173,14 @@ def _start_container(
detach=True,
environment={
"TERM": "xterm-mono",
# The proxy is optional. When enabled, ensure local test
# endpoints still use direct networking semantics.
**({
"HTTP_PROXY": os.environ.get("SWE_WINDOWS_CONTAINER_PROXY"),
"HTTPS_PROXY": os.environ.get("SWE_WINDOWS_CONTAINER_PROXY"),
"ALL_PROXY": os.environ.get("SWE_WINDOWS_CONTAINER_PROXY"),
"NO_PROXY": get_windows_container_no_proxy(),
} if os.environ.get("SWE_WINDOWS_CONTAINER_PROXY") else {}),
},
working_dir=working_dir,
extra_hosts=extra_hosts,
Expand Down
15 changes: 14 additions & 1 deletion tests/runtime_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@

from launch.core.runtime import SetupRuntime
from launch.core.platforms.linux import LinuxRuntime
from launch.core.platforms.windows import WindowsRuntime
from launch.core.platforms.windows import (
DEFAULT_WINDOWS_CONTAINER_NO_PROXY,
WindowsRuntime,
get_windows_container_no_proxy,
)
from launch.core.platforms.android import AndroidRuntime
#from launch.core.platforms.macos import MacosRuntime

Expand All @@ -66,6 +70,15 @@ class FakeSocket:
pass


def test_windows_container_no_proxy_default_and_override(monkeypatch):
monkeypatch.delenv("SWE_WINDOWS_CONTAINER_NO_PROXY", raising=False)
assert get_windows_container_no_proxy() == DEFAULT_WINDOWS_CONTAINER_NO_PROXY
assert "fakerepo" in DEFAULT_WINDOWS_CONTAINER_NO_PROXY.split(",")

monkeypatch.setenv("SWE_WINDOWS_CONTAINER_NO_PROXY", "custom.local")
assert get_windows_container_no_proxy() == "custom.local"


class FakeContainer:
def __init__(self, sock: FakeSocket):
self.sock = sock
Expand Down