Commit 0b24e810 authored by Romain Courteaud's avatar Romain Courteaud

slapos_pdm: method moved to global mixin

parent e38c9d44
......@@ -19,9 +19,9 @@
#
##############################################################################
from erp5.component.test.testSlapOSPDMSkins import TestSlapOSPDMMixinSkins
from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin
class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins):
class TestSlapOSPDMCreateUpgradeDecisionSkins(SlapOSTestCaseMixin):
def test_createUpgradeDecision_destroyed_instance(self):
instance_tree = self.portal.instance_tree_module.newContent(
......
......@@ -19,9 +19,9 @@
#
##############################################################################
from erp5.component.test.testSlapOSPDMSkins import TestSlapOSPDMMixinSkins
from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin
class TestSlapOSDestroySoftwareInstallation(TestSlapOSPDMMixinSkins):
class TestSlapOSDestroySoftwareInstallation(SlapOSTestCaseMixin):
def bootstrapSoftwareInstallation(self, is_allocated=True, is_supplied=True):
software_product, release_variation, type_variation, compute_node, _ = \
......
......@@ -21,79 +21,7 @@
from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin
class TestSlapOSPDMMixinSkins(SlapOSTestCaseMixin):
def bootstrapAllocableInstanceTree(self, is_allocated=False, shared=False, node="compute"):
project = self.addProject()
person = self.makePerson(project)
software_product = self._makeSoftwareProduct(project)
release_variation = software_product.contentValues(portal_type='Software Product Release Variation')[0]
type_variation = software_product.contentValues(portal_type='Software Product Type Variation')[0]
self.tic()
if node == "compute":
person.requestComputeNode(compute_node_title='test compute node',
project_reference=project.getReference())
self.tic()
compute_node = self.portal.portal_catalog.getResultValue(
portal_type='Compute Node',
reference=self.portal.REQUEST.get('compute_node_reference')
)
assert compute_node is not None
elif node == "remote":
compute_node = self.portal.compute_node_module.newContent(
portal_type="Remote Node",
follow_up_value=project
)
elif node == "instance":
compute_node = self.portal.compute_node_module.newContent(
portal_type="Instance Node",
follow_up_value=project
)
else:
raise ValueError("Unsupported node value: %s" % node)
request_kw = dict(
software_release=release_variation.getUrlString(),
software_type=type_variation.getTitle(),
instance_xml=self.generateSafeXml(),
sla_xml=self.generateSafeXml(),
shared=shared,
software_title='test tree',
state='started',
project_reference=project.getReference()
)
person.requestSoftwareInstance(**request_kw)
instance_tree = self.portal.REQUEST.get('request_instance_tree')
if is_allocated:
if (node == "instance") and (shared):
real_compute_node = self.portal.compute_node_module.newContent(
portal_type="Compute Node",
follow_up_value=project
)
partition = real_compute_node.newContent(portal_type='Compute Partition')
software_instance = self.portal.software_instance_module.newContent(
portal_type="Software Instance",
follow_up_value=project,
aggregate_value=partition
)
compute_node.edit(specialise_value=software_instance)
elif (node == "instance") and (not shared):
raise NotImplementedError('can not allocate on instance node')
else:
partition = compute_node.newContent(portal_type='Compute Partition')
instance = instance_tree.getSuccessorValue()
instance.edit(aggregate_value=partition)
partition.markFree()
partition.markBusy()
self.tic()
return software_product, release_variation, type_variation, compute_node, instance_tree
class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
class TestSlapOSPDMSkins(SlapOSTestCaseMixin):
def test_requestUpgrade(self):
software_product, _, type_variation, compute_node, instance_tree = self.bootstrapAllocableInstanceTree()
......
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