Hi, On 20 Oct 2023 at 09:03:07, Santiago Ruano Rincón wrote: > El 18/10/23 a las 00:56, Carles Pina i Estany escribió:
> > I've checked that no ICMP replies even using the standard ping binary > > from iputils-ping: > > ----- > > Test-Command: set +e ; ping -c 4 8.8.8.8 ; ping -c 4 example.com ; curl -s > > -I https://en.wikipedia.org ; curl -s -L https://en.wikipedia.org | head -5 > > Depends: python3-ping3, iputils-ping, curl > > Restrictions: needs-root, needs-internet > > Features: test-name=test-real-ping > > ----- > > That's in: > > https://salsa.debian.org/carlespina/python-ping3/-/blob/autopkgtest-connectivity/debian/tests/control > > > > The output: > > https://salsa.debian.org/carlespina/python-ping3/-/jobs/4822521#L213 > > > > 4 packets transmitted, 0 received, 100% packet loss, time 3059ms > > 4 packets transmitted, 0 received, 100% packet loss, time 3079ms > > ... > > AFAIU, there are network restrictions on salsa. Reaching HTTPS in the > outside world should work. But I am not sure about ICMP. > > FWIW, this is probably overengineering, but it is also possible to use > namespaces to avoid reaching INET, pinging from one namespace to the > other. > > As example: > https://salsa.debian.org/debian/isc-dhcp/-/blob/master/debian/tests/client-server I liked the idea of using namespaces! Thanks very much, I might use it in the future. Like you, I think that for python-ping3 unit tests this is overengineering (but I might play with this for python-ping3 or somehting else in the future...). In python-ping3, upstream has some IPs and hostnames hardcoded. The hostnames are easy to "tweak" via /etc/hosts (even to ping 127.0.0.1). The IPs: last night, I thought that another approach would be to use iptables (or nftables) and destination NAT. Redirect 8.8.8.8 to 127.0.0.1. It has the advantage that I could remove needs-internet, keeping all the unit tests 100% local. Cheers, -- Carles Pina i Estany https://carles.pina.cat
signature.asc
Description: PGP signature