Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
93
Merge Requests
93
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos
Commits
5dc98c13
Commit
5dc98c13
authored
Mar 19, 2023
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip ERP5 shutdown
parent
926b014a
Pipeline
#27332
running with stage
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
0 deletions
+58
-0
software/erp5/test/test/test_erp5.py
software/erp5/test/test/test_erp5.py
+58
-0
No files found.
software/erp5/test/test/test_erp5.py
View file @
5dc98c13
...
...
@@ -878,6 +878,64 @@ class TestZopeWSGI(ZopeTestMixin, ERP5InstanceTestCase):
pass
class
TestZopeShutdown
(
ZopeSkinsMixin
,
ERP5InstanceTestCase
):
__partition_reference__
=
's'
@
classmethod
def
_setUpClass
(
cls
):
super
().
_setUpClass
()
cls
.
zope_base_url
=
cls
.
_getAuthenticatedZopeUrl
(
''
)
param_dict
=
cls
.
getRootPartitionConnectionParameterDict
()
# a python script to schedule activities
cls
.
_addPythonScript
(
script_id
=
'ERP5Site_runActivityLoop'
,
params
=
'mode="start"'
,
body
=
'''if 1:
from time import sleep
portal = context.getPortalObject()
if mode == "run":
for i in range(1000):
for j in range(1000):
i * j # use CPU
portal.log("ERP5Site_runActivityLoop: %s" % portal.getTitle())
portal.setTitle(portal.getTitle() + '.')
return
if mode == "start":
for i in range(100):
portal.portal_templates.activate(activity="SQLQueue").ERP5Site_runActivityLoop(mode="run")
return "started"
raise ValueError("Unknown mode: %s" % mode)
'''
,
)
cls
.
zope_verify_activity_processing_url
=
urllib
.
parse
.
urljoin
(
cls
.
zope_base_url
,
'ERP5Site_runActivityLoop'
,
)
def
test_shutdown
(
self
):
requests
.
get
(
self
.
zope_verify_activity_processing_url
,
verify
=
False
).
raise_for_status
()
# XXX wait for a first execution
time
.
sleep
(
2
)
with
self
.
slap
.
instance_supervisor_rpc
as
supervisor
:
zope_info
,
=
[
info
for
info
in
supervisor
.
getAllProcessInfo
()
if
'zope'
in
info
[
'name'
]]
zope_name
=
f'
{
zope_info
[
"group"
]
}
:
{
zope_info
[
"name"
]
}
'
supervisor
.
stopProcess
(
zope_name
)
# breakpoint()
for
_
in
range
(
20
):
with
self
.
slap
.
instance_supervisor_rpc
as
supervisor
:
if
supervisor
.
getProcessInfo
(
zope_name
)[
'statename'
]
==
'RUNNING'
:
break
time
.
sleep
(
0.1
)
else
:
time
.
sleep
(
60
)
self
.
fail
(
"did not stop in time"
)
class
TestZopePublisherTimeout
(
ZopeSkinsMixin
,
ERP5InstanceTestCase
):
__partition_reference__
=
't'
...
...
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