safety catch for --cpus so it isn't higher than actual CPUs

This commit is contained in:
Hans-Christoph Steiner 2025-10-28 07:40:12 +01:00
parent 8421d61369
commit 950efbbb45
2 changed files with 19 additions and 6 deletions

View file

@ -145,6 +145,16 @@ class Up_run_vagrant(UpTest):
class Up_options(UpTest):
def test_get_virt_cpus_opt_default(self):
self.assertTrue(up.get_virt_cpus_opt(None) > 0)
def test_get_virt_cpus_opt_too_small(self):
self.assertTrue(up.get_virt_cpus_opt(0.1) > 0)
def test_get_virt_cpus_opt_too_big(self):
with self.assertLogs():
self.assertEqual(up.get_virt_cpus_opt(99999999), os.cpu_count())
def test_get_virt_memory_opt_default(self):
self.assertEqual(up.get_virt_memory_opt(None), 6 * 1024**3)