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
2573a41a
Commit
2573a41a
authored
Dec 01, 2022
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_erp5: create 2 projects to simulate remote allocation
parent
b34ed47d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
79 additions
and
11 deletions
+79
-11
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5VirtualMasterScenario.py
...mponents/test.erp5.testSlapOSERP5VirtualMasterScenario.py
+79
-11
No files found.
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5VirtualMasterScenario.py
View file @
2573a41a
...
...
@@ -748,16 +748,18 @@ class TestSlapOSVirtualMasterScenario(DefaultScenarioMixin):
def
test_virtual_master_on_remote_tree_without_accounting_scenario
(
self
):
# create a default project
project
=
self
.
addProject
()
self
.
web_site
=
self
.
portal
.
web_site_module
.
slapos_master_panel
preference
=
self
.
portal
.
portal_preferences
.
slapos_default_system_preference
####################################
# Create a remote project
####################################
remote_project
=
self
.
addProject
()
preference
.
edit
(
preferred_subscription_assignment_category_list
=
[
'function/customer'
,
'role/client'
,
'destination_project/%s'
%
project
.
getRelativeUrl
()
'destination_project/%s'
%
remote_
project
.
getRelativeUrl
()
]
)
...
...
@@ -765,13 +767,70 @@ class TestSlapOSVirtualMasterScenario(DefaultScenarioMixin):
self
.
logout
()
# lets join as slapos administrator, which will own few compute_nodes
owner_reference
=
'
owner-%s'
%
self
.
generateNewId
()
self
.
joinSlapOS
(
self
.
web_site
,
owner_reference
)
remote_owner_reference
=
'remote-
owner-%s'
%
self
.
generateNewId
()
self
.
joinSlapOS
(
self
.
web_site
,
remote_
owner_reference
)
self
.
login
()
owner_person
=
self
.
portal
.
portal_catalog
.
getResultValue
(
remote_
owner_person
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"ERP5 Login"
,
reference
=
owner_reference
).
getParentValue
()
reference
=
remote_owner_reference
).
getParentValue
()
# first slapos administrator assignment can only be created by
# the erp5 manager
self
.
addProjectProductionManagerAssignment
(
remote_owner_person
,
remote_project
)
self
.
tic
()
# hooray, now it is time to create compute_nodes
self
.
login
(
remote_owner_person
.
getUserId
())
remote_server_title
=
'Remote Server for %s'
%
remote_owner_person
remote_server_id
=
self
.
requestComputeNode
(
remote_server_title
,
remote_project
.
getReference
())
remote_server
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Compute Node'
,
reference
=
remote_server_id
)
self
.
setAccessToMemcached
(
remote_server
)
self
.
assertNotEqual
(
None
,
remote_server
)
self
.
setServerOpenPublic
(
remote_server
)
# and install some software on them
remote_server_software
=
self
.
generateNewSoftwareReleaseUrl
()
remote_instance_type
=
'public type'
self
.
supplySoftware
(
remote_server
,
remote_server_software
)
# format the compute_nodes
self
.
formatComputeNode
(
remote_server
)
remote_software_product
,
remote_release_variation
,
remote_type_variation
=
self
.
addSoftwareProduct
(
"remote product"
,
remote_project
,
remote_server_software
,
remote_instance_type
)
self
.
addAllocationSupply
(
"for compute node"
,
remote_server
,
remote_software_product
,
remote_release_variation
,
remote_type_variation
)
# join as the another visitor and request software instance on public
# compute_node
self
.
logout
()
remote_public_reference
=
'remote-public-%s'
%
self
.
generateNewId
()
self
.
joinSlapOS
(
self
.
web_site
,
remote_public_reference
)
self
.
login
()
remote_public_person
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"ERP5 Login"
,
reference
=
remote_public_reference
).
getParentValue
()
####################################
# Create a local project
####################################
project
=
self
.
addProject
()
preference
.
edit
(
preferred_subscription_assignment_category_list
=
[
'function/customer'
,
'role/client'
,
'destination_project/%s'
%
project
.
getRelativeUrl
()
]
)
owner_person
=
remote_public_person
# first slapos administrator assignment can only be created by
# the erp5 manager
...
...
@@ -819,14 +878,23 @@ class TestSlapOSVirtualMasterScenario(DefaultScenarioMixin):
self
.
tic
()
self
.
login
()
# Ensure no unexpected object has been created
# 3 (can reduce to 2) assignment, 1 instance tree, 1 remote node, 1 software installation
# 1 software instance
# 3 (can reduce to 2) assignment, 1 remote node, 1 software installation
# 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
)
==
11
,
[
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
# 1 credential request
# 1 software product
# 3 allocation supply/line/cell
related_object_list
=
project
.
Base_getRelatedObjectList
(
**
{
'category.category_strict_membership'
:
1
})
assert
len
(
related_object_list
)
==
1
3
,
[
x
.
getRelativeUrl
()
for
x
in
related_object_list
]
assert
len
(
related_object_list
)
==
1
1
,
[
x
.
getRelativeUrl
()
for
x
in
related_object_list
]
self
.
stepcheckERP5Consistency
()
...
...
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