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
8d7f3879
Commit
8d7f3879
authored
Dec 06, 2022
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_erp5: test allocation on Remote Node
parent
1cc7639a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
13 deletions
+64
-13
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5VirtualMasterScenario.py
...mponents/test.erp5.testSlapOSERP5VirtualMasterScenario.py
+64
-13
No files found.
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5VirtualMasterScenario.py
View file @
8d7f3879
...
...
@@ -40,11 +40,13 @@ class TestSlapOSVirtualMasterScenario(DefaultScenarioMixin):
project
.
validate
()
return
project
def
requestRemoteNode
(
self
,
project
):
def
requestRemoteNode
(
self
,
project
,
remote_project
,
remote_person
):
remote_node
=
self
.
portal
.
compute_node_module
.
newContent
(
portal_type
=
'Remote Node'
,
title
=
'remote-%s'
%
self
.
generateNewId
(),
follow_up_value
=
project
,
destination_project_value
=
remote_project
.
getRelativeUrl
(),
destination_section_value
=
remote_person
.
getRelativeUrl
(),
# XXX
capacity_scope
=
'close'
)
...
...
@@ -840,23 +842,24 @@ class TestSlapOSVirtualMasterScenario(DefaultScenarioMixin):
# hooray, now it is time to create compute_nodes
self
.
login
(
owner_person
.
getUserId
())
remote_server
=
self
.
requestRemoteNode
(
project
)
remote_compute_node
=
self
.
requestRemoteNode
(
project
,
remote_project
,
remote_public_person
)
# and install some software on them
public_server_software
=
self
.
generateNewSoftwareReleaseUrl
()
public_server_software
=
remote_server_software
remote_
server
.
requestSoftwareRelease
(
software_release_url
=
public_server_software
,
remote_
compute_node
.
requestSoftwareRelease
(
software_release_url
=
public_server_software
,
state
=
'available'
)
#software_product, release_variation, type_variation = self.addSoftwareProduct(
public_instance_type
=
'public type'
public_instance_type
=
remote_instance_type
software_product
,
software_release
,
software_type
=
self
.
addSoftwareProduct
(
"instance product"
,
project
,
public_server_software
,
public_instance_type
)
self
.
addAllocationSupply
(
"for
compute node"
,
remote_server
,
software_product
,
software_release
,
software_type
,
is_slave_on_same_instance_tree_allocable
=
True
)
self
.
addAllocationSupply
(
"for
remote node"
,
remote_compute_node
,
software_product
,
software_release
,
software_type
)
self
.
tic
(
)
# join as the another visitor and request software instance on public
# compute_node
...
...
@@ -873,23 +876,71 @@ class TestSlapOSVirtualMasterScenario(DefaultScenarioMixin):
self
.
checkRemoteInstanceAllocation
(
public_person
.
getUserId
(),
public_reference
,
public_instance_title
,
public_server_software
,
public_instance_type
,
remote_
server
,
project
.
getReference
())
remote_
compute_node
,
project
.
getReference
())
self
.
tic
()
# XXX Do this for every scenario tests
self
.
logout
()
for
_
in
range
(
3
):
self
.
stepCallAlarmList
()
self
.
tic
()
# now instantiate it on compute_node and set some nice connection dict
self
.
simulateSlapgridCP
(
remote_server
)
self
.
tic
()
self
.
login
()
# owner_person should have one Instance Tree created by alarm
owner_instance_tree_list
=
self
.
portal
.
portal_catalog
(
portal_type
=
'Instance Tree'
,
destination_section__uid
=
owner_person
.
getUid
()
)
self
.
assertEqual
(
1
,
len
(
owner_instance_tree_list
))
owner_software_instance
=
owner_instance_tree_list
[
0
].
getSuccessorValue
()
self
.
assertEqual
(
'Software Instance'
,
owner_software_instance
.
getPortalType
())
self
.
assertEqual
(
remote_server
.
getRelativeUrl
(),
owner_software_instance
.
getAggregateValue
().
getParentValue
().
getRelativeUrl
()
)
# public_person should have one Instance Tree
public_instance_tree_list
=
self
.
portal
.
portal_catalog
(
portal_type
=
'Instance Tree'
,
destination_section__uid
=
public_person
.
getUid
()
)
self
.
assertEqual
(
1
,
len
(
public_instance_tree_list
))
self
.
assertEqual
(
'_remote_%s_%s'
%
(
project
.
getReference
(),
public_instance_tree_list
[
0
].
getSuccessorReference
()),
owner_software_instance
.
getTitle
()
)
connection_dict
=
owner_software_instance
.
getConnectionXmlAsDict
()
self
.
assertSameSet
((
'url_1'
,
'url_2'
),
connection_dict
.
keys
())
self
.
assertSameSet
(
[
'http://%s/'
%
q
.
getIpAddress
()
for
q
in
owner_software_instance
.
getAggregateValue
().
contentValues
(
portal_type
=
'Internet Protocol Address'
)],
connection_dict
.
values
())
self
.
checkRemoteInstanceAllocation
(
public_person
.
getUserId
(),
public_reference
,
public_instance_title
,
public_server_software
,
public_instance_type
,
remote_compute_node
,
project
.
getReference
(),
connection_dict_to_check
=
owner_software_instance
.
getConnectionXmlAsDict
())
self
.
login
()
# Ensure no unexpected object has been created
# 3 (can reduce to 2) assignment, 1 remote node, 1 software installation
# 1 compute node
# 1 instance tree, 1 software instance
# 2 credential request
# 1 software product
# 3 allocation supply/line/cell
related_object_list
=
remote_project
.
Base_getRelatedObjectList
(
**
{
'category.category_strict_membership'
:
1
})
assert
len
(
related_object_list
)
==
1
1
,
[
x
.
getRelativeUrl
()
for
x
in
related_object_list
]
assert
len
(
related_object_list
)
==
1
4
,
[
x
.
getRelativeUrl
()
for
x
in
related_object_list
]
# Ensure no unexpected object has been created
# 2 (can reduce to 2) assignment, 1
instance tree, 1
remote node, 1 software installation
# 1 software instance
# 2 (can reduce to 2) assignment, 1 remote node, 1 software installation
# 1
instance tree, 1
software instance
# 1 credential request
# 1 software product
# 3 allocation supply/line/cell
...
...
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