Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
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
Jérome Perrin
neoppod
Commits
cf55f66e
Commit
cf55f66e
authored
May 24, 2019
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qa: add testSlowConflictResolution
parent
0b34a051
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
neo/tests/threaded/test.py
neo/tests/threaded/test.py
+36
-0
No files found.
neo/tests/threaded/test.py
View file @
cf55f66e
...
@@ -426,6 +426,42 @@ class Test(NEOThreadedTest):
...
@@ -426,6 +426,42 @@ class Test(NEOThreadedTest):
self
.
assertEqual
([
x
[
'tid'
]
for
x
in
c1
.
db
().
history
(
oid
,
size
=
10
)],
self
.
assertEqual
([
x
[
'tid'
]
for
x
in
c1
.
db
().
history
(
oid
,
size
=
10
)],
[
tid3
,
tid2
,
tid1
,
tid0
])
[
tid3
,
tid2
,
tid1
,
tid0
])
@
with_cluster
()
def
testSlowConflictResolution
(
self
,
cluster
):
"""
Check that a slow conflict resolution does not always result in a new
conflict because a concurrent client keeps modifying the same object
quickly.
An idea to fix it is to take the lock before the second attempt to
resolve.
"""
t1
,
c1
=
cluster
.
getTransaction
()
c1
.
root
()[
''
]
=
ob
=
PCounterWithResolution
()
t1
.
commit
()
l1
=
threading
.
Lock
();
l1
.
acquire
()
l2
=
threading
.
Lock
();
l2
.
acquire
()
conflicts
=
[]
def
_p_resolveConflict
(
orig
,
*
args
):
conflicts
.
append
(
get_ident
())
l1
.
release
();
l2
.
acquire
()
return
orig
(
*
args
)
with
cluster
.
newClient
(
1
)
as
db
,
Patch
(
PCounterWithResolution
,
_p_resolveConflict
=
_p_resolveConflict
):
t2
,
c2
=
cluster
.
getTransaction
(
db
)
c2
.
root
()[
''
].
value
+=
1
for
i
in
xrange
(
10
):
ob
.
value
+=
1
t1
.
commit
()
if
i
:
l2
.
release
()
else
:
t
=
self
.
newThread
(
t2
.
commit
)
l1
.
acquire
()
l2
.
release
()
t
.
join
()
with
self
.
expectedFailure
():
\
self
.
assertIn
(
get_ident
(),
conflicts
)
@
with_cluster
()
@
with_cluster
()
def
testDelayedLoad
(
self
,
cluster
):
def
testDelayedLoad
(
self
,
cluster
):
"""
"""
...
...
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