summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli/test_container.py
diff options
context:
space:
mode:
authorNicolas Vollmar <nvollmar@gmail.com>2025-09-08 07:24:38 +0200
committerNicolas Vollmar <nvollmar@gmail.com>2025-10-23 20:32:14 +0200
commitbd3070477804ed03e356d95e8c619fe7580b9231 (patch)
tree302c03fdcfd9daeb41dc31769e197985ee403b09 /smoketest/scripts/cli/test_container.py
parentc284938df61b5e970dd13cde03e0693254e89211 (diff)
downloadvyos-1x-bd3070477804ed03e356d95e8c619fe7580b9231.tar.gz
vyos-1x-bd3070477804ed03e356d95e8c619fe7580b9231.zip
T6686: adds container health checks
Diffstat (limited to 'smoketest/scripts/cli/test_container.py')
-rwxr-xr-xsmoketest/scripts/cli/test_container.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/smoketest/scripts/cli/test_container.py b/smoketest/scripts/cli/test_container.py
index 2317d7a4b..b41a7dd53 100755
--- a/smoketest/scripts/cli/test_container.py
+++ b/smoketest/scripts/cli/test_container.py
@@ -112,6 +112,26 @@ class TestContainer(VyOSUnitTestSHIM.TestCase):
l = cmd_to_json(f'sudo podman container inspect {cont_name}')
self.assertEqual(l['HostConfig']['LogConfig']['Type'], 'journald')
+ self.assertEqual(l['Config']['Healthcheck']['Test'], ['NONE'])
+
+ def test_healthcheck(self):
+ cont_name = 'health-test'
+
+ self.cli_set(base_path + ['name', cont_name, 'allow-host-networks'])
+ self.cli_set(base_path + ['name', cont_name, 'image', busybox_image])
+
+ self.cli_set(base_path + ['name', cont_name, 'health-check', 'command', 'true'])
+ self.cli_set(base_path + ['name', cont_name, 'health-check', 'interval', '10'])
+ self.cli_set(base_path + ['name', cont_name, 'health-check', 'timeout', '1'])
+ self.cli_set(base_path + ['name', cont_name, 'health-check', 'retry', '2'])
+ self.cli_commit()
+
+ l = cmd_to_json(f'sudo podman container inspect {cont_name}')
+ self.assertEqual(l['HostConfig']['LogConfig']['Type'], 'journald')
+ self.assertEqual(l['Config']['Healthcheck']['Test'], ['CMD-SHELL', 'true'])
+ self.assertEqual(l['Config']['Healthcheck']['Interval'], 10000000000)
+ self.assertEqual(l['Config']['Healthcheck']['Timeout'], 1000000000)
+ self.assertEqual(l['Config']['Healthcheck']['Retries'], 2)
def test_name_server(self):