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
f6aa6c03
Commit
f6aa6c03
authored
Nov 29, 2022
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_erp5: test slave allocation on the same instance tree
parent
22545fe1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
111 additions
and
2 deletions
+111
-2
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5VirtualMasterScenario.py
...mponents/test.erp5.testSlapOSERP5VirtualMasterScenario.py
+111
-2
No files found.
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5VirtualMasterScenario.py
View file @
f6aa6c03
...
@@ -78,12 +78,14 @@ class TestSlapOSVirtualMasterScenario(DefaultScenarioMixin):
...
@@ -78,12 +78,14 @@ class TestSlapOSVirtualMasterScenario(DefaultScenarioMixin):
return
software_product
,
release_variation
,
type_variation
return
software_product
,
release_variation
,
type_variation
def
addAllocationSupply
(
self
,
title
,
node
,
software_product
,
def
addAllocationSupply
(
self
,
title
,
node
,
software_product
,
software_release
,
software_type
):
software_release
,
software_type
,
is_slave_on_same_instance_tree_allocable
=
False
):
allocation_supply
=
self
.
portal
.
allocation_supply_module
.
newContent
(
allocation_supply
=
self
.
portal
.
allocation_supply_module
.
newContent
(
portal_type
=
"Allocation Supply"
,
portal_type
=
"Allocation Supply"
,
title
=
title
,
title
=
title
,
aggregate_value
=
node
,
aggregate_value
=
node
,
destination_project_value
=
node
.
getFollowUpValue
(),
destination_project_value
=
software_product
.
getFollowUpValue
(),
slave_on_same_instance_tree_allocable
=
is_slave_on_same_instance_tree_allocable
)
)
resource_vcl
=
[
resource_vcl
=
[
'software_release/%s'
%
software_release
.
getRelativeUrl
(),
'software_release/%s'
%
software_release
.
getRelativeUrl
(),
...
@@ -618,6 +620,113 @@ class TestSlapOSVirtualMasterScenario(DefaultScenarioMixin):
...
@@ -618,6 +620,113 @@ class TestSlapOSVirtualMasterScenario(DefaultScenarioMixin):
assert
last_message
is
None
,
last_message
assert
last_message
is
None
,
last_message
def
test_virtual_master_slave_on_same_tree_without_accounting_scenario
(
self
):
self
.
portal
.
testromain
()
# 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
preference
.
edit
(
preferred_subscription_assignment_category_list
=
[
'function/customer'
,
'role/client'
,
'destination_project/%s'
%
project
.
getRelativeUrl
()
]
)
# some preparation
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
)
self
.
login
()
owner_person
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"ERP5 Login"
,
reference
=
owner_reference
).
getParentValue
()
# first slapos administrator assignment can only be created by
# the erp5 manager
self
.
addProjectProductionManagerAssignment
(
owner_person
,
project
)
self
.
tic
()
# hooray, now it is time to create compute_nodes
self
.
login
(
owner_person
.
getUserId
())
public_server_title
=
'Public Server for %s'
%
owner_reference
public_server_id
=
self
.
requestComputeNode
(
public_server_title
,
project
.
getReference
())
public_server
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Compute Node'
,
reference
=
public_server_id
)
self
.
setAccessToMemcached
(
public_server
)
self
.
assertNotEqual
(
None
,
public_server
)
self
.
setServerOpenPublic
(
public_server
)
# and install some software on them
public_server_software
=
self
.
generateNewSoftwareReleaseUrl
()
self
.
supplySoftware
(
public_server
,
public_server_software
)
#software_product, release_variation, type_variation = self.addSoftwareProduct(
public_instance_type
=
'public type'
software_product
,
software_release
,
software_type
=
self
.
addSoftwareProduct
(
"instance product"
,
project
,
public_server_software
,
public_instance_type
)
self
.
addAllocationSupply
(
"for compute node"
,
public_server
,
software_product
,
software_release
,
software_type
,
is_slave_on_same_instance_tree_allocable
=
True
)
# format the compute_nodes
self
.
formatComputeNode
(
public_server
)
# join as the another visitor and request software instance on public
# compute_node
self
.
logout
()
public_reference
=
'public-%s'
%
self
.
generateNewId
()
self
.
joinSlapOS
(
self
.
web_site
,
public_reference
)
self
.
login
()
public_person
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"ERP5 Login"
,
reference
=
public_reference
).
getParentValue
()
public_instance_title
=
'Public title %s'
%
self
.
generateNewId
()
self
.
checkInstanceAllocation
(
public_person
.
getUserId
(),
public_reference
,
public_instance_title
,
public_server_software
,
public_instance_type
,
public_server
,
project
.
getReference
())
self
.
tic
()
# request slave instance on the same instance tree
self
.
login
(
public_person
.
getUserId
())
slave_instance_title
=
'Slave title %s'
%
self
.
generateNewId
()
self
.
checkInstanceTreeSlaveInstanceAllocation
(
public_person
.
getUserId
(),
public_reference
,
public_instance_title
,
slave_instance_title
,
public_server_software
,
public_instance_type
,
public_server
,
project
.
getReference
()
)
self
.
login
()
# Ensure no unexpected object has been created
# 3 (can reduce to 2) assignment, 1 instance tree, 1 compute node, 1 software installation
# 2 software instance
# 2 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
)
==
14
,
[
x
.
getRelativeUrl
()
for
x
in
related_object_list
]
self
.
stepcheckERP5Consistency
()
# after accept, an email is send containing the reset link
last_message
=
self
.
portal
.
MailHost
.
_last_message
assert
last_message
is
None
,
last_message
def
test_open_order_with_service_scenario
(
self
):
def
test_open_order_with_service_scenario
(
self
):
# create a default project
# create a default project
...
...
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