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
fc74fe8b
Commit
fc74fe8b
authored
Nov 13, 2023
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_cloud: test: check remote node parameters propagation
parent
df876a5e
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
337 additions
and
18 deletions
+337
-18
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputePartition_propagateRemoteNode.py
...kins/slapos_cloud/ComputePartition_propagateRemoteNode.py
+36
-13
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputePartition_propagateRemoteNode.xml
...ins/slapos_cloud/ComputePartition_propagateRemoteNode.xml
+1
-1
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.SlapOSTestCaseMixin.py
...teItem/portal_components/test.erp5.SlapOSTestCaseMixin.py
+13
-3
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudAlarm.py
...eItem/portal_components/test.erp5.testSlapOSCloudAlarm.py
+287
-1
No files found.
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputePartition_propagateRemoteNode.py
View file @
fc74fe8b
from
zExceptions
import
Unauthorized
if
REQUEST
is
not
None
:
raise
Unauthorized
portal
=
context
.
getPortalObject
()
compute_partition
=
context
...
...
@@ -21,18 +25,37 @@ else:
)]
for
local_instance
in
local_instance_list
:
#
XXX TODO this will
increase the workflow history
#
do not
increase the workflow history
# Use the 'cached' API instead
remote_person
.
requestSoftwareInstance
(
project_reference
=
remote_project
.
getReference
(),
software_release
=
local_instance
.
getUrlString
(),
software_title
=
'_remote_%s_%s'
%
(
remote_node
.
getFollowUpReference
(),
local_instance
.
getReference
()),
software_type
=
local_instance
.
getSourceReference
(),
instance_xml
=
local_instance
.
getTextContent
(),
sla_xml
=
None
,
shared
=
(
local_instance
.
getPortalType
()
==
'Slave Instance'
),
state
=
{
'start_requested'
:
'started'
,
'stop_requested'
:
'stopped'
}[
local_instance
.
getSlapState
()]
# manually search the instance and compare all parameters
remote_instance_tree
=
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Instance Tree'
,
validation_state
=
'validated'
,
destination_section__uid
=
remote_person
.
getUid
(),
follow_up__uid
=
remote_project
.
getUid
(),
title
=
'_remote_%s_%s'
%
(
local_instance
.
getFollowUpReference
(),
local_instance
.
getReference
())
)
requested_software_instance
=
context
.
REQUEST
.
get
(
'request_instance'
)
if
requested_software_instance
is
not
None
:
local_instance
.
setConnectionXml
(
requested_software_instance
.
getConnectionXml
())
if
remote_instance_tree
is
not
None
:
requested_software_instance
=
remote_instance_tree
.
getSuccessorValue
(
title
=
remote_instance_tree
.
getTitle
())
if
(
remote_instance_tree
is
None
)
or
\
(
local_instance
.
getTextContent
()
!=
remote_instance_tree
.
getTextContent
())
or
\
(
local_instance
.
getSlapState
()
!=
remote_instance_tree
.
getSlapState
()):
remote_person
.
requestSoftwareInstance
(
project_reference
=
remote_project
.
getReference
(),
software_release
=
local_instance
.
getUrlString
(),
software_title
=
'_remote_%s_%s'
%
(
remote_node
.
getFollowUpReference
(),
local_instance
.
getReference
()),
software_type
=
local_instance
.
getSourceReference
(),
instance_xml
=
local_instance
.
getTextContent
(),
sla_xml
=
None
,
shared
=
(
local_instance
.
getPortalType
()
==
'Slave Instance'
),
state
=
{
'start_requested'
:
'started'
,
'stop_requested'
:
'stopped'
}[
local_instance
.
getSlapState
()]
)
requested_software_instance
=
context
.
REQUEST
.
get
(
'request_instance'
)
if
(
requested_software_instance
is
not
None
)
and
\
(
requested_software_instance
.
getConnectionXml
()
!=
local_instance
.
getConnectionXml
()):
local_instance
.
edit
(
connection_xml
=
requested_software_instance
.
getConnectionXml
())
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputePartition_propagateRemoteNode.xml
View file @
fc74fe8b
...
...
@@ -50,7 +50,7 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
<value>
<string>
REQUEST=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.SlapOSTestCaseMixin.py
View file @
fc74fe8b
...
...
@@ -345,19 +345,29 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
self
.
requested_software_instance
.
validate
()
self
.
tic
()
def
addComputeNodeAndPartition
(
self
,
project
=
None
):
def
addComputeNodeAndPartition
(
self
,
project
=
None
,
portal_type
=
'Compute Node'
):
# XXX replace _makeComputeNode
if
project
is
None
:
project
=
self
.
addProject
()
self
.
tic
()
edit_kw
=
{}
if
portal_type
==
'Remote Node'
:
# Be nice, and create remote user/project
remote_project
=
self
.
addProject
()
remote_user
=
self
.
makePerson
(
remote_project
)
edit_kw
[
'destination_project_value'
]
=
remote_project
edit_kw
[
'destination_section_value'
]
=
remote_user
reference
=
'TESTCOMP-%s'
%
self
.
generateNewId
()
compute_node
=
self
.
portal
.
compute_node_module
.
newContent
(
portal_type
=
"Compute Node"
,
portal_type
=
portal_type
,
#allocation_scope=allocation_scope,
reference
=
reference
,
title
=
reference
,
follow_up_value
=
project
follow_up_value
=
project
,
**
edit_kw
)
# The edit above will update capacity scope due the interaction workflow
# The line above force capacity scope to be open, keeping the previous
...
...
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudAlarm.py
View file @
fc74fe8b
This diff is collapsed.
Click to expand it.
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