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
Carlos Ramos Carreño
slapos.core
Commits
40c4c4f0
Commit
40c4c4f0
authored
Mar 31, 2023
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_jio: Improve and test getFastInputDict
parent
2546c2ec
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
90 additions
and
3 deletions
+90
-3
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/InstanceTree_getFastInputDict.py
...ns/slapos_hal_json_style/InstanceTree_getFastInputDict.py
+9
-3
master/bt5/slapos_jio/TestTemplateItem/portal_components/test.erp5.testSlapOSHalJsonStyleSkins.py
...ortal_components/test.erp5.testSlapOSHalJsonStyleSkins.py
+81
-0
No files found.
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/InstanceTree_getFastInputDict.py
View file @
40c4c4f0
"""
# Recommendation, keep as simple as possible.
Sample of the return:
# Use string in url because there are multiple products for ORS,
# and it would be a costly query and require Manager Proxy role.
if
context
.
getRootSlave
():
return
{}
for
sr_string
in
[
'software/re6stnet/'
,
'software/caddy-frontend/'
]:
if
sr_string
in
context
.
getUrlString
(
''
):
return
{
return
{
'enabled'
:
True
,
'enabled'
:
True
,
'sla_xml'
:
'<parameter id="instance_guid">%s</parameter>'
%
context
.
getSuccessorReference
()
'sla_xml'
:
'<parameter id="instance_guid">%s</parameter>'
%
context
.
getSuccessorReference
()
}
}
"""
return
{}
return
{}
master/bt5/slapos_jio/TestTemplateItem/portal_components/test.erp5.testSlapOSHalJsonStyleSkins.py
View file @
40c4c4f0
...
@@ -1659,3 +1659,84 @@ class TestBase_getAttentionPointList(TestSlapOSHalJsonStyleMixin):
...
@@ -1659,3 +1659,84 @@ class TestBase_getAttentionPointList(TestSlapOSHalJsonStyleMixin):
attention_point_list
=
json
.
loads
(
attention_point_list
=
json
.
loads
(
support_request_module
.
Base_getAttentionPointList
())
support_request_module
.
Base_getAttentionPointList
())
self
.
assertEqual
(
attention_point_list
,
[])
self
.
assertEqual
(
attention_point_list
,
[])
class
TestInstanceTree_getFastInputDict
(
TestSlapOSHalJsonStyleMixin
):
def
afterSetUp
(
self
):
self
.
instance_tree
=
self
.
portal
.
instance_tree_module
.
newContent
(
portal_type
=
"Instance Tree"
)
self
.
software_instance
=
self
.
portal
.
software_instance_module
.
newContent
(
portal_type
=
"Software Instance"
)
TestSlapOSHalJsonStyleMixin
.
afterSetUp
(
self
)
def
testInstanceTree_getFastInputDict_noUrlString
(
self
):
self
.
assertEqual
({},
self
.
instance_tree
.
InstanceTree_getFastInputDict
())
def
testInstanceTree_getFastInputDict_re6st_no_instance
(
self
):
self
.
instance_tree
.
setUrlString
(
self
.
portal
.
software_release_module
.
re6st
.
getUrlString
())
self
.
assertEqual
({},
self
.
instance_tree
.
InstanceTree_getFastInputDict
())
def
testInstanceTree_getFastInputDict_frontend_no_instance
(
self
):
self
.
instance_tree
.
setUrlString
(
self
.
portal
.
software_release_module
.
frontend
.
getUrlString
())
self
.
assertEqual
({},
self
.
instance_tree
.
InstanceTree_getFastInputDict
())
def
testInstanceTree_getFastInputDict_slave_re6st
(
self
):
self
.
instance_tree
.
setRootSlave
(
True
)
self
.
instance_tree
.
setUrlString
(
self
.
portal
.
software_release_module
.
re6st
.
getUrlString
())
slave_instance
=
self
.
portal
.
software_instance_module
.
newContent
(
portal_type
=
"Slave Instance"
,
specialise_value
=
self
.
instance_tree
)
self
.
instance_tree
.
setSuccessorValue
(
slave_instance
)
self
.
assertEqual
({},
self
.
instance_tree
.
InstanceTree_getFastInputDict
())
def
testInstanceTree_getFastInputDict_slave_frontend
(
self
):
self
.
instance_tree
.
setRootSlave
(
True
)
slave_instance
=
self
.
portal
.
software_instance_module
.
newContent
(
portal_type
=
"Slave Instance"
,
specialise_value
=
self
.
instance_tree
)
self
.
instance_tree
.
setSuccessorValue
(
slave_instance
)
self
.
instance_tree
.
setUrlString
(
self
.
portal
.
software_release_module
.
frontend
.
getUrlString
())
self
.
assertEqual
({},
self
.
instance_tree
.
InstanceTree_getFastInputDict
())
def
testInstanceTree_getFastInputDict_re6st
(
self
):
self
.
instance_tree
.
setUrlString
(
self
.
portal
.
software_release_module
.
re6st
.
getUrlString
())
software_instance
=
self
.
portal
.
software_instance_module
.
newContent
(
portal_type
=
"Software Instance"
,
specialise_value
=
self
.
instance_tree
,
reference
=
"TESTSOFTINST-%s"
%
self
.
generateNewId
()
)
self
.
instance_tree
.
setSuccessorValue
(
software_instance
)
self
.
instance_tree
.
setUrlString
(
self
.
portal
.
software_release_module
.
re6st
.
getUrlString
())
self
.
assertEqual
({
'enabled'
:
True
,
'sla_xml'
:
'<parameter id="instance_guid">%s</parameter>'
%
software_instance
.
getReference
()
},
self
.
instance_tree
.
InstanceTree_getFastInputDict
())
def
testInstanceTree_getFastInputDict_frontend
(
self
):
software_instance
=
self
.
portal
.
software_instance_module
.
newContent
(
portal_type
=
"Software Instance"
,
specialise_value
=
self
.
instance_tree
,
reference
=
"TESTSOFTINST-%s"
%
self
.
generateNewId
()
)
self
.
instance_tree
.
setSuccessorValue
(
software_instance
)
self
.
instance_tree
.
setUrlString
(
self
.
portal
.
software_release_module
.
frontend
.
getUrlString
())
self
.
assertEqual
({
'enabled'
:
True
,
'sla_xml'
:
'<parameter id="instance_guid">%s</parameter>'
%
software_instance
.
getReference
()
},
self
.
instance_tree
.
InstanceTree_getFastInputDict
())
\ No newline at end of file
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