test-resolved-stream: before entering user/network namespaces check if that's safe
authorLennart Poettering <lennart@poettering.net>
Fri, 1 Apr 2022 08:56:41 +0000 (10:56 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 1 Apr 2022 09:14:56 +0000 (11:14 +0200)
commited59b44309bff0039f0a41718119b305bf017140
tree18f0b694ab17128e7e1548184a46110b760d25b3
parent8419213d99369555eb767606ecd9ad8b05b9e9b8
test-resolved-stream: before entering user/network namespaces check if that's safe

I regularly run my tests also as root, since some of the tested code
uses privileged APIs. The test-resolved-stream so far tried to run its
tests in a user/network namespace if that can be allocated. This caused
the tests to fail on my system where once the user namespace is opened
access to the build tree in my $HOME is prohibited (due to restricted
access modes on my home dir). Let's add a check for that: before
actually isolating the test in a user/network namespace, let's see if
that would make it impossible for us to access the build tree (which we
need to do load the TLS certificates the test requires).

This should make the test pass when run as root from a build tree with
restrictive access mode.
src/resolve/test-resolved-stream.c