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
0
Merge Requests
0
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
Titouan Soulard
slapos.core
Commits
b0dde55d
Commit
b0dde55d
authored
Jan 20, 2023
by
Romain Courteaud
🐙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_pdm: test upgrade Instance Node
parent
007d3cb3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
6 deletions
+60
-6
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/InstanceTree_createUpgradeDecision.py
...al_skins/slapos_pdm/InstanceTree_createUpgradeDecision.py
+12
-4
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSPDMCreateUpgradeDecisionSkins.py
...ents/test.erp5.testSlapOSPDMCreateUpgradeDecisionSkins.py
+48
-2
No files found.
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/InstanceTree_createUpgradeDecision.py
View file @
b0dde55d
...
...
@@ -46,10 +46,18 @@ if len(root_instance_list) != 0:
if
partition
is
not
None
:
compute_node
=
partition
.
getParentValue
()
if
(
root_instance
.
getPortalType
()
==
'Slave Instance'
)
and
\
(
compute_node
.
getPortalType
()
!=
'Remote Node'
):
return
if
(
root_instance
.
getPortalType
()
==
'Slave Instance'
):
if
(
compute_node
.
getPortalType
()
==
'Compute Node'
):
# Search the instance node linked to this partition
soft_instance
=
partition
.
getAggregateRelatedValue
(
portal_type
=
'Software Instance'
)
if
soft_instance
is
None
:
return
instance_node
=
soft_instance
.
getSpecialiseRelatedValue
(
portal_type
=
'Instance Node'
)
if
instance_node
is
None
:
return
compute_node
=
instance_node
elif
(
compute_node
.
getPortalType
()
!=
'Remote Node'
):
return
person
=
context
.
getDestinationSectionValue
()
if
person
is
None
:
...
...
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSPDMCreateUpgradeDecisionSkins.py
View file @
b0dde55d
...
...
@@ -23,6 +23,10 @@ from erp5.component.test.testSlapOSPDMSkins import TestSlapOSPDMMixinSkins
class
TestSlapOSPDMCreateUpgradeDecisionSkins
(
TestSlapOSPDMMixinSkins
):
def
afterSetUp
(
self
):
self
.
portal
.
testromain
()
TestSlapOSPDMMixinSkins
.
afterSetUp
(
self
)
def
test_createUpgradeDecision_destroyed_instance
(
self
):
instance_tree
=
self
.
portal
.
instance_tree_module
.
newContent
(
portal_type
=
"Instance Tree"
...
...
@@ -81,9 +85,23 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins):
instance_tree
=
self
.
portal
.
REQUEST
.
get
(
'request_instance_tree'
)
if
is_allocated
:
if
node
==
"instance"
:
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'
)
partition
=
compute_node
.
newContent
(
portal_type
=
'Compute Partition'
)
else
:
partition
=
compute_node
.
newContent
(
portal_type
=
'Compute Partition'
)
instance
=
instance_tree
.
getSuccessorValue
()
instance
.
edit
(
aggregate_value
=
partition
)
...
...
@@ -387,3 +405,31 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins):
self
.
assertEqual
(
None
,
instance_tree
.
InstanceTree_createUpgradeDecision
())
##########################################################################
# Shared allocated on Instance Node
##########################################################################
def
test_createUpgradeDecision_slaveAllocatedOnInstanceNode_newReleaseOnInstanceNode
(
self
):
software_product
,
_
,
type_variation
,
compute_node
,
instance_tree
=
self
.
bootstrapAllocableInstanceTree
(
is_allocated
=
True
,
shared
=
True
,
node
=
"instance"
)
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_slaveAllocatedOnInstanceNode_newReleaseOnAnotherInstanceNode
(
self
):
software_product
,
_
,
type_variation
,
_
,
instance_tree
=
self
.
bootstrapAllocableInstanceTree
(
is_allocated
=
True
,
shared
=
True
,
node
=
"instance"
)
project
=
instance_tree
.
getFollowUpValue
()
instance_node2
=
self
.
portal
.
compute_node_module
.
newContent
(
portal_type
=
"Instance Node"
,
follow_up_value
=
project
)
new_release_variation
=
self
.
_makeSoftwareRelease
(
software_product
)
self
.
addAllocationSupply
(
"for compute node"
,
instance_node2
,
software_product
,
new_release_variation
,
type_variation
)
self
.
tic
()
self
.
assertEqual
(
None
,
instance_tree
.
InstanceTree_createUpgradeDecision
())
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