Commit b6ef63ce authored by Romain Courteaud's avatar Romain Courteaud

slapos_pdm: root shared instance can not be upgraded by Allocation Supply on the same tree

parent 13e98d27
...@@ -37,7 +37,7 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins): ...@@ -37,7 +37,7 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins):
) )
self.assertEqual(None, instance_tree.InstanceTree_createUpgradeDecision()) self.assertEqual(None, instance_tree.InstanceTree_createUpgradeDecision())
def bootstrapAllocableInstanceTree(self, is_allocated=False): def bootstrapAllocableInstanceTree(self, is_allocated=False, shared=False):
project = self.addProject() project = self.addProject()
person = self._makePerson(project) person = self._makePerson(project)
software_product = self._makeSoftwareProduct(project) software_product = self._makeSoftwareProduct(project)
...@@ -59,7 +59,7 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins): ...@@ -59,7 +59,7 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins):
software_type=type_variation.getTitle(), software_type=type_variation.getTitle(),
instance_xml=self.generateSafeXml(), instance_xml=self.generateSafeXml(),
sla_xml=self.generateSafeXml(), sla_xml=self.generateSafeXml(),
shared=False, shared=shared,
software_title='test tree', software_title='test tree',
state='started', state='started',
project_reference=project.getReference() project_reference=project.getReference()
...@@ -203,3 +203,29 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins): ...@@ -203,3 +203,29 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins):
self.tic() self.tic()
self.assertEqual(None, instance_tree.InstanceTree_createUpgradeDecision()) self.assertEqual(None, instance_tree.InstanceTree_createUpgradeDecision())
##########################################################################
# Slave allocated on Compute Node
##########################################################################
def test_createUpgradeDecision_slaveAllocatedOnComputeNodeSameTree_newReleaseOnComputeNodeButNotTree(self):
software_product, _, type_variation, compute_node, instance_tree = self.bootstrapAllocableInstanceTree(is_allocated=True, shared=True)
new_release_variation = self._makeSoftwareRelease(software_product)
self.addAllocationSupply("for compute node", compute_node, software_product,
new_release_variation, type_variation)
self.tic()
self.assertEqual(None, instance_tree.InstanceTree_createUpgradeDecision())
def test_createUpgradeDecision_slaveAllocatedOnComputeNodeSameTree_newReleaseOnComputeNode(self):
# A Slave Instance can not be the root instance and allocated on the same tree
# at the same time
software_product, _, type_variation, compute_node, instance_tree = self.bootstrapAllocableInstanceTree(is_allocated=True, shared=True)
new_release_variation = self._makeSoftwareRelease(software_product)
self.addAllocationSupply("for compute node", compute_node, software_product,
new_release_variation, type_variation,
is_slave_on_same_instance_tree_allocable=True)
self.tic()
self.assertEqual(None, instance_tree.InstanceTree_createUpgradeDecision())
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