Answer architecture round 2: 0 🔴, 1 🟡 (0 misread); capped adds only the limit a container lacks and removes only an unset or unlimited swap, so a size in the container's own command stays
This commit is contained in:
@@ -16,11 +16,12 @@ class Capped(unittest.TestCase):
|
||||
|
||||
def test_a_container_s_own_limit_is_kept_and_sets_the_limit_it_lacks(self):
|
||||
for given, expected in [
|
||||
(["run", "-m", "10g", "img"], ["run", "--memory", "10g", "--memory-swap", "10g", "img"]),
|
||||
(["run", "--memory=12g", "img"], ["run", "--memory", "12g", "--memory-swap", "12g", "img"]),
|
||||
(["run", "-m", "10g", "img"], ["run", "--memory-swap", "10g", "-m", "10g", "img"]),
|
||||
(["run", "--memory=12g", "img"], ["run", "--memory-swap", "12g", "--memory=12g", "img"]),
|
||||
(["run", "--memory-swap", "2g", "img"], ["run", "--memory", "2g", "--memory-swap", "2g", "img"]),
|
||||
(["run", "-m", "4g", "--memory-swap", "-1", "img"], ["run", "--memory", "4g", "--memory-swap", "4g", "img"]),
|
||||
(["run", "-m4g", "--memory-swap=0", "img", "python", "-m", "pytest"], ["run", "--memory", "4g", "--memory-swap", "4g", "img", "python", "-m", "pytest"]),
|
||||
(["run", "-m", "4g", "--memory-swap", "-1", "img"], ["run", "--memory-swap", "4g", "-m", "4g", "img"]),
|
||||
(["run", "-m4g", "--memory-swap=0", "img", "python", "-m", "pytest"], ["run", "--memory-swap", "4g", "-m4g", "img", "python", "-m", "pytest"]),
|
||||
(["run", "img", "app", "-m", "512m"], ["run", "--memory-swap", "512m", "img", "app", "-m", "512m"]),
|
||||
]:
|
||||
with self.subTest(given):
|
||||
self.assertEqual(capped(given, "6144m"), expected)
|
||||
|
||||
Reference in New Issue
Block a user