Commit 4e671e0d authored by Romain Courteaud's avatar Romain Courteaud

slapos_pdm: check created upgrade decision

parent f7b3441b
......@@ -104,6 +104,32 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins):
self.tic()
return software_product, release_variation, type_variation, compute_node, instance_tree
def checkCreatedUpgradeDecision(self, upgrade_decision, instance_tree,
software_product, release_variation,
type_variation):
self.assertEqual('confirmed', upgrade_decision.getSimulationState())
project = instance_tree.getFollowUpValue()
self.assertEqual(instance_tree.getRelativeUrl(),
upgrade_decision.getAggregate())
self.assertEqual(software_product.getRelativeUrl(),
upgrade_decision.getResource())
self.assertEqual(release_variation.getRelativeUrl(),
upgrade_decision.getSoftwareRelease())
self.assertEqual(type_variation.getRelativeUrl(),
upgrade_decision.getSoftwareType())
self.assertEqual(project.getRelativeUrl(),
upgrade_decision.getDestinationProject())
person = instance_tree.getDestinationSectionValue()
self.assertEqual(person.getRelativeUrl(),
upgrade_decision.getDestinationDecision())
self.assertEqual(person.getRelativeUrl(),
upgrade_decision.getDestinationSection())
# Check that software release url is not the same
self.assertEqual(type_variation.getTitle(),
instance_tree.getSourceReference())
self.assertNotEqual(release_variation.getUrlString(),
instance_tree.getUrlString())
##########################################################################
# Not allocated
##########################################################################
......@@ -115,8 +141,10 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins):
new_release_variation, type_variation)
self.tic()
upgrade_decision = instance_tree.InstanceTree_createUpgradeDecision()
self.assertEqual('started', upgrade_decision.getSimulationState())
self.checkCreatedUpgradeDecision(
instance_tree.InstanceTree_createUpgradeDecision(),
instance_tree, software_product, new_release_variation, type_variation
)
def test_createUpgradeDecision_notAllocated_newReleaseOnRemoteNode(self):
software_product, _, type_variation, compute_node, instance_tree = self.bootstrapAllocableInstanceTree(node="remote")
......@@ -126,8 +154,10 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins):
new_release_variation, type_variation)
self.tic()
upgrade_decision = instance_tree.InstanceTree_createUpgradeDecision()
self.assertEqual('started', upgrade_decision.getSimulationState())
self.checkCreatedUpgradeDecision(
instance_tree.InstanceTree_createUpgradeDecision(),
instance_tree, software_product, new_release_variation, type_variation
)
def test_createUpgradeDecision_notAllocated_newReleaseOnInstanceNode(self):
software_product, _, type_variation, compute_node, instance_tree = self.bootstrapAllocableInstanceTree(node="instance")
......@@ -169,8 +199,10 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins):
new_release_variation, type_variation)
self.tic()
upgrade_decision = instance_tree.InstanceTree_createUpgradeDecision()
self.assertEqual('started', upgrade_decision.getSimulationState())
self.checkCreatedUpgradeDecision(
instance_tree.InstanceTree_createUpgradeDecision(),
instance_tree, software_product, new_release_variation, type_variation
)
self.tic()
self.assertEqual(None, instance_tree.InstanceTree_createUpgradeDecision())
......@@ -183,8 +215,10 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins):
new_release_variation, type_variation)
self.tic()
upgrade_decision = instance_tree.InstanceTree_createUpgradeDecision()
self.assertEqual('started', upgrade_decision.getSimulationState())
self.checkCreatedUpgradeDecision(
instance_tree.InstanceTree_createUpgradeDecision(),
instance_tree, software_product, new_release_variation, type_variation
)
self.commit()
self.assertEqual(None, instance_tree.InstanceTree_createUpgradeDecision())
......@@ -198,12 +232,17 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins):
self.tic()
upgrade_decision = instance_tree.InstanceTree_createUpgradeDecision()
self.assertEqual('started', upgrade_decision.getSimulationState())
self.checkCreatedUpgradeDecision(
upgrade_decision,
instance_tree, software_product, new_release_variation, type_variation
)
upgrade_decision.reject()
self.tic()
upgrade_decision2 = instance_tree.InstanceTree_createUpgradeDecision()
self.assertEqual('started', upgrade_decision2.getSimulationState())
self.checkCreatedUpgradeDecision(
instance_tree.InstanceTree_createUpgradeDecision(),
instance_tree, software_product, new_release_variation, type_variation
)
##########################################################################
# Shared not allocated
......@@ -226,8 +265,10 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins):
new_release_variation, type_variation)
self.tic()
upgrade_decision = instance_tree.InstanceTree_createUpgradeDecision()
self.assertEqual('started', upgrade_decision.getSimulationState())
self.checkCreatedUpgradeDecision(
instance_tree.InstanceTree_createUpgradeDecision(),
instance_tree, software_product, new_release_variation, type_variation
)
def test_createUpgradeDecision_sharedNotAllocated_newReleaseOnInstanceNode(self):
software_product, _, type_variation, compute_node, instance_tree = self.bootstrapAllocableInstanceTree(shared=True, node="instance")
......@@ -237,8 +278,10 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins):
new_release_variation, type_variation)
self.tic()
upgrade_decision = instance_tree.InstanceTree_createUpgradeDecision()
self.assertEqual('started', upgrade_decision.getSimulationState())
self.checkCreatedUpgradeDecision(
instance_tree.InstanceTree_createUpgradeDecision(),
instance_tree, software_product, new_release_variation, type_variation
)
##########################################################################
# Allocated on Compute Node
......@@ -273,8 +316,10 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins):
new_release_variation, type_variation)
self.tic()
upgrade_decision = instance_tree.InstanceTree_createUpgradeDecision()
self.assertEqual('started', upgrade_decision.getSimulationState())
self.checkCreatedUpgradeDecision(
instance_tree.InstanceTree_createUpgradeDecision(),
instance_tree, software_product, new_release_variation, type_variation
)
def test_createUpgradeDecision_allocatedOnComputeNode_twoRelease(self):
software_product, release_variation, type_variation, compute_node, instance_tree = self.bootstrapAllocableInstanceTree(is_allocated=True)
......@@ -326,8 +371,10 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins):
new_release_variation, type_variation)
self.tic()
upgrade_decision = instance_tree.InstanceTree_createUpgradeDecision()
self.assertEqual('started', upgrade_decision.getSimulationState())
self.checkCreatedUpgradeDecision(
instance_tree.InstanceTree_createUpgradeDecision(),
instance_tree, software_product, new_release_variation, type_variation
)
def test_createUpgradeDecision_allocatedOnRemoteNode_twoRelease(self):
software_product, release_variation, type_variation, remote_node, instance_tree = self.bootstrapAllocableInstanceTree(is_allocated=True, node="remote")
......@@ -369,8 +416,10 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins):
new_release_variation, type_variation)
self.tic()
upgrade_decision = instance_tree.InstanceTree_createUpgradeDecision()
self.assertEqual('started', upgrade_decision.getSimulationState())
self.checkCreatedUpgradeDecision(
instance_tree.InstanceTree_createUpgradeDecision(),
instance_tree, software_product, new_release_variation, type_variation
)
def test_createUpgradeDecision_slaveAllocatedOnRemoteNode_twoRelease(self):
software_product, release_variation, type_variation, remote_node, instance_tree = self.bootstrapAllocableInstanceTree(is_allocated=True, shared=True, node="remote")
......@@ -412,9 +461,10 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins):
new_release_variation, type_variation)
self.tic()
upgrade_decision = instance_tree.InstanceTree_createUpgradeDecision()
self.assertEqual('started', upgrade_decision.getSimulationState())
self.checkCreatedUpgradeDecision(
instance_tree.InstanceTree_createUpgradeDecision(),
instance_tree, software_product, new_release_variation, type_variation
)
def test_createUpgradeDecision_slaveAllocatedOnInstanceNode_newReleaseOnAnotherInstanceNode(self):
software_product, _, type_variation, _, instance_tree = self.bootstrapAllocableInstanceTree(is_allocated=True, shared=True, node="instance")
......
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