Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Romain Courteaud
slapos.core
Commits
a9020c91
Commit
a9020c91
authored
Jan 19, 2023
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_pdm: test Upgrade for allocated Software Instance
parent
26fe1a30
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
13 deletions
+74
-13
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/InstanceTree_createUpgradeDecision.py
...al_skins/slapos_pdm/InstanceTree_createUpgradeDecision.py
+3
-0
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSPDMCreateUpgradeDecisionSkins.py
...ents/test.erp5.testSlapOSPDMCreateUpgradeDecisionSkins.py
+71
-13
No files found.
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/InstanceTree_createUpgradeDecision.py
View file @
a9020c91
...
...
@@ -70,6 +70,9 @@ if len(allocation_cell_list) == 1:
if
(
allocation_cell_list
[
0
].
getSoftwareReleaseValue
().
getUrlString
()
!=
instance_tree
.
getUrlString
()):
# XXX Upgrade
if
compute_node
is
not
None
:
assert
compute_node
.
getRelativeUrl
()
in
allocation_cell_list
[
0
].
getParentValue
().
getParentValue
().
getAggregateList
()
decision_title
=
'A new upgrade is available for %s'
%
instance_tree
.
getTitle
()
upgrade_decision
=
portal
.
upgrade_decision_module
.
newContent
(
portal_type
=
'Upgrade Decision'
,
...
...
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSPDMCreateUpgradeDecisionSkins.py
View file @
a9020c91
...
...
@@ -127,7 +127,7 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins):
)
self
.
assertEqual
(
None
,
instance_tree
.
InstanceTree_createUpgradeDecision
())
def
bootstrapAllocableInstanceTree
(
self
):
def
bootstrapAllocableInstanceTree
(
self
,
is_allocated
=
False
):
project
=
self
.
addProject
()
person
=
self
.
_makePerson
(
project
)
software_product
=
self
.
_makeSoftwareProduct
(
project
)
...
...
@@ -144,16 +144,30 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins):
)
assert
compute_node
is
not
None
instance_tree
=
self
.
portal
.
instance_tree_module
.
newContent
(
portal_type
=
"Instance Tree"
,
destination_section_value
=
person
,
url_string
=
release_variation
.
getUrlString
(),
source_reference
=
type_variation
.
getTitle
(),
follow_up_value
=
project
,
request_kw
=
dict
(
software_release
=
release_variation
.
getUrlString
(),
software_type
=
type_variation
.
getTitle
(),
instance_xml
=
self
.
generateSafeXml
(),
sla_xml
=
self
.
generateSafeXml
(),
shared
=
False
,
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
:
partition
=
compute_node
.
newContent
(
portal_type
=
'Compute Partition'
)
instance
=
instance_tree
.
getSuccessorValue
()
instance
.
edit
(
aggregate_value
=
partition
)
self
.
tic
()
return
software_product
,
release_variation
,
type_variation
,
compute_node
,
instance_tree
##########################################################################
# Not allocated
##########################################################################
def
test_createUpgradeDecision_notAllocated_newRelease
(
self
):
software_product
,
_
,
type_variation
,
compute_node
,
instance_tree
=
self
.
bootstrapAllocableInstanceTree
()
...
...
@@ -231,14 +245,58 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins):
upgrade_decision2
=
instance_tree
.
InstanceTree_createUpgradeDecision
()
self
.
assertEqual
(
'started'
,
upgrade_decision2
.
getSimulationState
())
# not allocated 0 supply
# not allocated 1 same supply
# not allocated 1 different supply without existing decision
# not allocated 1 different supply with existing decision
# not allocated 1 different supply with existing rejected decision
##########################################################################
# Allocated on Compute Node
##########################################################################
def
test_createUpgradeDecision_allocatedOnComputeNode_newReleaseOnAnotherComputeNode
(
self
):
software_product
,
_
,
type_variation
,
_
,
instance_tree
=
self
.
bootstrapAllocableInstanceTree
(
is_allocated
=
True
)
project
=
instance_tree
.
getFollowUpValue
()
person
=
instance_tree
.
getDestinationSectionValue
()
person
.
requestComputeNode
(
compute_node_title
=
'another test compute node'
,
project_reference
=
project
.
getReference
())
self
.
tic
()
compute_node2
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Compute Node'
,
reference
=
self
.
portal
.
REQUEST
.
get
(
'compute_node_reference'
)
)
assert
compute_node2
is
not
None
# 2 supplies
new_release_variation
=
self
.
_makeSoftwareRelease
(
software_product
)
self
.
addAllocationSupply
(
"for compute node 2"
,
compute_node2
,
software_product
,
new_release_variation
,
type_variation
)
self
.
tic
()
self
.
assertEqual
(
None
,
instance_tree
.
InstanceTree_createUpgradeDecision
())
def
test_createUpgradeDecision_allocatedOnComputeNode_newReleaseOnComputeNode
(
self
):
software_product
,
_
,
type_variation
,
compute_node
,
instance_tree
=
self
.
bootstrapAllocableInstanceTree
(
is_allocated
=
True
)
new_release_variation
=
self
.
_makeSoftwareRelease
(
software_product
)
self
.
addAllocationSupply
(
"for compute node"
,
compute_node
,
software_product
,
new_release_variation
,
type_variation
)
self
.
tic
()
upgrade_decision
=
instance_tree
.
InstanceTree_createUpgradeDecision
()
self
.
assertEqual
(
'started'
,
upgrade_decision
.
getSimulationState
())
def
test_createUpgradeDecision_allocatedOnComputeNode_twoRelease
(
self
):
software_product
,
release_variation
,
type_variation
,
compute_node
,
instance_tree
=
self
.
bootstrapAllocableInstanceTree
(
is_allocated
=
True
)
self
.
addAllocationSupply
(
"for compute node"
,
compute_node
,
software_product
,
release_variation
,
type_variation
)
new_release_variation
=
self
.
_makeSoftwareRelease
(
software_product
)
self
.
addAllocationSupply
(
"for compute node 2"
,
compute_node
,
software_product
,
new_release_variation
,
type_variation
)
self
.
tic
()
self
.
assertEqual
(
None
,
instance_tree
.
InstanceTree_createUpgradeDecision
())
##########################################################################
# tocheck
##########################################################################
def
test_tocheck_InstanceTree_createUpgradeDecision
(
self
):
upgrade_decision
=
self
.
instance_tree
.
InstanceTree_createUpgradeDecision
()
self
.
assertEqual
(
'started'
,
upgrade_decision
.
getSimulationState
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment