tests: the DoH, stress and ICE-names e2e ask for a virtual display on a Linux machine that has none; unit tests (unit.udp 173)
Run 43176569993: 19 of 19 of wrapper.e2e.doh on Linux died at the launch with "no DISPLAY environment variable specified". Those files launched a headed browser without a screen (the runner has none, and the suite runs under sudo). The other e2e launch with headless=True, which is a headed browser on an Xvfb the wrapper starts itself. A machine with a display, and Windows, are left as they are. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
47725170de
commit
302af97575
6 files changed
+74
-5
No files matched your search
@@ -3,7 +3,7 @@
|
||||
{"id": "wrapper.e2e.web", "giro": "G2", "os": ["linux", "windows"], "min_tests": 27, "exact": true, "tests": ["tests/test_networkidle_through_a_served_browser_with_routes_e2e.py", "tests/test_http3_through_the_proxy_e2e.py"], "marker": "e2e", "needs_root": false, "note": "The networkidle e2e with routes and the HTTP/3 e2e, split from wrapper.e2e.udp (about 260 s of 500 on Linux; the whole suite did not fit the 15 minutes of Windows)."},
|
||||
{"id": "wrapper.e2e.doh", "giro": "G2", "os": ["linux", "windows"], "min_tests": 19, "exact": true, "tests": ["tests/test_the_hosts_file_of_the_host_is_never_read_e2e.py", "tests/test_resolver_race_e2e.py", "tests/test_doh_under_stress_e2e.py", "tests/test_context_proxy_only_resolves_by_doh_e2e.py", "tests/test_doh_through_the_proxy_e2e.py", "tests/test_ice_names_by_the_context_proxy_e2e.py"], "marker": "e2e", "needs_root": ["linux"], "note": "Linux needs root: the resolver trap of the file (ResolverTrap) points /etc/resolv.conf at a counting resolver on port 53. Su Windows il resolver trap non gira: l'asserzione sul resolver di sistema è l'unica omessa. Run it without xdist (port 53 is one per host). On the Linux leg the gate exports INVPW_REQUIRE_TRAP=1: a trap that cannot run or bind port 53 is a failure, not a skipped assertion."},
|
||||
{"id": "wrapper.e2e.realness", "giro": "G2", "os": ["linux", "windows"], "min_tests": 32, "exact": true, "tests": ["tests/test_realness_behind_a_declared_exit_e2e.py"], "marker": "e2e", "needs_root": ["linux"], "note": "The realness check without a real proxy: six declared exits, the values a page reads, and the roads. Linux runs as root without xdist like the DoH suite (the resolver trap); on Windows the trap does not exist and the assertion on the system resolver is the only one omitted."},
|
||||
{"id": "wrapper.unit.udp", "giro": "G1", "os": ["linux", "windows"], "min_tests": 166, "exact": true, "tests": ["tests/test_the_realness_helpers.py", "tests/test_the_h3_line_helpers.py", "tests/test_the_fake_doh_delays_and_refuses.py", "tests/test_the_host_address_helper.py", "tests/test_the_udp_chain_helper.py", "tests/test_the_fake_doh_answers.py", "tests/test_doh_session_prefs_unit.py", "tests/test_the_leak_watcher_sees_a_direct_connection.py", "tests/test_the_http_proxy_helper_asks_for_credentials.py", "tests/test_every_route_command_is_answered_may_fail.py", "tests/test_the_network_declaration_reaches_the_engine.py", "tests/test_the_resolver_trap_is_required_by_the_gate.py", "tests/test_the_exit_of_a_context_is_discovered_through_its_own_gateway.py"], "marker": "unit", "needs_root": false, "note": "92 = 6+32+21+7+8+3+9+6. The leak watcher file defines exactly one of its two resolver-trap tests per host (7 everywhere), so no test is skipped. `exact`: min_tests is raised by hand when a test is added."},
|
||||
{"id": "wrapper.unit.udp", "giro": "G1", "os": ["linux", "windows"], "min_tests": 173, "exact": true, "tests": ["tests/test_the_doh_e2e_have_a_screen_on_linux.py", "tests/test_the_realness_helpers.py", "tests/test_the_h3_line_helpers.py", "tests/test_the_fake_doh_delays_and_refuses.py", "tests/test_the_host_address_helper.py", "tests/test_the_udp_chain_helper.py", "tests/test_the_fake_doh_answers.py", "tests/test_doh_session_prefs_unit.py", "tests/test_the_leak_watcher_sees_a_direct_connection.py", "tests/test_the_http_proxy_helper_asks_for_credentials.py", "tests/test_every_route_command_is_answered_may_fail.py", "tests/test_the_network_declaration_reaches_the_engine.py", "tests/test_the_resolver_trap_is_required_by_the_gate.py", "tests/test_the_exit_of_a_context_is_discovered_through_its_own_gateway.py"], "marker": "unit", "needs_root": false, "note": "92 = 6+32+21+7+8+3+9+6. The leak watcher file defines exactly one of its two resolver-trap tests per host (7 everywhere), so no test is skipped. `exact`: min_tests is raised by hand when a test is added."},
|
||||
{"id": "wrapper.e2e.page", "giro": "G2", "os": ["linux", "windows"], "min_tests": 114, "exact": true, "tests": ["tests/test_a_page_that_moves_on_e2e.py", "tests/test_a_popup_is_reported_when_the_engine_says_it_is_ready_as_playwright_does_e2e.py", "tests/test_a_popup_of_a_link_reaches_the_client_e2e.py", "tests/test_popup_destinations_e2e.py", "tests/test_popups_reach_the_client_e2e.py", "tests/test_route_superseded_e2e.py"], "marker": "e2e", "needs_root": false, "note": "114 = 100 + the 14 of test_a_page_that_moves_on_e2e.py (a navigation the page overtook with location.replace ends; the engine fix 860ef8a6d9 is proved by it). 100 counted at the collection; was 96 = 10+32+16+34+4 before the popup tests of 6200bc2). A page is handed over when the engine says Page.ready; a popup reaches the client (link, noopener, window.open; own site and another; with and without a route; in-process and over launch_server) as Playwright's does; a superseded route. Needs the candidate binary, and the stock Playwright client of the dev extra."},
|
||||
{"id": "wrapper.unit.page", "giro": "G1", "os": ["linux", "windows"], "min_tests": 34, "exact": true, "tests": ["tests/test_every_order_of_the_events_of_a_popup_gives_one_page_event.py", "tests/test_ci_drive_gate_goes_through_the_core.py", "tests/test_a_page_is_handed_over_only_when_the_engine_says_it_is_ready.py", "tests/test_a_new_page_waits_for_the_engine.py", "tests/test_page_number_follows_the_call.py"], "marker": "unit", "needs_root": false, "note": "24 (counted at the collection; was 20 = 3+8+1+8 before 6200bc2). The page dispatcher's wait for Page.ready and what it hands over; the drive gate goes through the core (the engine waits for the session's road)."}
|
||||
]
|
||||
@@ -2,10 +2,21 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import http.server
|
||||
import os
|
||||
import sys
|
||||
import threading
|
||||
|
||||
from _servers import LocalServer
|
||||
|
||||
def a_display_when_the_host_has_none() -> dict:
|
||||
"""The launch arguments that give a browser a screen on a Linux machine that has none (a CI runner, a root
|
||||
shell under ``sudo``): ``headless=True`` is a headed browser on a virtual display the wrapper starts itself. A
|
||||
machine with a display of its own, and Windows, are left as they are."""
|
||||
if sys.platform.startswith("linux") and not os.environ.get("DISPLAY"):
|
||||
return {"headless": True}
|
||||
return {}
|
||||
|
||||
|
||||
#: The zone of the FakeDoh: every name a test uses, all pointing at the loopback where the page server is.
|
||||
ZONE = {"page-a.test": "127.0.0.1", "page-b.test": "127.0.0.1", "page-c.test": "127.0.0.1",
|
||||
"stun-a.test": "127.0.0.1"}
|
||||
|
||||
@@ -83,7 +83,7 @@ import _trap_policy
|
||||
from _doh_servers import DOH_BOOTSTRAP, DOH_HOST, DOH_PORT, DOH_PROVIDER_PREFS, QTYPE_A, DohGateway, FakeDoh
|
||||
from _http_proxy import HttpProxy, basic
|
||||
from _leaks import ResolverTrap, Watcher
|
||||
from _doh_support import ZONE, Pages # noqa: F401 (Pages and ZONE are imported by name by the sibling tests)
|
||||
from _doh_support import ZONE, Pages, a_display_when_the_host_has_none # noqa: F401 (Pages and ZONE are imported by name by the sibling tests)
|
||||
from _servers import LocalServer # noqa: F401
|
||||
|
||||
pytestmark = [pytest.mark.e2e, pytest.mark.usefixtures("the_udp_line")]
|
||||
@@ -119,7 +119,8 @@ def _hermetic_session(monkeypatch):
|
||||
|
||||
# --------------------------------------------------------------------------------------------------------- helpers
|
||||
def _launch(binary, proxy, **kwargs):
|
||||
return InvisiblePlaywright(seed=42, binary_path=binary, proxy=proxy, extra_prefs=dict(PREFS), **kwargs)
|
||||
return InvisiblePlaywright(seed=42, binary_path=binary, proxy=proxy, extra_prefs=dict(PREFS),
|
||||
**{**a_display_when_the_host_has_none(), **kwargs})
|
||||
|
||||
|
||||
def _page_in(browser, proxy=None):
|
||||
|
||||
@@ -64,9 +64,11 @@ SHORT_NEGATIVE_CACHE = {"network.dnsNegativeCacheExpiration": 1, "network.dnsNeg
|
||||
|
||||
def _launch_with_a_short_negative_cache(binary):
|
||||
"""A session without a launch proxy (the proxy is the context's) whose DNS negative cache is 1 s."""
|
||||
from _doh_support import a_display_when_the_host_has_none
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
from test_doh_through_the_proxy_e2e import PREFS
|
||||
return InvisiblePlaywright(seed=42, binary_path=binary, proxy=None, extra_prefs={**PREFS, **SHORT_NEGATIVE_CACHE})
|
||||
return InvisiblePlaywright(seed=42, binary_path=binary, proxy=None, extra_prefs={**PREFS, **SHORT_NEGATIVE_CACHE},
|
||||
**a_display_when_the_host_has_none())
|
||||
|
||||
|
||||
def _navigate(context, url, timeout_ms):
|
||||
|
||||
@@ -85,9 +85,10 @@ def tcp_only_proxy(doh, gateway, request):
|
||||
|
||||
def _launch(binary, proxy):
|
||||
"""Like the DoH e2e's `_launch`, with the baseline's mDNS host candidates declared as the realness test does."""
|
||||
from _doh_support import a_display_when_the_host_has_none
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
return InvisiblePlaywright(seed=42, binary_path=binary, proxy=proxy,
|
||||
return InvisiblePlaywright(seed=42, binary_path=binary, proxy=proxy, **a_display_when_the_host_has_none(),
|
||||
extra_prefs={**PREFS, "media.peerconnection.ice.obfuscate_host_addresses": True})
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
"""The DoH e2e launch a browser on a Linux machine that has no screen (run 43176569993: 19 of 19 of wrapper.e2e.doh on
|
||||
Linux died at the launch with "no DISPLAY environment variable specified", under sudo and without a display).
|
||||
|
||||
Every launcher of those files asks for a virtual display when the machine has none, and leaves a machine that has one,
|
||||
and Windows, as they are. Nothing is launched here: the session object holds the answer."""
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
|
||||
import _doh_support
|
||||
import test_doh_through_the_proxy_e2e as through_the_proxy
|
||||
import test_doh_under_stress_e2e as under_stress
|
||||
import test_ice_names_by_the_context_proxy_e2e as ice_names
|
||||
|
||||
pytestmark = pytest.mark.unit
|
||||
|
||||
LAUNCHERS = {
|
||||
"the DoH e2e": lambda: through_the_proxy._launch("/nowhere/firefox", None),
|
||||
"the stress e2e": lambda: under_stress._launch_with_a_short_negative_cache("/nowhere/firefox"),
|
||||
"the ICE names e2e": lambda: ice_names._launch("/nowhere/firefox", None),
|
||||
}
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def host(monkeypatch):
|
||||
def set_host(platform, display):
|
||||
monkeypatch.setattr(sys, "platform", platform)
|
||||
if display is None:
|
||||
monkeypatch.delenv("DISPLAY", raising=False)
|
||||
else:
|
||||
monkeypatch.setenv("DISPLAY", display)
|
||||
return set_host
|
||||
|
||||
|
||||
@pytest.mark.parametrize("which", sorted(LAUNCHERS))
|
||||
def test_a_linux_host_without_a_display_gets_a_virtual_one(host, which):
|
||||
host("linux", None)
|
||||
assert LAUNCHERS[which]()._headless is True
|
||||
|
||||
|
||||
@pytest.mark.parametrize("which", sorted(LAUNCHERS))
|
||||
def test_a_linux_host_with_a_display_and_windows_are_left_as_they_are(host, which):
|
||||
host("linux", ":0")
|
||||
assert LAUNCHERS[which]()._headless is False
|
||||
host("win32", None)
|
||||
assert LAUNCHERS[which]()._headless is False
|
||||
|
||||
|
||||
def test_what_the_caller_asks_for_wins(host):
|
||||
host("linux", None)
|
||||
assert through_the_proxy._launch("/nowhere/firefox", None, headless=False)._headless is False
|
||||
assert _doh_support.a_display_when_the_host_has_none() == {"headless": True}
|
||||
Reference in new issue
Block a user