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
Roque
slapos.core
Commits
9f463efd
Commit
9f463efd
authored
1 year ago
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_cloud: Add allocation tests for capabilities
parent
8195653b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
0 deletions
+63
-0
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudAllocationAlarm.py
...al_components/test.erp5.testSlapOSCloudAllocationAlarm.py
+63
-0
No files found.
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudAllocationAlarm.py
View file @
9f463efd
...
...
@@ -853,3 +853,66 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by S
@
simulate
(
'Person_isAllowedToAllocate'
,
'*args, **kwargs'
,
'return True'
)
def
test_allocation_storage_redundancy_sla
(
self
):
return
self
.
check_allocation_category_sla
(
'storage_redundancy'
,
'dht'
,
'raid'
)
def
check_allocation_capability
(
self
,
capability
,
*
bad_capability_list
):
self
.
_makeTree
()
self
.
_makeComputeNode
()
self
.
partition
.
edit
(
subject
=
capability
)
self
.
_installSoftware
(
self
.
compute_node
,
self
.
software_instance
.
getUrlString
())
self
.
assertEqual
(
None
,
self
.
software_instance
.
getAggregate
(
portal_type
=
'Compute Partition'
))
for
bad_capability
in
bad_capability_list
:
self
.
software_instance
.
setSlaXml
(
"""<?xml version='1.0' encoding='utf-8'?>
<instance>
<parameter id='capability'>%s</parameter>
</instance>"""
%
bad_capability
)
self
.
software_instance
.
SoftwareInstance_tryToAllocatePartition
()
try
:
partition
=
self
.
software_instance
.
getAggregate
(
portal_type
=
'Compute Partition'
)
self
.
assertEqual
(
None
,
partition
)
except
AssertionError
:
raise
AssertionError
(
"Allocated %s on %s with capability %s"
%
(
bad_capability
,
partition
,
capability
))
self
.
software_instance
.
setSlaXml
(
"""<?xml version='1.0' encoding='utf-8'?>
<instance>
<parameter id='capability'>%s</parameter>
</instance>"""
%
capability
)
self
.
software_instance
.
SoftwareInstance_tryToAllocatePartition
()
self
.
assertEqual
(
self
.
partition
.
getRelativeUrl
(),
self
.
software_instance
.
getAggregate
(
portal_type
=
'Compute Partition'
))
@
simulate
(
'Person_isAllowedToAllocate'
,
'*args, **kwargs'
,
'return True'
)
def
test_allocation_capability
(
self
):
valid_id
=
self
.
generateNewId
()
capability
=
'toto_'
+
valid_id
self
.
check_allocation_capability
(
capability
,
'tutu_'
+
self
.
generateNewId
(),
't%to_'
+
valid_id
,
'%_'
+
valid_id
,
'%'
,
't_to_'
+
valid_id
,
'__'
+
valid_id
,
'_'
,
'.*_'
+
valid_id
,
'.*'
,
)
@
simulate
(
'Person_isAllowedToAllocate'
,
'*args, **kwargs'
,
'return True'
)
def
test_allocation_capability_percent
(
self
):
self
.
check_allocation_capability
(
'%'
,
'_'
)
@
simulate
(
'Person_isAllowedToAllocate'
,
'*args, **kwargs'
,
'return True'
)
def
test_allocation_capability_ipv6
(
self
):
self
.
check_allocation_capability
(
'fe80::1ff:fe23:4567:890a'
,
'fe80::1'
)
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