Commit ba93d902 authored by Cédric de Saint Martin's avatar Cédric de Saint Martin

Merge branch 'slapgrid_test'

parents d722ef03 f4afcc60
......@@ -979,13 +979,10 @@ class Slapgrid(object):
report_usage_issue_cp_list.append(computer_partition_id)
for computer_partition in computer_partition_list:
computer_partition_id = computer_partition.getId()
try:
software_url = computer_partition.getSoftwareRelease().getURI()
except NotFoundError:
software_url = None
if computer_partition.getState() == "destroyed":
try:
computer_partition_id = computer_partition.getId()
software_url = computer_partition.getSoftwareRelease().getURI()
software_path = os.path.join(self.software_root,
getSoftwareUrlHash(software_url))
local_partition = Partition(
......
......@@ -134,6 +134,12 @@ class ISoftwareRelease(IBuildoutController):
Returns a string representing the uri of the software release.
"""
def getComputerId():
"""
Returns a string representing the identifier of the computer where the SR
is installed.
"""
def getState():
"""
Returns a string representing the expected state of the software
......
......@@ -273,11 +273,14 @@ class TestComputer(SlapMixin):
partition_id)
self.assertEqual(self.computer.getComputerPartitionList(), [])
@unittest.skip("Not implemented")
def test_computer_reportUsage_non_valid_xml_raises(self):
"""
Asserts that calling Computer.reportUsage with non DTD
(not defined yet) XML raises (not defined yet) exception
"""
self.computer_guid = self._getTestComputerId()
self.slap = slapos.slap.slap()
self.slap.initializeConnection(self.server_url)
......@@ -288,6 +291,7 @@ class TestComputer(SlapMixin):
self.assertRaises(UndefinedYetException, self.computer.reportUsage,
non_dtd_xml)
@unittest.skip("Not implemented")
def test_computer_reportUsage_valid_xml_invalid_partition_raises(self):
"""
Asserts that calling Computer.reportUsage with DTD (not defined
......@@ -675,7 +679,6 @@ class TestOpenOrder(SlapMixin):
requested_partition_id = 'PARTITION_01'
def server_response(self, path, method, body, header):
parsed_url = urlparse.urlparse(path.lstrip('/'))
parsed_qs = urlparse.parse_qs(parsed_url.query)
from slapos.slap.slap import SoftwareInstance
slap_partition = SoftwareInstance(
slap_computer_id=computer_guid,
......
......@@ -205,11 +205,12 @@ class TestComputer(SlapformatMixin):
computer = slapos.format.Computer('computer')
self.assertEqual(computer.getAddress(), {'netmask': None, 'addr': None})
@unittest.skip("Not implemented")
def test_construct_empty(self):
computer = slapos.format.Computer('computer')
computer.construct()
raise NotImplementedError
@unittest.skip("Not implemented")
def test_construct_empty_prepared(self):
computer = slapos.format.Computer('computer',
interface=slapos.format.Interface('bridge', '127.0.0.1/16'))
......@@ -244,6 +245,7 @@ class TestComputer(SlapformatMixin):
'ip addr list bridge',],
self.fakeCallAndRead.external_command_list)
@unittest.skip("Not implemented")
def test_construct_empty_prepared_no_alter_network(self):
computer = slapos.format.Computer('computer',
interface=slapos.format.Interface('bridge', '127.0.0.1/16'))
......@@ -279,6 +281,7 @@ class TestComputer(SlapformatMixin):
],
self.fakeCallAndRead.external_command_list)
@unittest.skip("Not implemented")
def test_construct_prepared(self):
computer = slapos.format.Computer('computer',
interface=slapos.format.Interface('bridge', '127.0.0.1/16'))
......@@ -330,6 +333,8 @@ class TestComputer(SlapformatMixin):
computer.software_root = '/software_root'
partition = slapos.format.Partition('partition', '/part_path',
slapos.format.User('testuser'), [], None)
global USER_LIST
USER_LIST=['testuser']
partition.tap = slapos.format.Tap('tap')
computer.partition_list = [partition]
global INTERFACE_DICT
......@@ -361,6 +366,7 @@ class TestComputer(SlapformatMixin):
],
self.fakeCallAndRead.external_command_list)
@unittest.skip("Not implemented")
def test_construct_prepared_no_alter_network(self):
computer = slapos.format.Computer('computer',
interface=slapos.format.Interface('bridge', '127.0.0.1/16'))
......@@ -389,15 +395,15 @@ class TestComputer(SlapformatMixin):
],
self.test_result.bucket)
self.assertEqual([
# 'ip addr list bridge',
# 'ip addr list bridge',
'groupadd slapsoft',
'useradd -d /software_root -g slapsoft -s /bin/false slapsoft -r',
'groupadd testuser',
'useradd -d /instance_root/partition -g testuser -s /bin/false -G slapsoft testuser -r',
# 'ip addr add ip/255.255.255.255 dev bridge',
# 'ip addr list bridge',
# 'ip addr add ip/ffff:ffff:ffff:ffff:: dev bridge',
# 'ip addr list bridge',
# 'ip addr add ip/255.255.255.255 dev bridge',
# 'ip addr list bridge',
# 'ip addr add ip/ffff:ffff:ffff:ffff:: dev bridge',
# 'ip addr list bridge',
],
self.fakeCallAndRead.external_command_list)
......
......@@ -1415,6 +1415,7 @@ exit 0""" % {'worked_file': worked_file, 'lockfile': lockfile})
self.assertEquals(self.error, 1)
self.assertFalse(self.started)
@unittest.skip("Not implemented")
def test_slapgrid_processes_partition_after_global_timeout(self):
"""
Test that slapgrid processes again partition after delay defined by
......@@ -1423,6 +1424,7 @@ exit 0""" % {'worked_file': worked_file, 'lockfile': lockfile})
# XXX Not implemented
pass
@unittest.skip("Not implemented")
def test_slapgrid_processes_partition_after_timeout_defined_by_software_release(self):
"""
Test that if SR of instance defines a "buildotu delay", slapgrid processes
......
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