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
0991dfca
Commit
0991dfca
authored
Jan 26, 2023
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_cloud: preallocate test data
this will break many tests...
parent
64f62351
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
198 additions
and
209 deletions
+198
-209
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.SlapOSTestCaseMixin.py
...teItem/portal_components/test.erp5.SlapOSTestCaseMixin.py
+59
-33
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudAllocationAlarm.py
...al_components/test.erp5.testSlapOSCloudAllocationAlarm.py
+139
-176
No files found.
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.SlapOSTestCaseMixin.py
View file @
0991dfca
...
...
@@ -611,6 +611,7 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
url_string
=
'type%s'
%
self
.
generateNewId
(),
)
# XXX XXX XXX XXX replqce is_allocated by allocation="prepare" "allocate" None
def
bootstrapAllocableInstanceTree
(
self
,
is_allocated
=
False
,
shared
=
False
,
node
=
"compute"
):
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
)
...
...
@@ -649,7 +650,7 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
software_release
=
release_variation
.
getUrlString
(),
software_type
=
type_variation
.
getTitle
(),
instance_xml
=
self
.
generateSafeXml
(),
sla_xml
=
self
.
generate
Safe
Xml
(),
sla_xml
=
self
.
generate
Empty
Xml
(),
shared
=
shared
,
software_title
=
'test tree'
,
state
=
'started'
,
...
...
@@ -658,43 +659,68 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
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
)
if
(
node
==
"instance"
)
and
(
shared
):
real_compute_node
=
self
.
portal
.
compute_node_module
.
newContent
(
portal_type
=
"Compute Node"
,
follow_up_value
=
project
,
reference
=
'TEST-%s'
%
self
.
generateNewId
(),
allocation_scope
=
"open"
,
capacity_scope
=
'open'
)
# 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
()
)
node_instance_tree
=
self
.
portal
.
instance_tree_module
.
newContent
(
title
=
'TEST-%s'
%
self
.
generateNewId
(),
)
software_instance
=
self
.
portal
.
software_instance_module
.
newContent
(
portal_type
=
"Software Instance"
,
follow_up_value
=
project
,
specialise_value
=
node_instance_tree
,
url_string
=
release_variation
.
getUrlString
(),
title
=
'TEST-%s'
%
self
.
generateNewId
(),
reference
=
'TEST-%s'
%
self
.
generateNewId
(),
source_reference
=
'TEST-%s'
%
self
.
generateNewId
(),
destination_reference
=
'TEST-%s'
%
self
.
generateNewId
(),
ssl_certificate
=
'TEST-%s'
%
self
.
generateNewId
(),
ssl_key
=
'TEST-%s'
%
self
.
generateNewId
(),
)
self
.
tic
()
compute_node
.
edit
(
specialise_value
=
software_instance
)
software_instance
.
edit
(
aggregate_value
=
partition
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
software_instance
,
'start_requested'
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
software_instance
,
'validated'
)
partition
.
validate
()
partition
.
markFree
()
partition
.
markBusy
()
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
()
)
partition
.
validate
()
partition
.
markFree
()
#compute_node.validate()
if
is_allocated
:
instance
=
instance_tree
.
getSuccessorValue
()
instance
.
edit
(
aggregate_value
=
partition
)
if
not
((
node
==
"instance"
)
and
(
shared
)):
partition
.
markBusy
()
self
.
tic
()
return
software_product
,
release_variation
,
type_variation
,
compute_node
,
instance_tree
return
software_product
,
release_variation
,
type_variation
,
compute_node
,
partition
,
instance_tree
def
addAllocationSupply
(
self
,
title
,
node
,
software_product
,
software_release
,
software_type
,
...
...
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudAllocationAlarm.py
View file @
0991dfca
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