Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5
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
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
erp5
Commits
4b22ac7a
Commit
4b22ac7a
authored
Oct 13, 2017
by
Roque Porchetto
Committed by
Roque
Oct 24, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_scalability_test: separate script for configurator installation
parent
a2cadded
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
158 additions
and
68 deletions
+158
-68
bt5/erp5_scalability_test/SkinTemplateItem/portal_skins/erp5_scalability_test/ERP5Site_bootstrapScalabilityTest.py
...rp5_scalability_test/ERP5Site_bootstrapScalabilityTest.py
+9
-68
bt5/erp5_scalability_test/SkinTemplateItem/portal_skins/erp5_scalability_test/ERP5Site_createScalabilityTestUsers.py
...5_scalability_test/ERP5Site_createScalabilityTestUsers.py
+87
-0
bt5/erp5_scalability_test/SkinTemplateItem/portal_skins/erp5_scalability_test/ERP5Site_createScalabilityTestUsers.xml
..._scalability_test/ERP5Site_createScalabilityTestUsers.xml
+62
-0
No files found.
bt5/erp5_scalability_test/SkinTemplateItem/portal_skins/erp5_scalability_test/ERP5Site_bootstrapScalabilityTest.py
View file @
4b22ac7a
# Script that creates "user_number" user for scalabiility tests:
# creates and validates persons
# adds assignment and starts it
# creates user (login credentials)
# password is random for every call
# creates the scalability users file
# Script that installs the configurator for scalabiility tests:
from
DateTime
import
DateTime
import
random
import
string
import
time
request
=
context
.
REQUEST
portal
=
context
.
getPortalObject
()
portal_catalog
=
portal
.
portal_catalog
now
=
DateTime
()
status_code
=
0
error_message
=
"No error."
...
...
@@ -23,65 +14,15 @@ configurator = portal_catalog.getResultValue(
title
=
"Small And Medium Business"
)
if
configurator
==
None
or
not
configurator
.
contentValues
(
portal_type
=
'Configuration Save'
):
error_message
=
"Could not find the scalability business configuration object. Standard configuration not installed?"
return
{
'status_code'
:
1
,
'error_message'
:
error_message
,
'password'
:
None
}
user_number
=
request
.
get
(
'user_number'
)
if
user_number
is
None
:
return
{
'status_code'
:
1
,
'error_message'
:
"Parameter 'user_number' is required."
,
'password'
:
None
}
password
=
''
.
join
(
random
.
choice
(
string
.
digits
+
string
.
letters
)
for
i
in
xrange
(
10
))
error_message
=
"Could not find the scalability business configuration object. Be sure to have erp5_scalability_test business template installed."
return
{
'status_code'
:
1
,
'error_message'
:
error_message
}
try
:
organisation
=
portal_catalog
.
getResultValue
(
portal_type
=
"Organisation"
,
title
=
'Scalability company'
)
if
organisation
is
None
:
error_message
=
"Could not find the scalability organisation. Standard configuration not installed?"
return
{
'status_code'
:
1
,
'error_message'
:
error_message
,
'password'
:
None
}
organisation
=
organisation
.
getObject
().
getRelativeUrl
()
for
i
in
xrange
(
0
,
int
(
user_number
)):
user_id
=
"scalability_user_%i"
%
i
person
=
portal_catalog
.
getResultValue
(
portal_type
=
"Person"
,
id
=
user_id
)
if
person
is
None
:
person
=
portal
.
person_module
.
newContent
(
portal_type
=
"Person"
,
id
=
user_id
,
first_name
=
"scalability"
,
last_name
=
"user %i"
%
i
,
function_list
=
[
"company/manager"
],
)
person
.
validate
()
assignements
=
person
.
objectValues
(
portal_type
=
'Assignment'
)
for
assignement
in
assignements
:
if
assignement
.
getId
()
==
"assignment_%s"
%
user_id
:
person
.
deleteContent
(
id
=
"assignment_%s"
%
user_id
)
assignment
=
person
.
newContent
(
portal_type
=
"Assignment"
,
id
=
"assignment_%s"
%
user_id
,
title
=
"user assignment"
,
function_list
=
[
"company/manager"
],
destination_relative_url
=
organisation
,
destination
=
organisation
,
group_list
=
[
"my_group"
],
start_date
=
now
,
stop_date
=
DateTime
(
3000
,
1
,
1
)
)
assignment
.
open
()
users
=
person
.
objectValues
(
portal_type
=
'ERP5 Login'
)
for
user
in
users
:
if
user
.
getId
()
==
"login_%s"
%
user_id
:
person
.
deleteContent
(
id
=
"login_%s"
%
user_id
)
user
=
person
.
newContent
(
portal_type
=
"ERP5 Login"
,
id
=
"login_%s"
%
user_id
,
default_reference
=
user_id
,
password
=
password
,
)
user
.
validate
()
configurator
.
buildConfiguration
()
# wait 15 minutes while configurator is installed
time
.
sleep
(
15
*
60
)
except
Exception
as
e
:
status_code
=
1
error_message
=
str
(
e
)
error_message
=
"Error during installation: "
+
str
(
e
)
return
{
'status_code'
:
status_code
,
'error_message'
:
error_message
,
'password'
:
password
}
return
{
'status_code'
:
status_code
,
'error_message'
:
error_message
}
bt5/erp5_scalability_test/SkinTemplateItem/portal_skins/erp5_scalability_test/ERP5Site_createScalabilityTestUsers.py
0 → 100644
View file @
4b22ac7a
# Script that creates "user_number" user for scalabiility tests:
# creates and validates persons
# adds assignment and starts it
# creates user (login credentials)
# password is random for every call
# creates the scalability users file
from
DateTime
import
DateTime
import
random
import
string
request
=
context
.
REQUEST
portal
=
context
.
getPortalObject
()
portal_catalog
=
portal
.
portal_catalog
now
=
DateTime
()
status_code
=
0
error_message
=
"No error."
configurator
=
portal_catalog
.
getResultValue
(
portal_type
=
"Business Configuration"
,
id
=
"default_standard_configuration"
,
title
=
"Small And Medium Business"
)
if
configurator
==
None
or
not
configurator
.
contentValues
(
portal_type
=
'Configuration Save'
):
error_message
=
"Could not find the scalability business configuration object. Standard configuration not installed?"
return
{
'status_code'
:
1
,
'error_message'
:
error_message
,
'password'
:
None
}
user_number
=
request
.
get
(
'user_number'
)
if
user_number
is
None
:
return
{
'status_code'
:
1
,
'error_message'
:
"Parameter 'user_number' is required."
,
'password'
:
None
}
password
=
''
.
join
(
random
.
choice
(
string
.
digits
+
string
.
letters
)
for
i
in
xrange
(
10
))
try
:
organisation
=
portal_catalog
.
getResultValue
(
portal_type
=
"Organisation"
,
title
=
'Scalability company'
)
if
organisation
is
None
:
error_message
=
"Could not find the scalability organisation. Standard configuration not installed?"
return
{
'status_code'
:
1
,
'error_message'
:
error_message
,
'password'
:
None
}
organisation
=
organisation
.
getObject
().
getRelativeUrl
()
for
i
in
xrange
(
0
,
int
(
user_number
)):
user_id
=
"scalability_user_%i"
%
i
person
=
portal_catalog
.
getResultValue
(
portal_type
=
"Person"
,
id
=
user_id
)
if
person
is
None
:
person
=
portal
.
person_module
.
newContent
(
portal_type
=
"Person"
,
id
=
user_id
,
first_name
=
"scalability"
,
last_name
=
"user %i"
%
i
,
function_list
=
[
"company/manager"
],
)
person
.
validate
()
assignements
=
person
.
objectValues
(
portal_type
=
'Assignment'
)
for
assignement
in
assignements
:
if
assignement
.
getId
()
==
"assignment_%s"
%
user_id
:
person
.
deleteContent
(
id
=
"assignment_%s"
%
user_id
)
assignment
=
person
.
newContent
(
portal_type
=
"Assignment"
,
id
=
"assignment_%s"
%
user_id
,
title
=
"user assignment"
,
function_list
=
[
"company/manager"
],
destination_relative_url
=
organisation
,
destination
=
organisation
,
group_list
=
[
"my_group"
],
start_date
=
now
,
stop_date
=
DateTime
(
3000
,
1
,
1
)
)
assignment
.
open
()
users
=
person
.
objectValues
(
portal_type
=
'ERP5 Login'
)
for
user
in
users
:
if
user
.
getId
()
==
"login_%s"
%
user_id
:
person
.
deleteContent
(
id
=
"login_%s"
%
user_id
)
user
=
person
.
newContent
(
portal_type
=
"ERP5 Login"
,
id
=
"login_%s"
%
user_id
,
default_reference
=
user_id
,
password
=
password
,
)
user
.
validate
()
except
Exception
as
e
:
status_code
=
1
error_message
=
str
(
e
)
return
{
'status_code'
:
status_code
,
'error_message'
:
error_message
,
'password'
:
password
}
bt5/erp5_scalability_test/SkinTemplateItem/portal_skins/erp5_scalability_test/ERP5Site_createScalabilityTestUsers.xml
0 → 100644
View file @
4b22ac7a
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
ERP5Site_createScalabilityTestUsers
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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