Bug #13864
closedRinda multicast test failures due to missing default route
Description
Trying to build Ruby for Fedora, we are using tool called mock 1. This tools allows to execute the build in container, using systemd-nspawn on background 2 and this in turn allows the container to be isolated from network 3. However, in this setup, there are some Rinda multicast test failures:
$ sudo systemd-nspawn '-D' '/var/lib/mock/fedora-rawhide-x86_64/root' --private-network
Spawning container root on /var/lib/mock/fedora-rawhide-x86_64/root.
Press ^] three times within 1s to kill container.
-bash: cannot set terminal process group (-1): Inappropriate ioctl for device
-bash: no job control in this shell
-bash-4.4# su - mockbuild
-bash: cannot set terminal process group (1): Inappropriate ioctl for device
-bash: no job control in this shell
[mockbuild@root ~]$ cd /mnt/
[mockbuild@root mnt]$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
[mockbuild@root ~]$ ip route
[mockbuild@root mnt]$
Run options:
# Running tests:
[ 1/39] Rinda::TestRingFinger#test_make_socket_ipv4_multicast = 0.00 s
1) Error:
Rinda::TestRingFinger#test_make_socket_ipv4_multicast:
Errno::ENETUNREACH: Network is unreachable - connect(2) for 239.0.0.1:7647
/usr/share/ruby/rinda/ring.rb:431:in `connect'
/usr/share/ruby/rinda/ring.rb:431:in `make_socket'
test/rinda/test_rinda.rb:804:in `test_make_socket_ipv4_multicast'
[ 2/39] Rinda::TestRingFinger#test_make_socket_ipv4_multicast_hops = 0.00 s
2) Error:
Rinda::TestRingFinger#test_make_socket_ipv4_multicast_hops:
Errno::ENETUNREACH: Network is unreachable - connect(2) for 239.0.0.1:7647
/usr/share/ruby/rinda/ring.rb:431:in `connect'
/usr/share/ruby/rinda/ring.rb:431:in `make_socket'
test/rinda/test_rinda.rb:821:in `test_make_socket_ipv4_multicast_hops'
[ 8/39] Rinda::TestRingServer#test_make_socket_ipv4_multicast = 0.00 s
3) Error:
Rinda::TestRingServer#test_make_socket_ipv4_multicast:
Errno::ENODEV: No such device - setsockopt(2)
/usr/share/ruby/rinda/ring.rb:154:in `setsockopt'
/usr/share/ruby/rinda/ring.rb:154:in `make_socket'
test/rinda/test_rinda.rb:647:in `test_make_socket_ipv4_multicast'
[11/39] Rinda::TestRingServer#test_ring_server_ipv4_multicast = 0.00 s
4) Error:
Rinda::TestRingServer#test_ring_server_ipv4_multicast:
Errno::ENODEV: No such device - setsockopt(2)
/usr/share/ruby/rinda/ring.rb:154:in `setsockopt'
/usr/share/ruby/rinda/ring.rb:154:in `make_socket'
/usr/share/ruby/rinda/ring.rb:108:in `block in initialize'
/usr/share/ruby/rinda/ring.rb:106:in `each'
/usr/share/ruby/rinda/ring.rb:106:in `initialize'
test/rinda/test_rinda.rb:689:in `new'
test/rinda/test_rinda.rb:689:in `test_ring_server_ipv4_multicast'
Leaked file descriptor: Rinda::TestRingServer#test_ring_server_ipv4_multicast: 10 : #<Socket:fd 10>
Closed file descriptor: Rinda::TestRingServer#test_ring_server_ipv6_multicast: 10
Finished tests in 0.977804s, 39.8853 tests/s, 266.9247 assertions/s.
39 tests, 261 assertions, 0 failures, 4 errors, 4 skips
ruby -v: ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
As you can see from the output, there is only loopback device and no default route specified. If I added the default route via ip route add default via 127.0.0.1
, the tests would succeed.
Now, there are several possibilities to narrow this, not really sure which I should choose:
- Just disable the tests in Fedora.
- Add the default route.
- It could be possible to detect this scenario and skip the tests either by the test suite or by the build script.
- The Rinda::RingServer#make_socket actually allows to specify interface, so if that is explicitly specified to '127.0.0.1', the test could be made to pass, but Rinda::RingFinger#make_socket does not support this :/
I should also note, that it seems that systemd guys don't intend to add the default route while mock upstream considers the option to make it available 4, but this involves some hackery. So I thought I'll ask here ...