summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli/test_container.py
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2025-10-20 18:52:10 +0200
committerChristian Breunig <christian@breunig.cc>2025-10-21 21:03:16 +0200
commit4995a58f998d3bdd055e49e919945bc0aa939be4 (patch)
treee067681c524a9a9bc25f297731da6d837356193e /smoketest/scripts/cli/test_container.py
parent9e1cb14a5eb1eedd1fce67732ad84f6528e30314 (diff)
downloadvyos-1x-4995a58f998d3bdd055e49e919945bc0aa939be4.tar.gz
vyos-1x-4995a58f998d3bdd055e49e919945bc0aa939be4.zip
T7948: always call setUp() and tearDown() base class methods
While working on task T7664 (FRR 10.4 upgrade), I identified the need for additional validation and safeguards around the FRR management daemon. The most appropriate place for this logic is in the setUp() and tearDown() methods of the smoketest base class, VyOSUnitTestSHIM. However, during implementation, it became apparent that test cases do not consistently invoke the base class's setup and teardown methods. This inconsistency complicates the process of capturing the FRR mgmtd PID at the start of a test and verifying that it remains unchanged by the end - a key step in detecting crashes or unexpected terminations (e.g., SIGSEGV) of the FRR management daemon during tests.
Diffstat (limited to 'smoketest/scripts/cli/test_container.py')
-rwxr-xr-xsmoketest/scripts/cli/test_container.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/smoketest/scripts/cli/test_container.py b/smoketest/scripts/cli/test_container.py
index fd8272f44..2317d7a4b 100755
--- a/smoketest/scripts/cli/test_container.py
+++ b/smoketest/scripts/cli/test_container.py
@@ -33,13 +33,11 @@ PROCESS_PIDFILE = '/run/vyos-container-{0}.service.pid'
busybox_image = 'busybox:stable'
busybox_image_path = '/usr/share/vyos/busybox-stable.tar'
-
def cmd_to_json(command):
c = cmd(command + ' --format=json')
data = json.loads(c)[0]
return data
-
class TestContainer(VyOSUnitTestSHIM.TestCase):
@classmethod
def setUpClass(cls):
@@ -70,6 +68,8 @@ class TestContainer(VyOSUnitTestSHIM.TestCase):
# Ensure systemd units are removed
units = glob.glob('/run/systemd/system/vyos-container-*')
self.assertEqual(units, [])
+ # always forward to base class
+ super().tearDown()
def test_basic(self):
cont_name = 'c1'
@@ -242,7 +242,7 @@ class TestContainer(VyOSUnitTestSHIM.TestCase):
self.assertEqual(n['NetworkSettings']['Networks']['bridge1']['MacAddress'], '02:00:00:00:00:01')
n = cmd_to_json(f'sudo podman container inspect test2')
self.assertEqual(n['NetworkSettings']['Networks']['bridge1']['MacAddress'], '02:00:00:00:00:02')
-
+
def test_ipv4_network(self):
prefix = '192.0.2.0/24'
base_name = 'ipv4'