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
22545fe1
Commit
22545fe1
authored
Nov 29, 2022
by
Romain Courteaud
🐙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_cloud: method to request and allocate slave instance from an instance tree
parent
74a6cab5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
0 deletions
+60
-0
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.SlapOSTestCaseDefaultScenarioMixin.py
...omponents/test.erp5.SlapOSTestCaseDefaultScenarioMixin.py
+60
-0
No files found.
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.SlapOSTestCaseDefaultScenarioMixin.py
View file @
22545fe1
...
...
@@ -417,6 +417,66 @@ class DefaultScenarioMixin(TestSlapOSSecurityMixin):
portal_type
=
'Internet Protocol Address'
)],
connection_dict
.
values
())
def
checkInstanceTreeSlaveInstanceAllocation
(
self
,
person_user_id
,
person_reference
,
instance_tree_title
,
instance_title
,
software_release
,
software_type
,
server
,
project_reference
):
self
.
login
(
person_user_id
)
# let's find instance of user
instance_tree_list
=
[
q
.
getObject
()
for
q
in
self
.
_getCurrentInstanceTreeList
()
if
q
.
getTitle
()
==
instance_tree_title
]
self
.
assertEqual
(
1
,
len
(
instance_tree_list
))
instance_tree
=
instance_tree_list
[
0
]
software_instance
=
instance_tree
.
getSuccessorValue
()
self
.
login
()
instance_user_id
=
software_instance
.
getUserId
()
compute_partition
=
software_instance
.
getAggregateValue
()
computer_id
=
compute_partition
.
getParentValue
().
getReference
()
computer_partition_id
=
compute_partition
.
getTitle
()
self
.
login
(
instance_user_id
)
response
=
self
.
portal
.
portal_slap
.
requestComputerPartition
(
computer_id
=
computer_id
,
computer_partition_id
=
computer_partition_id
,
software_release
=
software_release
,
software_type
=
software_type
,
partition_reference
=
instance_title
,
shared_xml
=
'<marshal><bool>2</bool></marshal>'
,
project_reference
=
project_reference
)
status
=
getattr
(
response
,
'status'
,
None
)
self
.
assertEqual
(
408
,
status
)
self
.
tic
()
self
.
stepCallSlaposAllocateInstanceAlarm
()
self
.
tic
()
# now instantiate it on compute_node and set some nice connection dict
self
.
simulateSlapgridCP
(
server
)
# let's find instances of user and check connection strings
slave_instance
=
software_instance
.
getSuccessorValue
()
connection_dict
=
slave_instance
.
getConnectionXmlAsDict
()
self
.
assertSameSet
((
'url_1'
,
'url_2'
),
connection_dict
.
keys
())
self
.
login
()
partition
=
slave_instance
.
getAggregateValue
()
self
.
assertSameSet
(
[
'http://%s/%s'
%
(
q
.
getIpAddress
(),
slave_instance
.
getReference
())
for
q
in
partition
.
contentValues
(
portal_type
=
'Internet Protocol Address'
)],
connection_dict
.
values
())
def
checkSlaveInstanceUnallocation
(
self
,
person_user_id
,
person_reference
,
instance_title
,
software_release
,
software_type
,
server
,
...
...
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