Commit 9fdaa54d authored by Rafael Monnerat's avatar Rafael Monnerat

API Change: Remove available/building API from Computer Partition

  The API that notify availability and building from Computer Partition is unecessary and it's
  implementation overuse resources and cause flaky effect on the state of the Computer Partition.

  At the Software Release, the states can be available/building/error, and this state tens to be
  immutable once the software release is finished (it will be available, where building and error are
  transitory states).

  At Computer Partition, we intent to have started/stopped/destroyed instances, where available and
  building were transitory, but they have no practical function as a second report would come quickly
  after. So we may consider that started is actually same as available, in this case, it is a duplicated
  meaning, as you cannot be available w/o been started/stopped.

  computer_partition.building were never used, as the master knew that a partition is been processed,
  so this API were never used.

  Report transitory states are prevent us to determinate the actuall state, considering that the latest
  actuall state is more relevant (started/stopped/destroyed).
parent e58e8f7c
......@@ -1519,7 +1519,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
<unicode>created_at</unicode>
<unicode>%(created_at)s</unicode>
<unicode>text</unicode>
<unicode>#error while instanciating</unicode>
<unicode>#error while instanciating: The error</unicode>
<unicode>user</unicode>
<unicode>%(instance_guid)s</unicode>
</dictionary>
......@@ -1819,80 +1819,6 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
self.assertEqual([],
self.start_requested_software_instance.getPredecessorTitleList())
def test_availableComputerPartition(self):
self._makeComplexComputer()
partition_id = self.start_requested_software_instance.getAggregateValue(
portal_type='Computer Partition').getReference()
self.login(self.start_requested_software_instance.getUserId())
response = self.portal_slap.availableComputerPartition(self.computer_id,
partition_id)
self.assertEqual('None', response)
created_at = rfc1123_date(DateTime())
response = self.portal_slap.getComputerPartitionStatus(self.computer_id,
partition_id)
# check returned XML
xml_fp = StringIO.StringIO()
xml.dom.ext.PrettyPrint(xml.dom.ext.reader.Sax.FromXml(response.body),
stream=xml_fp)
xml_fp.seek(0)
got_xml = xml_fp.read()
expected_xml = """\
<?xml version='1.0' encoding='UTF-8'?>
<marshal>
<dictionary id='i2'>
<unicode>created_at</unicode>
<unicode>%(created_at)s</unicode>
<unicode>text</unicode>
<unicode>#access instance available</unicode>
<unicode>user</unicode>
<unicode>%(instance_guid)s</unicode>
</dictionary>
</marshal>
""" % dict(
created_at=created_at,
instance_guid=self.start_requested_software_instance.getReference(),
)
self.assertEqual(expected_xml, got_xml,
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def test_buildingComputerPartition(self):
self._makeComplexComputer()
partition_id = self.start_requested_software_instance.getAggregateValue(
portal_type='Computer Partition').getReference()
self.login(self.start_requested_software_instance.getUserId())
response = self.portal_slap.buildingComputerPartition(self.computer_id,
partition_id)
self.assertEqual('None', response)
created_at = rfc1123_date(DateTime())
response = self.portal_slap.getComputerPartitionStatus(self.computer_id,
partition_id)
# check returned XML
xml_fp = StringIO.StringIO()
xml.dom.ext.PrettyPrint(xml.dom.ext.reader.Sax.FromXml(response.body),
stream=xml_fp)
xml_fp.seek(0)
got_xml = xml_fp.read()
expected_xml = """\
<?xml version='1.0' encoding='UTF-8'?>
<marshal>
<dictionary id='i2'>
<unicode>created_at</unicode>
<unicode>%(created_at)s</unicode>
<unicode>text</unicode>
<unicode>building the instance</unicode>
<unicode>user</unicode>
<unicode>%(instance_guid)s</unicode>
</dictionary>
</marshal>
""" % dict(
created_at=created_at,
instance_guid=self.start_requested_software_instance.getReference(),
)
self.assertEqual(expected_xml, got_xml,
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def test_stoppedComputerPartition(self):
self._makeComplexComputer()
partition_id = self.start_requested_software_instance.getAggregateValue(
......
......@@ -47,21 +47,21 @@
<value>
<tuple>
<string>W: 28, 10: Use of eval (eval-used)</string>
<string>W:516, 13: Use of eval (eval-used)</string>
<string>W:567, 13: Use of eval (eval-used)</string>
<string>W:792, 13: Use of eval (eval-used)</string>
<string>W:1400, 13: Use of eval (eval-used)</string>
<string>W:1513, 13: Use of eval (eval-used)</string>
<string>W:1567, 13: Use of eval (eval-used)</string>
<string>W:1607, 13: Use of eval (eval-used)</string>
<string>W:2229, 13: Use of eval (eval-used)</string>
<string>W:2614, 13: Use of eval (eval-used)</string>
<string>W:2668, 13: Use of eval (eval-used)</string>
<string>W:2695, 13: Use of eval (eval-used)</string>
<string>W:2850, 13: Use of eval (eval-used)</string>
<string>W:2878, 13: Use of eval (eval-used)</string>
<string>W:2927, 13: Use of eval (eval-used)</string>
<string>W:2974, 13: Use of eval (eval-used)</string>
<string>W:529, 13: Use of eval (eval-used)</string>
<string>W:580, 13: Use of eval (eval-used)</string>
<string>W:805, 13: Use of eval (eval-used)</string>
<string>W:1422, 13: Use of eval (eval-used)</string>
<string>W:1535, 13: Use of eval (eval-used)</string>
<string>W:1589, 13: Use of eval (eval-used)</string>
<string>W:1629, 13: Use of eval (eval-used)</string>
<string>W:2177, 13: Use of eval (eval-used)</string>
<string>W:2566, 13: Use of eval (eval-used)</string>
<string>W:2620, 13: Use of eval (eval-used)</string>
<string>W:2647, 13: Use of eval (eval-used)</string>
<string>W:2804, 13: Use of eval (eval-used)</string>
<string>W:2832, 13: Use of eval (eval-used)</string>
<string>W:2881, 13: Use of eval (eval-used)</string>
<string>W:2928, 13: Use of eval (eval-used)</string>
</tuple>
</value>
</item>
......
......@@ -589,22 +589,6 @@ class SlapTool(BaseTool):
"""
return self._softwareReleaseError(url, computer_id, error_log)
security.declareProtected(Permissions.AccessContentsInformation,
'buildingComputerPartition')
def buildingComputerPartition(self, computer_id, computer_partition_id):
"""
Reports that Computer Partition is being build
"""
return self._buildingComputerPartition(computer_id, computer_partition_id)
security.declareProtected(Permissions.AccessContentsInformation,
'availableComputerPartition')
def availableComputerPartition(self, computer_id, computer_partition_id):
"""
Reports that Computer Partition is available
"""
return self._availableComputerPartition(computer_id, computer_partition_id)
security.declareProtected(Permissions.AccessContentsInformation,
'softwareInstanceError')
def softwareInstanceError(self, computer_id,
......@@ -1042,32 +1026,6 @@ class SlapTool(BaseTool):
software_installation.invalidate(
comment="Software Release destroyed report.")
@convertToREST
def _buildingComputerPartition(self, computer_id, computer_partition_id):
"""
Log the computer status
"""
instance = self._getSoftwareInstanceForComputerPartition(
computer_id,
computer_partition_id)
user = self.getPortalObject().portal_membership.getAuthenticatedMember()\
.getUserName()
self._logAccess(user, instance.getReference(),
'building the instance')
@convertToREST
def _availableComputerPartition(self, computer_id, computer_partition_id):
"""
Log the computer status
"""
instance = self._getSoftwareInstanceForComputerPartition(
computer_id,
computer_partition_id)
user = self.getPortalObject().portal_membership.getAuthenticatedMember()\
.getUserName()
self._logAccess(user, instance.getReference(),
'#access instance available')
@convertToREST
def _softwareInstanceError(self, computer_id,
computer_partition_id, error_log=""):
......@@ -1082,7 +1040,7 @@ class SlapTool(BaseTool):
computer_partition_id)
user = self.getPortalObject().portal_membership.getAuthenticatedMember()\
.getUserName()
self._logAccess(user, instance,
self._logAccess(user, instance.getReference(),
'#error while instanciating: %s' % error_log[-80:])
#return instance.reportComputerPartitionError()
......
......@@ -1091,7 +1091,6 @@ stderr_logfile_backups=1
if computer_partition_state == COMPUTER_PARTITION_STARTED_STATE:
local_partition.install()
computer_partition.available()
local_partition.start()
if self.firewall_conf:
self._setupComputerPartitionFirewall(computer_partition,
......@@ -1104,14 +1103,19 @@ stderr_logfile_backups=1
# We want to process the partition, even if stopped, because it should
# propagate the state to children if any.
local_partition.install()
computer_partition.available()
if self.firewall_conf:
self._setupComputerPartitionFirewall(computer_partition,
partition_ip_list)
finally:
# Instance has to be stopped even if buildout/reporting is wrong.
local_partition.stop()
try:
computer_partition.stopped()
except (SystemExit, KeyboardInterrupt):
computer_partition.error(traceback.format_exc(), logger=self.logger)
raise
except Exception:
pass
self._endInstallationTransaction(computer_partition)
elif computer_partition_state == COMPUTER_PARTITION_DESTROYED_STATE:
local_partition.stop()
......
......@@ -277,14 +277,6 @@ def availableSoftwareRelease():
def softwareReleaseError():
return 'Ignored'
@app.route('/buildingComputerPartition', methods=['POST'])
def buildingComputerPartition():
return 'Ignored'
@app.route('/availableComputerPartition', methods=['POST'])
def availableComputerPartition():
return 'Ignored'
@app.route('/softwareInstanceError', methods=['POST'])
def softwareInstanceError():
return 'Ignored'
......
......@@ -107,34 +107,7 @@ class IRequester(Interface):
to identify the instances.
"""
class IBuildoutController(Interface):
"""
Classes which implement IBuildoutController can report the buildout run
status to the slapgrid server.
"""
def available():
"""
Notify (to the slapgrid server) that the software instance is
available.
"""
def building():
"""
Notify (to the slapgrid server) that the buildout is not
available and under creation.
"""
def error(error_log):
"""
Notify (to the slapgrid server) that the buildout is not available
and reports an error.
error_log -- a text describing the error
It can be a traceback for example.
"""
class ISoftwareRelease(IBuildoutController):
class ISoftwareRelease(Interface):
"""
Software release interface specification
"""
......@@ -158,12 +131,33 @@ class ISoftwareRelease(IBuildoutController):
The result can be: available, destroyed
"""
def available():
"""
Notify (to the slapgrid server) that the software release is
available.
"""
def building():
"""
Notify (to the slapgrid server) that the software release is not
available and under creation.
"""
def destroyed():
"""
Notify (to the slapgrid server) that the software installation has
been correctly destroyed.
"""
def error(error_log):
"""
Notify (to the slapgrid server) that the software installation is
not available and reports an error.
error_log -- a text describing the error
It can be a traceback for example.
"""
class ISoftwareProductCollection(Interface):
"""
Fake object representing the abstract of all Software Products.
......@@ -181,7 +175,7 @@ class ISoftwareInstance(Interface):
informations about a Software Instance.
"""
class IComputerPartition(IBuildoutController, IRequester):
class IComputerPartition(IRequester):
"""
Computer Partition interface specification
......@@ -208,6 +202,16 @@ class IComputerPartition(IBuildoutController, IRequester):
been correctly destroyed.
"""
def error(error_log):
"""
Notify (to the slapgrid server) that the software instance is
not available and reports an error.
error_log -- a text describing the error
It can be a traceback for example.
"""
def getId():
"""
Returns a string representing the identifier of the computer partition
......
......@@ -475,16 +475,6 @@ class ComputerPartition(SlapRequester):
self._updateTransactionFile(partition_reference)
return self._requestComputerPartition(request_dict)
def building(self):
self._connection_helper.POST('buildingComputerPartition', data={
'computer_id': self._computer_id,
'computer_partition_id': self.getId()})
def available(self):
self._connection_helper.POST('availableComputerPartition', data={
'computer_id': self._computer_id,
'computer_partition_id': self.getId()})
def destroyed(self):
self._connection_helper.POST('destroyedComputerPartition', data={
'computer_id': self._computer_id,
......
......@@ -899,20 +899,6 @@ class TestComputerPartition(SlapMixin):
self.assertRaises(slapos.slap.NotFoundError,
getattr(computer_partition, state))
def test_available_new_ComputerPartition_raises(self):
"""
Asserts that calling ComputerPartition.available on new partition
raises (not defined yet) exception
"""
self._test_new_computer_partition_state('available')
def test_building_new_ComputerPartition_raises(self):
"""
Asserts that calling ComputerPartition.building on new partition raises
(not defined yet) exception
"""
self._test_new_computer_partition_state('building')
def test_started_new_ComputerPartition_raises(self):
"""
Asserts that calling ComputerPartition.started on new partition raises
......
......@@ -334,8 +334,6 @@ class ComputerForTest(object):
instance = self.instance_list[int(qs['computer_partition_id'][0])]
instance.sequence.append(url.path)
instance.header_list.append(req.headers)
if url.path == '/availableComputerPartition':
return {'status_code': 200}
if url.path == '/startedComputerPartition':
instance.state = 'started'
return {'status_code': 200}
......@@ -601,7 +599,7 @@ class TestSlapgridCPWithMaster(MasterMixin, unittest.TestCase):
'software_release', 'worked', '.slapos-retention-lock-delay'])
self.assertItemsEqual(os.listdir(self.software_root), [instance.software.software_hash])
self.assertEqual(computer.sequence,
['/getFullComputerInformation', '/availableComputerPartition',
['/getFullComputerInformation',
'/stoppedComputerPartition'])
def test_one_partition_instance_cfg(self):
......@@ -619,7 +617,7 @@ class TestSlapgridCPWithMaster(MasterMixin, unittest.TestCase):
'software_release', 'worked', '.slapos-retention-lock-delay'])
self.assertItemsEqual(os.listdir(self.software_root), [instance.software.software_hash])
self.assertEqual(computer.sequence,
['/getFullComputerInformation', '/availableComputerPartition',
['/getFullComputerInformation',
'/stoppedComputerPartition'])
def test_one_free_partition(self):
......@@ -653,7 +651,7 @@ class TestSlapgridCPWithMaster(MasterMixin, unittest.TestCase):
self.assertLogContent(wrapper_log, 'Working')
self.assertItemsEqual(os.listdir(self.software_root), [partition.software.software_hash])
self.assertEqual(computer.sequence,
['/getFullComputerInformation', '/availableComputerPartition',
['/getFullComputerInformation',
'/startedComputerPartition'])
self.assertEqual(partition.state, 'started')
......@@ -672,7 +670,7 @@ class TestSlapgridCPWithMaster(MasterMixin, unittest.TestCase):
self.assertLogContent(wrapper_log, 'Working')
self.assertItemsEqual(os.listdir(self.software_root), [partition.software.software_hash])
self.assertEqual(computer.sequence,
['/getFullComputerInformation', '/availableComputerPartition',
['/getFullComputerInformation',
'/startedComputerPartition'])
self.assertEqual(partition.state, 'started')
......@@ -687,7 +685,7 @@ exit 1
'etc', 'software_release', 'worked',
'.slapos-retention-lock-delay', '.slapgrid-0-error.log'])
self.assertEqual(computer.sequence,
['/getFullComputerInformation', '/availableComputerPartition',
['/getFullComputerInformation',
'/startedComputerPartition', '/getHateoasUrl',
'/getFullComputerInformation', '/softwareInstanceError'])
self.assertEqual(instance.state, 'started')
......@@ -726,7 +724,7 @@ chmod 755 etc/run/wrapper
self.assertLogContent(wrapper_log, 'Working')
self.assertItemsEqual(os.listdir(self.software_root), [instance.software.software_hash])
self.assertEqual(computer.sequence,
['/getFullComputerInformation', '/availableComputerPartition',
['/getFullComputerInformation',
'/startedComputerPartition'])
self.assertEqual(instance.state, 'started')
......@@ -739,7 +737,7 @@ chmod 755 etc/run/wrapper
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay'])
self.assertLogContent(wrapper_log, 'Signal handler called with signal 15')
self.assertEqual(computer.sequence,
['/getHateoasUrl', '/getFullComputerInformation', '/availableComputerPartition',
['/getHateoasUrl', '/getFullComputerInformation',
'/stoppedComputerPartition'])
self.assertEqual(instance.state, 'stopped')
......@@ -783,7 +781,7 @@ chmod 755 etc/run/wrapper
self.assertItemsEqual(os.listdir(self.software_root),
[instance.software.software_hash])
self.assertEqual(computer.sequence,
['/getFullComputerInformation', '/availableComputerPartition',
['/getFullComputerInformation',
'/startedComputerPartition'])
self.assertEqual(instance.state, 'started')
......@@ -819,7 +817,7 @@ exit 1
self.assertItemsEqual(os.listdir(self.software_root),
[instance.software.software_hash])
self.assertEqual(computer.sequence,
['/getFullComputerInformation', '/availableComputerPartition',
['/getFullComputerInformation',
'/stoppedComputerPartition'])
self.assertEqual('stopped', instance.state)
......@@ -836,7 +834,7 @@ exit 1
wrapper_log = os.path.join(instance.partition_path, '.0_wrapper.log')
self.assertLogContent(wrapper_log, 'Working')
self.assertEqual(computer.sequence,
['/getHateoasUrl', '/getFullComputerInformation', '/availableComputerPartition',
['/getHateoasUrl', '/getFullComputerInformation',
'/startedComputerPartition'])
self.assertEqual('started', instance.state)
......@@ -1239,7 +1237,7 @@ class TestSlapgridCPPartitionProcessing(MasterMixin, unittest.TestCase):
self.assertEqual(self.grid.processComputerPartitionList(), slapgrid.SLAPGRID_SUCCESS)
self.assertIn(timestamp, open(timestamp_path).read())
self.assertEqual(instance.sequence,
['/availableComputerPartition', '/stoppedComputerPartition'])
['/stoppedComputerPartition'])
def test_partition_timestamp_develop(self):
computer = ComputerForTest(self.software_root, self.instance_root)
......@@ -1261,8 +1259,8 @@ class TestSlapgridCPPartitionProcessing(MasterMixin, unittest.TestCase):
self.assertEqual(self.launchSlapgrid(), slapgrid.SLAPGRID_SUCCESS)
self.assertEqual(instance.sequence,
['/availableComputerPartition', '/stoppedComputerPartition',
'/availableComputerPartition', '/stoppedComputerPartition'])
[ '/stoppedComputerPartition',
'/stoppedComputerPartition'])
def test_partition_old_timestamp(self):
computer = ComputerForTest(self.software_root, self.instance_root)
......@@ -1280,7 +1278,7 @@ class TestSlapgridCPPartitionProcessing(MasterMixin, unittest.TestCase):
instance.timestamp = str(int(timestamp) - 1)
self.assertEqual(self.launchSlapgrid(), slapgrid.SLAPGRID_SUCCESS)
self.assertEqual(instance.sequence,
['/availableComputerPartition', '/stoppedComputerPartition'])
[ '/stoppedComputerPartition'])
def test_partition_timestamp_new_timestamp(self):
computer = ComputerForTest(self.software_root, self.instance_root)
......@@ -1300,10 +1298,10 @@ class TestSlapgridCPPartitionProcessing(MasterMixin, unittest.TestCase):
self.assertEqual(self.launchSlapgrid(), slapgrid.SLAPGRID_SUCCESS)
self.assertEqual(computer.sequence,
['/getHateoasUrl',
'/getFullComputerInformation', '/availableComputerPartition',
'/getFullComputerInformation',
'/stoppedComputerPartition',
'/getHateoasUrl', '/getFullComputerInformation',
'/availableComputerPartition', '/stoppedComputerPartition',
'/stoppedComputerPartition',
'/getHateoasUrl',
'/getFullComputerInformation'])
......@@ -1325,10 +1323,10 @@ class TestSlapgridCPPartitionProcessing(MasterMixin, unittest.TestCase):
self.launchSlapgrid()
self.assertEqual(computer.sequence,
['/getHateoasUrl',
'/getFullComputerInformation', '/availableComputerPartition',
'/getFullComputerInformation',
'/stoppedComputerPartition',
'/getHateoasUrl', '/getFullComputerInformation',
'/availableComputerPartition', '/stoppedComputerPartition'])
'/stoppedComputerPartition'])
def test_partition_periodicity_remove_timestamp(self):
"""
......@@ -1394,16 +1392,16 @@ class TestSlapgridCPPartitionProcessing(MasterMixin, unittest.TestCase):
time.sleep(wanted_periodicity + 1)
for instance in computer.instance_list[1:]:
self.assertEqual(instance.sequence,
['/availableComputerPartition', '/stoppedComputerPartition'])
[ '/stoppedComputerPartition'])
time.sleep(1)
self.launchSlapgrid()
self.assertEqual(instance0.sequence,
['/availableComputerPartition', '/startedComputerPartition',
'/availableComputerPartition', '/startedComputerPartition',
[ '/startedComputerPartition',
'/startedComputerPartition',
])
for instance in computer.instance_list[1:]:
self.assertEqual(instance.sequence,
['/availableComputerPartition', '/stoppedComputerPartition'])
[ '/stoppedComputerPartition'])
self.assertGreater(
os.path.getmtime(os.path.join(instance0.partition_path, '.timestamp')),
last_runtime)
......@@ -1434,15 +1432,15 @@ class TestSlapgridCPPartitionProcessing(MasterMixin, unittest.TestCase):
time.sleep(wanted_periodicity + 1)
for instance in computer.instance_list[1:]:
self.assertEqual(instance.sequence,
['/availableComputerPartition', '/stoppedComputerPartition'])
[ '/stoppedComputerPartition'])
time.sleep(1)
self.launchSlapgrid()
self.assertEqual(instance0.sequence,
['/availableComputerPartition', '/stoppedComputerPartition',
'/availableComputerPartition', '/stoppedComputerPartition'])
[ '/stoppedComputerPartition',
'/stoppedComputerPartition'])
for instance in computer.instance_list[1:]:
self.assertEqual(instance.sequence,
['/availableComputerPartition', '/stoppedComputerPartition'])
[ '/stoppedComputerPartition'])
self.assertNotEqual(os.path.getmtime(os.path.join(instance0.partition_path,
'.timestamp')),
last_runtime)
......@@ -1474,16 +1472,16 @@ class TestSlapgridCPPartitionProcessing(MasterMixin, unittest.TestCase):
time.sleep(wanted_periodicity + 1)
for instance in computer.instance_list[1:]:
self.assertEqual(instance.sequence,
['/availableComputerPartition', '/stoppedComputerPartition'])
[ '/stoppedComputerPartition'])
time.sleep(1)
instance0.requested_state = 'destroyed'
self.launchSlapgrid()
self.assertEqual(instance0.sequence,
['/availableComputerPartition', '/stoppedComputerPartition',
[ '/stoppedComputerPartition',
'/stoppedComputerPartition'])
for instance in computer.instance_list[1:]:
self.assertEqual(instance.sequence,
['/availableComputerPartition', '/stoppedComputerPartition'])
[ '/stoppedComputerPartition'])
self.assertNotEqual(os.path.getmtime(os.path.join(instance0.partition_path,
'.timestamp')),
last_runtime)
......@@ -1550,7 +1548,7 @@ exit 42""")
self.assertEqual(instance0.sequence,
['/softwareInstanceError'])
self.assertEqual(instance1.sequence,
['/availableComputerPartition', '/stoppedComputerPartition'])
[ '/stoppedComputerPartition'])
def test_one_partition_lacking_software_path_does_not_disturb_others(self):
"""
......@@ -1567,7 +1565,7 @@ exit 42""")
self.assertEqual(instance0.sequence,
['/softwareInstanceError'])
self.assertEqual(instance1.sequence,
['/availableComputerPartition', '/stoppedComputerPartition'])
[ '/stoppedComputerPartition'])
def test_one_partition_lacking_software_bin_path_does_not_disturb_others(self):
"""
......@@ -1584,7 +1582,7 @@ exit 42""")
self.assertEqual(instance0.sequence,
['/softwareInstanceError'])
self.assertEqual(instance1.sequence,
['/availableComputerPartition', '/stoppedComputerPartition'])
[ '/stoppedComputerPartition'])
def test_one_partition_lacking_path_does_not_disturb_others(self):
"""
......@@ -1601,7 +1599,7 @@ exit 42""")
self.assertEqual(instance0.sequence,
['/softwareInstanceError'])
self.assertEqual(instance1.sequence,
['/availableComputerPartition', '/stoppedComputerPartition'])
[ '/stoppedComputerPartition'])
def test_one_partition_buildout_fail_is_correctly_logged(self):
"""
......@@ -1648,7 +1646,7 @@ class TestSlapgridUsageReport(MasterMixin, unittest.TestCase):
self.assertItemsEqual(os.listdir(self.software_root), [instance.software.software_hash])
self.assertEqual(computer.sequence,
['/getFullComputerInformation',
'/availableComputerPartition',
'/startedComputerPartition'])
self.assertEqual(instance.state, 'started')
......@@ -1719,7 +1717,7 @@ class TestSlapgridUsageReport(MasterMixin, unittest.TestCase):
self.assertItemsEqual(os.listdir(self.software_root), [instance.software.software_hash])
self.assertEqual(computer.sequence,
['/getFullComputerInformation',
'/availableComputerPartition',
'/startedComputerPartition'])
self.assertEqual('started', instance.state)
......@@ -2551,7 +2549,7 @@ exit 0
['.slapgrid', '.0_wrapper.log', 'buildout.cfg',
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay'])
self.assertEqual(computer.sequence,
['/getFullComputerInformation', '/availableComputerPartition',
['/getFullComputerInformation',
'/startedComputerPartition'])
self.assertEqual(partition.state, 'started')
manager_list = slapmanager.from_config({'manager_list': 'prerm'})
......@@ -2798,7 +2796,7 @@ class TestSlapgridWithPortRedirection(MasterMixin, unittest.TestCase):
self.assertEqual(self.grid.processComputerPartitionList(), slapgrid.SLAPGRID_SUCCESS)
self.assertEqual(self.computer.sequence,
['/getFullComputerInformation', '/availableComputerPartition',
['/getFullComputerInformation',
'/startedComputerPartition'])
self.assertEqual(self.partition.state, 'started')
......@@ -2873,7 +2871,7 @@ class TestSlapgridWithPortRedirection(MasterMixin, unittest.TestCase):
self.assertEqual(self.grid.processComputerPartitionList(), slapgrid.SLAPGRID_SUCCESS)
self.assertEqual(self.computer.sequence,
['/getFullComputerInformation', '/availableComputerPartition',
['/getFullComputerInformation',
'/startedComputerPartition', '/startedComputerPartition'])
self.assertEqual(self.partition.state, 'started')
......@@ -2982,7 +2980,7 @@ class TestSlapgridManagerLifecycle(MasterMixin, unittest.TestCase):
self.assertEqual(self.grid.processComputerPartitionList(), slapgrid.SLAPGRID_SUCCESS)
self.assertEqual(self.computer.sequence,
['/getFullComputerInformation', '/availableComputerPartition',
['/getFullComputerInformation',
'/startedComputerPartition'])
self.assertEqual(partition.state, 'started')
......
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