summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli/test_container.py
diff options
context:
space:
mode:
authorNicolas Vollmar <nvo@scaling.ch>2024-05-27 13:12:54 +0200
committerNicolas Vollmar <nvo@scaling.ch>2024-05-28 07:38:58 +0200
commit81dea053e7178b8fea836a85aacde2a38ffb9e09 (patch)
treed9b30716c422f33d3b84985baf30159a44625b53 /smoketest/scripts/cli/test_container.py
parent5146cb23fff56e5a84db8c84120b836ceeae47f2 (diff)
downloadvyos-1x-81dea053e7178b8fea836a85aacde2a38ffb9e09.tar.gz
vyos-1x-81dea053e7178b8fea836a85aacde2a38ffb9e09.zip
T6406: add container cpu limit option
Diffstat (limited to 'smoketest/scripts/cli/test_container.py')
-rwxr-xr-xsmoketest/scripts/cli/test_container.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/smoketest/scripts/cli/test_container.py b/smoketest/scripts/cli/test_container.py
index 3201883b8..ef31d0f6f 100755
--- a/smoketest/scripts/cli/test_container.py
+++ b/smoketest/scripts/cli/test_container.py
@@ -91,6 +91,22 @@ class TestContainer(VyOSUnitTestSHIM.TestCase):
# Check for running process
self.assertEqual(process_named_running(PROCESS_NAME), pid)
+ def test_cpu_limit(self):
+ cont_name = 'c2'
+
+ self.cli_set(base_path + ['name', cont_name, 'allow-host-networks'])
+ self.cli_set(base_path + ['name', cont_name, 'image', cont_image])
+ self.cli_set(base_path + ['name', cont_name, 'cpus', '1.25'])
+
+ self.cli_commit()
+
+ pid = 0
+ with open(PROCESS_PIDFILE.format(cont_name), 'r') as f:
+ pid = int(f.read())
+
+ # Check for running process
+ self.assertEqual(process_named_running(PROCESS_NAME), pid)
+
def test_ipv4_network(self):
prefix = '192.0.2.0/24'
base_name = 'ipv4'