Skip to contentSkip to conversation

tests: allow to run conntrackd-tests.py via unshare

PATCH New Florian Westphal 1 participant 1 message Apr 29 netfilter

lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

PATCH 1/1 tests: allow to run conntrackd-tests.py via unshare

Minor tweak, set lo to up so this works when run as:
unshare -n ./conntrackd-tests.py

Also allow the script to exit(1) in case there are failures so CI pipeline doesn't have to screen-scrape for errors.

---
 tests/conntrackd/conntrackd-tests.py | 4 ++++
 tests/conntrackd/tests.yaml          | 1 +
 2 files changed, 5 insertions(+)
tests/conntrackd/conntrackd-tests.py +4 -0
index f760351d6342..25ebda2a0e59 100755
@@ -185,6 +185,10 @@ def stage_report():
     logging.info("--- failed tests: {}".format(ctx.counter_test_failed))
     logging.info("--- scenario failure: {}".format(ctx.counter_scenario_failed))
     logging.info("--- total tests: {}".format(total))
+    if ctx.counter_test_failed > 0:
+        exit(1)
+    if ctx.counter_test_ok == 0:
+        exit(1)
 
 
 def parse_args():
tests/conntrackd/tests.yaml +1 -0
index 307f38fee483..a19e443e6bb5 100644
@@ -78,6 +78,7 @@
         NetlinkBufferSizeMaxGrowth 8388608
       }
       EOF
+    - ip link set lo up
     - $CONNTRACKD -C /tmp/conntrackd_notrack_hash_defaults -d
     - $CONNTRACKD -C /tmp/conntrackd_notrack_hash_defaults -s | grep -q "cache"
     - $CONNTRACKD -C /tmp/conntrackd_notrack_hash_defaults -k
Signature · 1 line
2.53.0