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
45f1ef7b
Commit
45f1ef7b
authored
Nov 27, 2023
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_cloud: Add allocation tests for multiple capabilities
parent
9f463efd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
8 deletions
+13
-8
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudAllocationAlarm.py
...al_components/test.erp5.testSlapOSCloudAllocationAlarm.py
+13
-8
No files found.
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudAllocationAlarm.py
View file @
45f1ef7b
...
@@ -854,7 +854,9 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by S
...
@@ -854,7 +854,9 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by S
def
test_allocation_storage_redundancy_sla
(
self
):
def
test_allocation_storage_redundancy_sla
(
self
):
return
self
.
check_allocation_category_sla
(
'storage_redundancy'
,
'dht'
,
'raid'
)
return
self
.
check_allocation_category_sla
(
'storage_redundancy'
,
'dht'
,
'raid'
)
def
check_allocation_capability
(
self
,
capability
,
*
bad_capability_list
):
def
check_allocation_capability
(
self
,
capability
,
bad_capability_list
,
good_capability
=
None
):
good_capability
=
good_capability
or
capability
self
.
_makeTree
()
self
.
_makeTree
()
self
.
_makeComputeNode
()
self
.
_makeComputeNode
()
...
@@ -883,7 +885,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by S
...
@@ -883,7 +885,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by S
self
.
software_instance
.
setSlaXml
(
"""<?xml version='1.0' encoding='utf-8'?>
self
.
software_instance
.
setSlaXml
(
"""<?xml version='1.0' encoding='utf-8'?>
<instance>
<instance>
<parameter id='capability'>%s</parameter>
<parameter id='capability'>%s</parameter>
</instance>"""
%
capability
)
</instance>"""
%
good_
capability
)
self
.
software_instance
.
SoftwareInstance_tryToAllocatePartition
()
self
.
software_instance
.
SoftwareInstance_tryToAllocatePartition
()
self
.
assertEqual
(
self
.
partition
.
getRelativeUrl
(),
self
.
assertEqual
(
self
.
partition
.
getRelativeUrl
(),
self
.
software_instance
.
getAggregate
(
portal_type
=
'Compute Partition'
))
self
.
software_instance
.
getAggregate
(
portal_type
=
'Compute Partition'
))
...
@@ -893,9 +895,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by S
...
@@ -893,9 +895,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by S
valid_id
=
self
.
generateNewId
()
valid_id
=
self
.
generateNewId
()
capability
=
'toto_'
+
valid_id
capability
=
'toto_'
+
valid_id
self
.
check_allocation_capability
(
self
.
check_allocation_capability
(
capability
,
(
capability
,
'tutu_'
+
self
.
generateNewId
(),
'tutu_'
+
self
.
generateNewId
(),
't%to_'
+
valid_id
,
't%to_'
+
valid_id
,
'%_'
+
valid_id
,
'%_'
+
valid_id
,
...
@@ -907,12 +907,17 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by S
...
@@ -907,12 +907,17 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by S
'.*_'
+
valid_id
,
'.*_'
+
valid_id
,
'.*'
,
'.*'
,
)
)
)
@
simulate
(
'Person_isAllowedToAllocate'
,
'*args, **kwargs'
,
'return True'
)
@
simulate
(
'Person_isAllowedToAllocate'
,
'*args, **kwargs'
,
'return True'
)
def
test_allocation_capability_percent
(
self
):
def
test_allocation_capability_percent
(
self
):
self
.
check_allocation_capability
(
'%'
,
'_'
)
self
.
check_allocation_capability
(
'%'
,
(
'_'
,)
)
@
simulate
(
'Person_isAllowedToAllocate'
,
'*args, **kwargs'
,
'return True'
)
@
simulate
(
'Person_isAllowedToAllocate'
,
'*args, **kwargs'
,
'return True'
)
def
test_allocation_capability_ipv6
(
self
):
def
test_allocation_capability_ipv6
(
self
):
self
.
check_allocation_capability
(
'fe80::1ff:fe23:4567:890a'
,
'fe80::1'
)
self
.
check_allocation_capability
(
'fe80::1ff:fe23:4567:890a'
,
(
'fe80::1'
,))
@
simulate
(
'Person_isAllowedToAllocate'
,
'*args, **kwargs'
,
'return True'
)
def
test_allocation_capability_multiple
(
self
):
self
.
check_allocation_capability
(
'toto
\
n
tata'
,
(
'titi'
,),
'toto'
)
self
.
check_allocation_capability
(
'toto
\
n
tata'
,
(
'titi'
,),
'tata'
)
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