summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli/test_container.py
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-05-28 21:51:17 +0200
committerGitHub <noreply@github.com>2024-05-28 21:51:17 +0200
commit9d0a453c923fe8efd5dafe6230dafe7d267aa9d6 (patch)
tree605277202acb37767fde9cced01c371d3bc8fd42 /smoketest/scripts/cli/test_container.py
parent6954288ea6b1ec7a64cec1d370f8b11884166c18 (diff)
parentd180595aff41d8c23c35937656fbc8fe4d93ad7a (diff)
downloadvyos-1x-9d0a453c923fe8efd5dafe6230dafe7d267aa9d6.tar.gz
vyos-1x-9d0a453c923fe8efd5dafe6230dafe7d267aa9d6.zip
Merge pull request #3535 from vyos/mergify/bp/sagitta/pr-3530
T6406: Container CPU limits (backport #3530)
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..90f821c60 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, 'cpu-quota', '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'