diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2020-06-14 23:41:57 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2020-06-15 23:49:50 +0200 |
commit | a9cadde4add151d74b64f92ebbdc56cdb7a64470 (patch) | |
tree | c3dddcf26c36ad53b47fb259c26c6260dee151be /tests/py | |
parent | 17ee0ff0af71ace44f8e48ffce5f272fb334b749 (diff) |
tests: Run in separate network namespace, don't break connectivity
It might be convenient to run tests from a development branch that
resides on another host, and if we break connectivity on the test
host as tests are executed, we can't run them this way.
If kernel implementation (CONFIG_NET_NS), unshare(1), or Python
bindings for unshare() are not available, warn and continue.
Suggested-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tests/py')
-rwxr-xr-x | tests/py/nft-test.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/py/nft-test.py b/tests/py/nft-test.py index 01ee6c98..df97ed8e 100755 --- a/tests/py/nft-test.py +++ b/tests/py/nft-test.py @@ -1394,6 +1394,12 @@ def main(): # Change working directory to repository root os.chdir(TESTS_PATH + "/../..") + try: + import unshare + unshare.unshare(unshare.CLONE_NEWNET) + except: + print_warning("cannot run in own namespace, connectivity might break") + check_lib_path = True if args.library is None: if args.host: |