Commit 03828c2d authored by Łukasz Nowak's avatar Łukasz Nowak

Check that empty computer can be constructed.

parent 6c493099
...@@ -22,6 +22,7 @@ call_and_read_list = [] ...@@ -22,6 +22,7 @@ call_and_read_list = []
def fakeCallAndRead(argument_list, raise_on_error=True): def fakeCallAndRead(argument_list, raise_on_error=True):
global call_and_read_list global call_and_read_list
call_and_read_list.append(argument_list) call_and_read_list.append(argument_list)
return 0, 'UP'
class LoggableWrapper: class LoggableWrapper:
def __init__(self, logger, name): def __init__(self, logger, name):
...@@ -43,7 +44,7 @@ class GrpMock: ...@@ -43,7 +44,7 @@ class GrpMock:
class PwdMock: class PwdMock:
@classmethod @classmethod
def getpwnam(self, name): def getpwnam(self, name):
if name == 'testuser': if name in ['testuser', 'slapsoft']:
class result: class result:
pw_uid = 0 pw_uid = 0
pw_gid = 0 pw_gid = 0
...@@ -127,6 +128,19 @@ class TestComputer(SlapformatMixin): ...@@ -127,6 +128,19 @@ class TestComputer(SlapformatMixin):
computer = slapos.format.Computer('computer') computer = slapos.format.Computer('computer')
computer.construct() computer.construct()
def test_construct_empty_prepared(self):
computer = slapos.format.Computer('computer',
bridge=slapos.format.Bridge('bridge', '127.0.0.1/16', 'eth0'))
computer.instance_root = '/instance_root'
computer.software_root = '/software_root'
computer.construct()
self.assertEqual([
"makedirs('/instance_root', 493)",
"makedirs('/software_root', 493)",
"chown('/software_root', 0, 0)",
"chmod('/software_root', 493)"],
self.test_result.bucket)
class TestPartition(SlapformatMixin): class TestPartition(SlapformatMixin):
def test_createPath(self): def test_createPath(self):
......
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