Commit 14dc7d72 authored by Tomáš Peterka's avatar Tomáš Peterka

Update slapformat test to reflect changes in slapos.format

parent fc204fb0
...@@ -186,6 +186,7 @@ class SlaposUtilMock: ...@@ -186,6 +186,7 @@ class SlaposUtilMock:
class CGroupManagerMock(slapos.format.CGroupManager): class CGroupManagerMock(slapos.format.CGroupManager):
short_name = 'cgroup_mock'
cpuset_path = "/tmp/cpuset/" cpuset_path = "/tmp/cpuset/"
task_write_mode = "at" # append insted of write tasks PIDs for the tests task_write_mode = "at" # append insted of write tasks PIDs for the tests
...@@ -193,6 +194,9 @@ class CGroupManagerMock(slapos.format.CGroupManager): ...@@ -193,6 +194,9 @@ class CGroupManagerMock(slapos.format.CGroupManager):
"""Always allowed.""" """Always allowed."""
return True return True
# update available managers with our partially-mocked version
slapos.format.available_managers[CGroupManagerMock.short_name] = CGroupManagerMock
class SlapformatMixin(unittest.TestCase): class SlapformatMixin(unittest.TestCase):
# keep big diffs # keep big diffs
...@@ -701,7 +705,7 @@ class TestComputerWithCGroup(SlapformatMixin): ...@@ -701,7 +705,7 @@ class TestComputerWithCGroup(SlapformatMixin):
slapos.format.Partition( slapos.format.Partition(
'partition', '/tmp/slapgrid/instance_root/part1', slapos.format.User('testuser'), [], tap=None), 'partition', '/tmp/slapgrid/instance_root/part1', slapos.format.User('testuser'), [], tap=None),
], ],
manager_list=(CGroupManagerMock, ) managers=(CGroupManagerMock.short_name, )
) )
# self.patchOs(self.logger) # self.patchOs(self.logger)
...@@ -715,7 +719,7 @@ class TestComputerWithCGroup(SlapformatMixin): ...@@ -715,7 +719,7 @@ class TestComputerWithCGroup(SlapformatMixin):
def test_positive_cgroups(self): def test_positive_cgroups(self):
"""Positive test of cgroups.""" """Positive test of cgroups."""
# Test parsing "cpuset.cpus" file # Test parsing "cpuset.cpus" file
self.assertEqual(self.computer.manager_list[0]._cpu_list(), self.cpu_list) self.assertEqual(self.computer._manager_list[0]._cpu_list(), self.cpu_list)
# This should created per-cpu groups and move all tasks in CPU pool into cpu0 # This should created per-cpu groups and move all tasks in CPU pool into cpu0
self.computer.format(alter_network=False, alter_user=False) self.computer.format(alter_network=False, alter_user=False)
# Test files creation for exclusive CPUs # Test files creation for exclusive CPUs
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment