11from __future__ import annotations
22
3+ import os
34import socket
45from concurrent .futures import ThreadPoolExecutor
56from socket import AddressFamily , SocketKind
@@ -94,6 +95,9 @@ def test_url_resolver(
9495 if expected_resolver_class is _MISSING_QUIC_SENTINEL :
9596 pytest .skip ("Test requires qh3 installed" )
9697
98+ if url .startswith ("doq://" ) and os .environ .get ("CI" , None ) is not None :
99+ pytest .skip ("Adguard unreachable in CI" )
100+
97101 if expected_resolver_class is None :
98102 with pytest .raises (
99103 (
@@ -129,8 +133,11 @@ def test_url_resolver(
129133 ],
130134)
131135def test_1_1_1_1_ipv4_resolution_across_protocols (dns_url : str ) -> None :
132- if QUICResolver is _MISSING_QUIC_SENTINEL and dns_url .startswith ("doq" ):
133- pytest .skip ("Test requires qh3 installed" )
136+ if dns_url .startswith ("doq" ):
137+ if QUICResolver is _MISSING_QUIC_SENTINEL :
138+ pytest .skip ("Test requires qh3 installed" )
139+ if os .environ .get ("CI" ):
140+ pytest .skip ("DoQ unreliable in CI (adguard unreachable)" )
134141
135142 resolver = ResolverDescription .from_url (dns_url ).new ()
136143
@@ -168,8 +175,11 @@ def test_1_1_1_1_ipv4_resolution_across_protocols(dns_url: str) -> None:
168175 ],
169176)
170177def test_dnssec_exception (dns_url : str , hostname : str , expected_failure : bool ) -> None :
171- if QUICResolver is _MISSING_QUIC_SENTINEL and dns_url .startswith ("doq" ):
172- pytest .skip ("Test requires qh3 installed" )
178+ if dns_url .startswith ("doq" ):
179+ if QUICResolver is _MISSING_QUIC_SENTINEL :
180+ pytest .skip ("Test requires qh3 installed" )
181+ if os .environ .get ("CI" ):
182+ pytest .skip ("DoQ unreliable in CI (adguard unreachable)" )
173183
174184 resolver = ResolverDescription .from_url (dns_url ).new ()
175185
@@ -292,8 +302,11 @@ def test_many_resolver_host_constraint_distribution() -> None:
292302 ],
293303)
294304def test_short_endurance_sprint (dns_url : str ) -> None :
295- if QUICResolver is _MISSING_QUIC_SENTINEL and dns_url .startswith ("doq" ):
296- pytest .skip ("Test requires qh3 installed" )
305+ if dns_url .startswith ("doq" ):
306+ if QUICResolver is _MISSING_QUIC_SENTINEL :
307+ pytest .skip ("Test requires qh3 installed" )
308+ if os .environ .get ("CI" ):
309+ pytest .skip ("DoQ unreliable in CI (adguard unreachable)" )
297310
298311 resolver = ResolverDescription .from_url (dns_url ).new ()
299312
@@ -376,8 +389,11 @@ def test_doh_rfc8484(dns_url: str) -> None:
376389 ],
377390)
378391def test_thread_safe_resolver (dns_url : str ) -> None :
379- if QUICResolver is _MISSING_QUIC_SENTINEL and dns_url .startswith ("doq" ):
380- pytest .skip ("Test requires qh3 installed" )
392+ if dns_url .startswith ("doq" ):
393+ if QUICResolver is _MISSING_QUIC_SENTINEL :
394+ pytest .skip ("Test requires qh3 installed" )
395+ if os .environ .get ("CI" ):
396+ pytest .skip ("DoQ unreliable in CI (adguard unreachable)" )
381397
382398 resolver = ResolverDescription .from_url (dns_url ).new ()
383399
@@ -478,8 +494,11 @@ def _run(
478494 ],
479495)
480496def test_resolver_recycle (dns_url : str ) -> None :
481- if QUICResolver is _MISSING_QUIC_SENTINEL and dns_url .startswith ("doq" ):
482- pytest .skip ("Test requires qh3 installed" )
497+ if dns_url .startswith ("doq" ):
498+ if QUICResolver is _MISSING_QUIC_SENTINEL :
499+ pytest .skip ("Test requires qh3 installed" )
500+ if os .environ .get ("CI" ):
501+ pytest .skip ("DoQ unreliable in CI (adguard unreachable)" )
483502
484503 resolver = ResolverDescription .from_url (dns_url ).new ()
485504
@@ -513,8 +532,11 @@ def test_resolver_recycle(dns_url: str) -> None:
513532 ],
514533)
515534def test_resolve_cannot_recycle_when_available (dns_url : str ) -> None :
516- if QUICResolver is _MISSING_QUIC_SENTINEL and dns_url .startswith ("doq" ):
517- pytest .skip ("Test requires qh3 installed" )
535+ if dns_url .startswith ("doq" ):
536+ if QUICResolver is _MISSING_QUIC_SENTINEL :
537+ pytest .skip ("Test requires qh3 installed" )
538+ if os .environ .get ("CI" ):
539+ pytest .skip ("DoQ unreliable in CI (adguard unreachable)" )
518540
519541 resolver = ResolverDescription .from_url (dns_url ).new ()
520542
@@ -537,8 +559,11 @@ def test_resolve_cannot_recycle_when_available(dns_url: str) -> None:
537559)
538560def test_ipv6_always_preferred (dns_url : str ) -> None :
539561 """Our resolvers must place IPV6 address in the beginning of returned list."""
540- if QUICResolver is _MISSING_QUIC_SENTINEL and dns_url .startswith ("doq" ):
541- pytest .skip ("Test requires qh3 installed" )
562+ if dns_url .startswith ("doq" ):
563+ if QUICResolver is _MISSING_QUIC_SENTINEL :
564+ pytest .skip ("Test requires qh3 installed" )
565+ if os .environ .get ("CI" ):
566+ pytest .skip ("DoQ unreliable in CI (adguard unreachable)" )
542567
543568 resolver = ResolverDescription .from_url (dns_url ).new ()
544569
@@ -574,8 +599,11 @@ def test_ipv6_always_preferred(dns_url: str) -> None:
574599)
575600def test_dgram_upgrade (dns_url : str ) -> None :
576601 """www.cloudflare.com records HTTPS exist, we know it. This verify that we are able to propose a DGRAM upgrade."""
577- if QUICResolver is _MISSING_QUIC_SENTINEL and dns_url .startswith ("doq" ):
578- pytest .skip ("Test requires qh3 installed" )
602+ if dns_url .startswith ("doq" ):
603+ if QUICResolver is _MISSING_QUIC_SENTINEL :
604+ pytest .skip ("Test requires qh3 installed" )
605+ if os .environ .get ("CI" ):
606+ pytest .skip ("DoQ unreliable in CI (adguard unreachable)" )
579607
580608 resolver = ResolverDescription .from_url (dns_url ).new ()
581609
0 commit comments