Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
amrani
erp5
Commits
23fc0adf
Commit
23fc0adf
authored
Dec 12, 2017
by
Roque Porchetto
Committed by
Roque
Dec 12, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_scalability_test: fixing configurator installation issue
/reviewed-on
nexedi/erp5!527
parent
3808a4e6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
88 deletions
+18
-88
bt5/erp5_scalability_test/SkinTemplateItem/portal_skins/erp5_scalability_test/ERP5Site_bootstrapScalabilityTest.py
...rp5_scalability_test/ERP5Site_bootstrapScalabilityTest.py
+12
-60
bt5/erp5_scalability_test/SkinTemplateItem/portal_skins/erp5_scalability_test/ERP5Site_createTestData.py
...al_skins/erp5_scalability_test/ERP5Site_createTestData.py
+5
-27
bt5/erp5_scalability_test/SkinTemplateItem/portal_skins/erp5_scalability_test/ERP5Site_createTestData.xml
...l_skins/erp5_scalability_test/ERP5Site_createTestData.xml
+1
-1
No files found.
bt5/erp5_scalability_test/SkinTemplateItem/portal_skins/erp5_scalability_test/ERP5Site_bootstrapScalabilityTest.py
View file @
23fc0adf
# Script that installs the configurator
and create users for scalabiility tests:
# Script that installs the configurator
for scalabiility tests
import
time
from
DateTime
import
DateTime
import
random
import
random
import
string
import
string
import
json
import
json
...
@@ -10,10 +8,13 @@ request = context.REQUEST
...
@@ -10,10 +8,13 @@ request = context.REQUEST
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
portal_catalog
=
portal
.
portal_catalog
portal_catalog
=
portal
.
portal_catalog
now
=
DateTime
()
status_code
=
0
status_code
=
0
error_message
=
"No error."
error_message
=
"No error."
user_quantity
=
request
.
get
(
'user_quantity'
)
if
user_quantity
is
None
:
return
json
.
dumps
({
"status_code"
:
1
,
"error_message"
:
"Parameter 'user_quantity' is required."
,
"password"
:
None
})
password
=
''
.
join
(
random
.
choice
(
string
.
digits
+
string
.
letters
)
for
i
in
xrange
(
10
))
# check erp5_scalability_test business template is present
# check erp5_scalability_test business template is present
configurator
=
portal
.
business_configuration_module
.
default_standard_configuration
configurator
=
portal
.
business_configuration_module
.
default_standard_configuration
if
configurator
==
None
or
not
configurator
.
contentValues
(
portal_type
=
'Configuration Save'
):
if
configurator
==
None
or
not
configurator
.
contentValues
(
portal_type
=
'Configuration Save'
):
...
@@ -27,68 +28,19 @@ if configurator.getSimulationState() == "draft":
...
@@ -27,68 +28,19 @@ if configurator.getSimulationState() == "draft":
if
person
is
None
or
organisation
is
None
:
if
person
is
None
or
organisation
is
None
:
try
:
try
:
configurator
.
buildConfiguration
()
configurator
.
buildConfiguration
()
# wait 15 minutes while configurator is installed
time
.
sleep
(
15
*
60
)
except
Exception
as
e
:
except
Exception
as
e
:
status_code
=
1
status_code
=
1
error_message
=
"Error during installation: "
+
str
(
e
)
error_message
=
"Error during installation: "
+
str
(
e
)
return
json
.
dumps
({
"status_code"
:
1
,
"error_message"
:
error_message
})
return
json
.
dumps
({
"status_code"
:
1
,
"error_message"
:
error_message
})
# create users
# create users if installation is done
user_quantity
=
request
.
get
(
'user_quantity'
)
if
user_quantity
is
None
:
return
json
.
dumps
({
"status_code"
:
1
,
"error_message"
:
"Parameter 'user_quantity' is required."
,
"password"
:
None
})
password
=
''
.
join
(
random
.
choice
(
string
.
digits
+
string
.
letters
)
for
i
in
xrange
(
10
))
try
:
try
:
organisation
=
portal_catalog
.
getResultValue
(
context
.
portal_categories
.
activate
(
after_method_id
=
(
'ERP5Site_afterConfigurationSetup'
,
portal_type
=
"Organisation"
,
'recursiveImmediateReindexObject'
,
title
=
'Scalability company'
)
'immediateReindexObject'
)
if
organisation
is
None
:
).
ERP5Site_createTestData
(
user_quantity
,
password
)
error_message
=
"Could not find the scalability organisation. Standard configuration not installed?"
return
json
.
dumps
({
"status_code"
:
1
,
"error_message"
:
error_message
,
"password"
:
None
})
organisation
=
organisation
.
getObject
().
getRelativeUrl
()
for
i
in
xrange
(
0
,
int
(
user_quantity
)):
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
()
assignment_id_list
=
[
x
.
getId
()
for
x
in
person
.
objectValues
(
portal_type
=
"Assignment"
)]
if
assignment_id_list
:
person
.
manage_delObjects
(
ids
=
assignment_id_list
)
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
()
user_id_list
=
[
x
.
getId
()
for
x
in
person
.
objectValues
(
portal_type
=
"ERP5 Login"
)]
if
user_id_list
:
person
.
manage_delObjects
(
ids
=
user_id_list
)
user
=
person
.
newContent
(
portal_type
=
"ERP5 Login"
,
id
=
"login_%s"
%
user_id
,
default_reference
=
user_id
,
password
=
password
,
)
user
.
validate
()
except
Exception
as
e
:
except
Exception
as
e
:
status_code
=
1
status_code
=
1
error_message
=
str
(
e
)
error_message
=
"Error calling ERP5Site_createTestData script: "
+
str
(
e
)
return
json
.
dumps
({
"status_code"
:
1
,
"error_message"
:
error_message
})
return
json
.
dumps
({
"status_code"
:
status_code
,
"error_message"
:
error_message
,
"password"
:
password
,
"quantity"
:
user_quantity
})
return
json
.
dumps
({
"status_code"
:
status_code
,
"error_message"
:
error_message
,
"password"
:
password
,
"quantity"
:
user_quantity
})
bt5/erp5_scalability_test/SkinTemplateItem/portal_skins/erp5_scalability_test/ERP5Site_create
ScalabilityTestUsers
.py
→
bt5/erp5_scalability_test/SkinTemplateItem/portal_skins/erp5_scalability_test/ERP5Site_create
TestData
.py
View file @
23fc0adf
# Script that creates "user_quantity" user for scalabiility tests:
# Script that creates "user_quantity" user
s
for scalabiility tests:
# creates and validates persons
# creates and validates persons
# adds assignment and starts it
# adds assignment and starts it
# creates user (login credentials)
# creates user (login credentials)
# password is random for every call
# random password is given by parameter
# creates the scalability users file
from
DateTime
import
DateTime
from
DateTime
import
DateTime
import
random
now
=
DateTime
()
import
string
request
=
context
.
REQUEST
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
portal_catalog
=
portal
.
portal_catalog
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_quantity
=
request
.
get
(
'user_quantity'
)
if
user_quantity
is
None
:
return
{
'status_code'
:
1
,
'error_message'
:
"Parameter 'user_quantity' is required."
,
'password'
:
None
}
password
=
''
.
join
(
random
.
choice
(
string
.
digits
+
string
.
letters
)
for
i
in
xrange
(
10
))
try
:
try
:
organisation
=
portal_catalog
.
getResultValue
(
organisation
=
portal_catalog
.
getResultValue
(
portal_type
=
"Organisation"
,
portal_type
=
"Organisation"
,
title
=
'Scalability company'
)
title
=
'Scalability company'
)
if
organisation
is
None
:
if
organisation
is
None
:
error_message
=
"Could not find the scalability organisation. Standard configuration not installed?"
error_message
=
"Could not find the scalability organisation. Standard configuration not installed?"
return
{
'status_code'
:
1
,
'error_message'
:
error_message
,
'password'
:
None
}
return
json
.
dumps
({
"status_code"
:
1
,
"error_message"
:
error_message
,
"password"
:
None
})
organisation
=
organisation
.
getObject
().
getRelativeUrl
()
organisation
=
organisation
.
getObject
().
getRelativeUrl
()
for
i
in
xrange
(
0
,
int
(
user_quantity
)):
for
i
in
xrange
(
0
,
int
(
user_quantity
)):
...
@@ -81,5 +60,4 @@ try:
...
@@ -81,5 +60,4 @@ try:
except
Exception
as
e
:
except
Exception
as
e
:
status_code
=
1
status_code
=
1
error_message
=
str
(
e
)
error_message
=
str
(
e
)
raise
e
return
{
'status_code'
:
status_code
,
'error_message'
:
error_message
,
'password'
:
password
}
bt5/erp5_scalability_test/SkinTemplateItem/portal_skins/erp5_scalability_test/ERP5Site_create
ScalabilityTestUsers
.xml
→
bt5/erp5_scalability_test/SkinTemplateItem/portal_skins/erp5_scalability_test/ERP5Site_create
TestData
.xml
View file @
23fc0adf
...
@@ -60,7 +60,7 @@
...
@@ -60,7 +60,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
ERP5Site_create
ScalabilityTestUsers
</string>
</value>
<value>
<string>
ERP5Site_create
TestData
</string>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
...
...
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