11from __future__ import annotations
22
3+ import os
34import socket
45from concurrent .futures import ThreadPoolExecutor
56from socket import AddressFamily , SocketKind
@@ -129,8 +130,11 @@ def test_url_resolver(
129130 ],
130131)
131132def 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" )
133+ if dns_url .startswith ("doq" ):
134+ if QUICResolver is _MISSING_QUIC_SENTINEL :
135+ pytest .skip ("Test requires qh3 installed" )
136+ if os .environ .get ("CI" ):
137+ pytest .skip ("DoQ unreliable in CI (adguard unreachable)" )
134138
135139 resolver = ResolverDescription .from_url (dns_url ).new ()
136140
@@ -168,8 +172,11 @@ def test_1_1_1_1_ipv4_resolution_across_protocols(dns_url: str) -> None:
168172 ],
169173)
170174def 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" )
175+ if dns_url .startswith ("doq" ):
176+ if QUICResolver is _MISSING_QUIC_SENTINEL :
177+ pytest .skip ("Test requires qh3 installed" )
178+ if os .environ .get ("CI" ):
179+ pytest .skip ("DoQ unreliable in CI (adguard unreachable)" )
173180
174181 resolver = ResolverDescription .from_url (dns_url ).new ()
175182
@@ -292,8 +299,11 @@ def test_many_resolver_host_constraint_distribution() -> None:
292299 ],
293300)
294301def 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" )
302+ if dns_url .startswith ("doq" ):
303+ if QUICResolver is _MISSING_QUIC_SENTINEL :
304+ pytest .skip ("Test requires qh3 installed" )
305+ if os .environ .get ("CI" ):
306+ pytest .skip ("DoQ unreliable in CI (adguard unreachable)" )
297307
298308 resolver = ResolverDescription .from_url (dns_url ).new ()
299309
@@ -376,8 +386,11 @@ def test_doh_rfc8484(dns_url: str) -> None:
376386 ],
377387)
378388def 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" )
389+ if dns_url .startswith ("doq" ):
390+ if QUICResolver is _MISSING_QUIC_SENTINEL :
391+ pytest .skip ("Test requires qh3 installed" )
392+ if os .environ .get ("CI" ):
393+ pytest .skip ("DoQ unreliable in CI (adguard unreachable)" )
381394
382395 resolver = ResolverDescription .from_url (dns_url ).new ()
383396
@@ -478,8 +491,11 @@ def _run(
478491 ],
479492)
480493def 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" )
494+ if dns_url .startswith ("doq" ):
495+ if QUICResolver is _MISSING_QUIC_SENTINEL :
496+ pytest .skip ("Test requires qh3 installed" )
497+ if os .environ .get ("CI" ):
498+ pytest .skip ("DoQ unreliable in CI (adguard unreachable)" )
483499
484500 resolver = ResolverDescription .from_url (dns_url ).new ()
485501
@@ -513,8 +529,11 @@ def test_resolver_recycle(dns_url: str) -> None:
513529 ],
514530)
515531def 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" )
532+ if dns_url .startswith ("doq" ):
533+ if QUICResolver is _MISSING_QUIC_SENTINEL :
534+ pytest .skip ("Test requires qh3 installed" )
535+ if os .environ .get ("CI" ):
536+ pytest .skip ("DoQ unreliable in CI (adguard unreachable)" )
518537
519538 resolver = ResolverDescription .from_url (dns_url ).new ()
520539
@@ -537,8 +556,11 @@ def test_resolve_cannot_recycle_when_available(dns_url: str) -> None:
537556)
538557def test_ipv6_always_preferred (dns_url : str ) -> None :
539558 """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" )
559+ if dns_url .startswith ("doq" ):
560+ if QUICResolver is _MISSING_QUIC_SENTINEL :
561+ pytest .skip ("Test requires qh3 installed" )
562+ if os .environ .get ("CI" ):
563+ pytest .skip ("DoQ unreliable in CI (adguard unreachable)" )
542564
543565 resolver = ResolverDescription .from_url (dns_url ).new ()
544566
@@ -574,8 +596,11 @@ def test_ipv6_always_preferred(dns_url: str) -> None:
574596)
575597def test_dgram_upgrade (dns_url : str ) -> None :
576598 """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" )
599+ if dns_url .startswith ("doq" ):
600+ if QUICResolver is _MISSING_QUIC_SENTINEL :
601+ pytest .skip ("Test requires qh3 installed" )
602+ if os .environ .get ("CI" ):
603+ pytest .skip ("DoQ unreliable in CI (adguard unreachable)" )
579604
580605 resolver = ResolverDescription .from_url (dns_url ).new ()
581606
0 commit comments