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
b56538c9
Commit
b56538c9
authored
Jan 25, 2023
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_cloud: fix SLA tests
parent
dea873c9
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
148 additions
and
99 deletions
+148
-99
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.SlapOSTestCaseMixin.py
...teItem/portal_components/test.erp5.SlapOSTestCaseMixin.py
+86
-1
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudAllocationAlarm.py
...al_components/test.erp5.testSlapOSCloudAllocationAlarm.py
+58
-96
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudUpgrader.py
...em/portal_components/test.erp5.testSlapOSCloudUpgrader.py
+4
-2
No files found.
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.SlapOSTestCaseMixin.py
View file @
b56538c9
...
@@ -81,7 +81,7 @@ def withAbort(func):
...
@@ -81,7 +81,7 @@ def withAbort(func):
class
TemporaryAlarmScript
(
object
):
class
TemporaryAlarmScript
(
object
):
"""
"""
Context manager for temporary python scripts
Context manager for temporary
alarm
python scripts
"""
"""
def
__init__
(
self
,
portal
,
script_name
,
fake_return
=
""
,
attribute
=
None
):
def
__init__
(
self
,
portal
,
script_name
,
fake_return
=
""
,
attribute
=
None
):
self
.
script_name
=
script_name
self
.
script_name
=
script_name
...
@@ -611,6 +611,91 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
...
@@ -611,6 +611,91 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
url_string
=
'type%s'
%
self
.
generateNewId
(),
url_string
=
'type%s'
%
self
.
generateNewId
(),
)
)
def
bootstrapAllocableInstanceTree
(
self
,
is_allocated
=
False
,
shared
=
False
,
node
=
"compute"
):
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
)
software_product
=
self
.
_makeSoftwareProduct
(
project
)
release_variation
=
software_product
.
contentValues
(
portal_type
=
'Software Product Release Variation'
)[
0
]
type_variation
=
software_product
.
contentValues
(
portal_type
=
'Software Product Type Variation'
)[
0
]
self
.
tic
()
if
node
==
"compute"
:
person
.
requestComputeNode
(
compute_node_title
=
'test compute node'
,
project_reference
=
project
.
getReference
())
self
.
tic
()
compute_node
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Compute Node'
,
reference
=
self
.
portal
.
REQUEST
.
get
(
'compute_node_reference'
)
)
assert
compute_node
is
not
None
# The edit above will update capacity scope due the interaction workflow
# The line above force capacity scope to be open, keeping the previous
# behaviour.
compute_node
.
edit
(
capacity_scope
=
'open'
)
elif
node
==
"remote"
:
compute_node
=
self
.
portal
.
compute_node_module
.
newContent
(
portal_type
=
"Remote Node"
,
follow_up_value
=
project
)
elif
node
==
"instance"
:
compute_node
=
self
.
portal
.
compute_node_module
.
newContent
(
portal_type
=
"Instance Node"
,
follow_up_value
=
project
)
else
:
raise
ValueError
(
"Unsupported node value: %s"
%
node
)
request_kw
=
dict
(
software_release
=
release_variation
.
getUrlString
(),
software_type
=
type_variation
.
getTitle
(),
instance_xml
=
self
.
generateSafeXml
(),
sla_xml
=
self
.
generateSafeXml
(),
shared
=
shared
,
software_title
=
'test tree'
,
state
=
'started'
,
project_reference
=
project
.
getReference
()
)
person
.
requestSoftwareInstance
(
**
request_kw
)
instance_tree
=
self
.
portal
.
REQUEST
.
get
(
'request_instance_tree'
)
if
is_allocated
:
if
(
node
==
"instance"
)
and
(
shared
):
real_compute_node
=
self
.
portal
.
compute_node_module
.
newContent
(
portal_type
=
"Compute Node"
,
follow_up_value
=
project
)
# The edit above will update capacity scope due the interaction workflow
# The line above force capacity scope to be open, keeping the previous
# behaviour.
real_compute_node
.
edit
(
capacity_scope
=
'open'
)
real_compute_node
.
validate
()
partition
=
real_compute_node
.
newContent
(
portal_type
=
'Compute Partition'
,
reference
=
'reference%s'
%
self
.
generateNewId
()
)
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'
)
else
:
partition
=
compute_node
.
newContent
(
portal_type
=
'Compute Partition'
,
reference
=
'reference%s'
%
self
.
generateNewId
()
)
instance
=
instance_tree
.
getSuccessorValue
()
instance
.
edit
(
aggregate_value
=
partition
)
partition
.
validate
()
partition
.
markFree
()
partition
.
markBusy
()
self
.
tic
()
return
software_product
,
release_variation
,
type_variation
,
compute_node
,
instance_tree
def
addAllocationSupply
(
self
,
title
,
node
,
software_product
,
def
addAllocationSupply
(
self
,
title
,
node
,
software_product
,
software_release
,
software_type
,
software_release
,
software_type
,
destination_value
=
None
,
destination_value
=
None
,
...
...
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudAllocationAlarm.py
View file @
b56538c9
This diff is collapsed.
Click to expand it.
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudUpgrader.py
View file @
b56538c9
...
@@ -157,13 +157,15 @@ class TestSlapOSCloudUpgrader(SlapOSTestCaseMixin):
...
@@ -157,13 +157,15 @@ class TestSlapOSCloudUpgrader(SlapOSTestCaseMixin):
computer_module
=
self
.
portal
.
getDefaultModule
(
'Computer'
)
computer_module
=
self
.
portal
.
getDefaultModule
(
'Computer'
)
computer_nothing_to_migrate
=
computer_module
.
newContent
(
computer_nothing_to_migrate
=
computer_module
.
newContent
(
portal_type
=
'Computer'
portal_type
=
'Computer'
,
title
=
'not to migrate'
)
)
computer_to_migrate
=
computer_module
.
newContent
(
computer_to_migrate
=
computer_module
.
newContent
(
portal_type
=
'Computer'
,
portal_type
=
'Computer'
,
quantity
=
99
,
quantity
=
99
,
bar
=
'foo3'
bar
=
'foo3'
,
title
=
'to migrate'
)
)
# Create fake workflow history
# Create fake workflow history
...
...
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