Commit 146f9fa9 authored by Romain Courteaud's avatar Romain Courteaud

slapos_pdm: remote tests from dropped scripts

parent 60cc2a52
......@@ -181,6 +181,7 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
def test_getSortedSoftwareReleaseListFromSoftwareProduct(self):
project = self.addProject()
software_product = self._makeSoftwareProduct(project)
self.tic()
release_list = software_product.SoftwareProduct_getSortedSoftwareReleaseList(
software_product.getReference())
self.assertEqual(release_list, [])
......@@ -241,92 +242,6 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
software_release_url='http://example.org/1-%s.cfg' % self.new_id)
self.assertEqual([release.getUrlString() for release in release_list],
['http://example.org/1-%s.cfg' % self.new_id, 'http://example.org/2-%s.cfg' % self.new_id])
def test_InstanceTree_getNewerSofwareRelease(self):
project = self.addProject()
person = self._makePerson(project)
compute_node, _ = self._makeComputeNode(project)
software_product = self._makeSoftwareProduct(project)
oldest_software_url = 'http://example.org/oldest-%s.cfg' % self.new_id
newest_software_url = 'http://example.org/newest-%s.cfg' % self.new_id
self._makeCustomSoftwareRelease(
software_product.getRelativeUrl(),
oldest_software_url)
self._makeCustomSoftwareRelease(software_product.getRelativeUrl(),
newest_software_url)
self._makeSoftwareInstallation( compute_node, oldest_software_url)
instance_tree = self._makeFullInstanceTree(
oldest_software_url, person)
self.tic()
self.assertEqual(instance_tree.InstanceTree_getNewerSofwareRelease(),
None)
self._makeFullSoftwareInstance(instance_tree, oldest_software_url)
self.tic()
release = instance_tree.InstanceTree_getNewerSofwareRelease()
self.assertEqual(release.getUrlString(), newest_software_url)
def testInstanceTree_getUpgradableSoftwareRelease_no_installation(self):
project = self.addProject()
person = self._makePerson(project)
compute_node, _ = self._makeComputeNode(project)
self._makeComputePartitions(compute_node)
software_product = self._makeSoftwareProduct(project)
oldest_software_url = 'http://example.org/oldest-%s.cfg' % self.new_id
newest_software_url = 'http://example.org/newest-%s.cfg' % self.new_id
self._makeCustomSoftwareRelease(
software_product.getRelativeUrl(),
oldest_software_url)
self._makeSoftwareInstallation( compute_node, oldest_software_url)
hs = self._makeFullInstanceTree(
oldest_software_url, person)
self.tic()
self.assertEqual(hs.InstanceTree_getUpgradableSoftwareRelease(),
None)
self._makeFullSoftwareInstance(hs, oldest_software_url)
self._markComputePartitionBusy(compute_node, hs.getSuccessorValue())
self._makeCustomSoftwareRelease(software_product.getRelativeUrl(),
newest_software_url)
self.tic()
self.assertEqual(hs.InstanceTree_getUpgradableSoftwareRelease(),
None)
def testInstanceTree_getUpgradableSoftwareRelease(self):
project = self.addProject()
person = self._makePerson(project)
compute_node, _ = self._makeComputeNode(project)
self._makeComputePartitions(compute_node)
software_product = self._makeSoftwareProduct(project)
oldest_software_url = 'http://example.org/oldest-%s.cfg' % self.new_id
newest_software_url = 'http://example.org/newest-%s.cfg' % self.new_id
self._makeCustomSoftwareRelease(
software_product.getRelativeUrl(),
oldest_software_url)
self._makeSoftwareInstallation( compute_node, oldest_software_url)
hs = self._makeFullInstanceTree(
oldest_software_url, person)
self._makeFullSoftwareInstance(hs, oldest_software_url)
self._markComputePartitionBusy(compute_node, hs.getSuccessorValue())
self._makeCustomSoftwareRelease(software_product.getRelativeUrl(),
newest_software_url)
self._makeSoftwareInstallation(compute_node,
newest_software_url)
# software_release should be ignored!
software_release = self._makeSoftwareRelease(software_product)
self._makeSoftwareInstallation(compute_node, software_release.getUrlString())
self.tic()
release = hs.InstanceTree_getUpgradableSoftwareRelease()
self.assertEqual(release.getUrlString(), newest_software_url)
self.portal.portal_workflow._jumpToStateFor(hs, 'destroy_requested')
self.tic()
self.assertEqual(hs.InstanceTree_getUpgradableSoftwareRelease(),
None)
def testUpgradeDecision_getComputeNode(self):
project = self.addProject()
......
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