Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
ce202994
Commit
ce202994
authored
Nov 17, 2001
by
Chris McDonough
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Broke stress tests out from unit tests.
parent
96255b20
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
287 additions
and
116 deletions
+287
-116
lib/python/Products/Sessions/stresstests/testMultiThread.py
lib/python/Products/Sessions/stresstests/testMultiThread.py
+284
-0
lib/python/Products/Sessions/tests/testSessionDataManager.py
lib/python/Products/Sessions/tests/testSessionDataManager.py
+3
-116
No files found.
lib/python/Products/Sessions/stresstests/testMultiThread.py
0 → 100644
View file @
ce202994
This diff is collapsed.
Click to expand it.
lib/python/Products/Sessions/tests/testSessionDataManager.py
View file @
ce202994
...
...
@@ -215,7 +215,8 @@ class TestSessionManager(TestBase):
assert
sd
==
bykeysd
,
(
sd
,
bykeysd
,
token
)
def
testBadExternalSDCPath
(
self
):
self
.
app
.
session_data_manager
.
REQUEST
[
'REQUEST_METHOD'
]
=
'GET'
# fake out webdav
# fake out webdav
self
.
app
.
session_data_manager
.
REQUEST
[
'REQUEST_METHOD'
]
=
'GET'
self
.
app
.
session_data_manager
.
setContainerPath
(
'/fudgeffoloo'
)
try
:
self
.
app
.
session_data_manager
.
getSessionData
()
...
...
@@ -260,123 +261,9 @@ class TestSessionManager(TestBase):
sd
.
set
(
'foo'
,
aq_wrapped
)
self
.
assertRaises
(
UnpickleableError
,
get_transaction
().
commit
)
class
TestMultiThread
(
TestCase
):
def
testNonOverlappingSids
(
self
):
readers
=
[]
writers
=
[]
readiters
=
20
writeiters
=
5
readout
=
[]
writeout
=
[]
numreaders
=
20
numwriters
=
5
sdm_name
=
'session_data_manager'
db
=
_getDB
()
for
i
in
range
(
numreaders
):
thread
=
ReaderThread
(
db
,
readiters
,
sdm_name
)
readers
.
append
(
thread
)
for
i
in
range
(
numwriters
):
thread
=
WriterThread
(
db
,
writeiters
,
sdm_name
)
writers
.
append
(
thread
)
for
thread
in
readers
:
thread
.
start
()
time
.
sleep
(
0.1
)
for
thread
in
writers
:
thread
.
start
()
time
.
sleep
(
0.1
)
while
threading
.
activeCount
()
>
1
:
time
.
sleep
(
1
)
for
thread
in
readers
:
assert
thread
.
out
==
[],
thread
.
out
def
testOverlappingSids
(
self
):
readers
=
[]
writers
=
[]
readiters
=
20
writeiters
=
5
readout
=
[]
writeout
=
[]
numreaders
=
20
numwriters
=
5
sdm_name
=
'session_data_manager'
db
=
_getDB
()
for
i
in
range
(
numreaders
):
thread
=
ReaderThread
(
db
,
readiters
,
sdm_name
)
readers
.
append
(
thread
)
for
i
in
range
(
numwriters
):
thread
=
WriterThread
(
db
,
writeiters
,
sdm_name
)
writers
.
append
(
thread
)
for
thread
in
readers
:
thread
.
start
()
time
.
sleep
(
0.1
)
for
thread
in
writers
:
thread
.
start
()
time
.
sleep
(
0.1
)
while
threading
.
activeCount
()
>
1
:
time
.
sleep
(
1
)
for
thread
in
readers
:
assert
thread
.
out
==
[],
thread
.
out
class
BaseReaderWriter
(
threading
.
Thread
):
def
__init__
(
self
,
db
,
iters
,
sdm_name
):
self
.
conn
=
db
.
open
()
self
.
app
=
self
.
conn
.
root
()[
'Application'
]
self
.
app
=
makerequest
.
makerequest
(
self
.
app
)
token
=
self
.
app
.
browser_id_manager
.
_getNewBrowserId
()
self
.
app
.
REQUEST
.
browser_id_
=
token
self
.
iters
=
iters
self
.
sdm_name
=
sdm_name
self
.
out
=
[]
threading
.
Thread
.
__init__
(
self
)
def
run
(
self
):
i
=
0
try
:
while
1
:
try
:
self
.
run1
()
return
except
ConflictError
:
i
=
i
+
1
#print "conflict %d" % i
if
i
>
3
:
raise
finally
:
self
.
conn
.
close
()
del
self
.
app
class
ReaderThread
(
BaseReaderWriter
):
def
run1
(
self
):
session_data_manager
=
getattr
(
self
.
app
,
self
.
sdm_name
)
data
=
session_data_manager
.
getSessionData
(
create
=
1
)
t
=
time
.
time
()
data
[
t
]
=
1
get_transaction
().
commit
()
for
i
in
range
(
self
.
iters
):
data
=
session_data_manager
.
getSessionData
()
if
not
data
.
has_key
(
t
):
self
.
out
.
append
(
1
)
time
.
sleep
(
whrandom
.
choice
(
range
(
3
)))
get_transaction
().
commit
()
class
WriterThread
(
BaseReaderWriter
):
def
run1
(
self
):
session_data_manager
=
getattr
(
self
.
app
,
self
.
sdm_name
)
for
i
in
range
(
self
.
iters
):
data
=
session_data_manager
.
getSessionData
()
data
[
time
.
time
()]
=
1
n
=
whrandom
.
choice
(
range
(
3
))
time
.
sleep
(
n
)
if
n
%
2
==
0
:
get_transaction
().
commit
()
else
:
get_transaction
().
abort
()
def
test_suite
():
test_datamgr
=
makeSuite
(
TestSessionManager
,
'test'
)
test_multithread
=
makeSuite
(
TestMultiThread
,
'test'
)
suite
=
TestSuite
((
test_datamgr
,
test_multithread
))
suite
=
TestSuite
((
test_datamgr
,))
return
suite
if
__name__
==
'__main__'
:
...
...
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