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
0e1b755c
Commit
0e1b755c
authored
May 24, 2022
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_erp5: need a project assignment to create a compute node
parent
1c2ba903
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
5 deletions
+24
-5
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5DefaultScenario.py
...tal_components/test.erp5.testSlapOSERP5DefaultScenario.py
+24
-5
No files found.
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5DefaultScenario.py
View file @
0e1b755c
...
@@ -11,14 +11,33 @@ import re
...
@@ -11,14 +11,33 @@ import re
class
TestSlapOSDefaultScenario
(
DefaultScenarioMixin
):
class
TestSlapOSDefaultScenario
(
DefaultScenarioMixin
):
"""
def addSlapOSAdministratorAssignment(self, person):
def addSlapOSAdministratorAssignment(self, person):
person.newContent(
person.newContent(
portal_type='Assignment',
portal_type='Assignment',
# XXX should be project/function instead
# XXX should be project/function instead
group='company'
group='company'
).open()
).open()
"""
def
addProjectComputeNodeManagerAssignment
(
self
,
person
,
project
):
person
.
newContent
(
portal_type
=
'Assignment'
,
destination_project_value
=
project
,
function
=
'computer/manager'
).
open
()
def
addProject
(
self
):
project
=
self
.
portal
.
project_module
.
newContent
(
portal_type
=
'Project'
,
title
=
'project-%s'
%
self
.
generateNewId
()
)
project
.
validate
()
return
project
def
test_new_default_scenario
(
self
):
def
test_new_default_scenario
(
self
):
# create a default project
project
=
self
.
addProject
()
# some preparation
# some preparation
self
.
logout
()
self
.
logout
()
self
.
web_site
=
self
.
portal
.
web_site_module
.
hostingjs
self
.
web_site
=
self
.
portal
.
web_site_module
.
hostingjs
...
@@ -34,14 +53,14 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin):
...
@@ -34,14 +53,14 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin):
# first slapos administrator assignment can only be created by
# first slapos administrator assignment can only be created by
# the erp5 manager
# the erp5 manager
self
.
add
SlapOSAdministratorAssignment
(
owner_person
)
self
.
add
ProjectComputeNodeManagerAssignment
(
owner_person
,
project
)
self
.
tic
()
self
.
tic
()
# hooray, now it is time to create compute_nodes
# hooray, now it is time to create compute_nodes
self
.
login
(
owner_person
.
getUserId
())
self
.
login
(
owner_person
.
getUserId
())
public_server_title
=
'Public Server for %s'
%
owner_reference
public_server_title
=
'Public Server for %s'
%
owner_reference
public_server_id
=
self
.
requestComputeNode
(
public_server_title
)
public_server_id
=
self
.
requestComputeNode
(
public_server_title
,
project
.
getReference
()
)
public_server
=
self
.
portal
.
portal_catalog
.
getResultValue
(
public_server
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Compute Node'
,
reference
=
public_server_id
)
portal_type
=
'Compute Node'
,
reference
=
public_server_id
)
self
.
setAccessToMemcached
(
public_server
)
self
.
setAccessToMemcached
(
public_server
)
...
@@ -214,7 +233,7 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin):
...
@@ -214,7 +233,7 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin):
self
.
login
(
owner_person
.
getUserId
())
self
.
login
(
owner_person
.
getUserId
())
public_server_title
=
'Public Server for %s'
%
owner_reference
public_server_title
=
'Public Server for %s'
%
owner_reference
public_server_id
=
self
.
requestComputeNode
(
public_server_title
)
public_server_id
=
self
.
requestComputeNode
(
public_server_title
,
'XXX'
)
public_server
=
self
.
portal
.
portal_catalog
.
getResultValue
(
public_server
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Compute Node'
,
reference
=
public_server_id
)
portal_type
=
'Compute Node'
,
reference
=
public_server_id
)
self
.
setAccessToMemcached
(
public_server
)
self
.
setAccessToMemcached
(
public_server
)
...
@@ -222,14 +241,14 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin):
...
@@ -222,14 +241,14 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin):
self
.
setServerOpenPublic
(
public_server
)
self
.
setServerOpenPublic
(
public_server
)
personal_server_title
=
'Personal Server for %s'
%
owner_reference
personal_server_title
=
'Personal Server for %s'
%
owner_reference
personal_server_id
=
self
.
requestComputeNode
(
personal_server_title
)
personal_server_id
=
self
.
requestComputeNode
(
personal_server_title
,
'XXX'
)
personal_server
=
self
.
portal
.
portal_catalog
.
getResultValue
(
personal_server
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Compute Node'
,
reference
=
personal_server_id
)
portal_type
=
'Compute Node'
,
reference
=
personal_server_id
)
self
.
assertNotEqual
(
None
,
personal_server
)
self
.
assertNotEqual
(
None
,
personal_server
)
self
.
setServerOpenPersonal
(
personal_server
)
self
.
setServerOpenPersonal
(
personal_server
)
friend_server_title
=
'Friend Server for %s'
%
owner_reference
friend_server_title
=
'Friend Server for %s'
%
owner_reference
friend_server_id
=
self
.
requestComputeNode
(
friend_server_title
)
friend_server_id
=
self
.
requestComputeNode
(
friend_server_title
,
'XXX'
)
friend_server
=
self
.
portal
.
portal_catalog
.
getResultValue
(
friend_server
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Compute Node'
,
reference
=
friend_server_id
)
portal_type
=
'Compute Node'
,
reference
=
friend_server_id
)
self
.
assertNotEqual
(
None
,
friend_server
)
self
.
assertNotEqual
(
None
,
friend_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