Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
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
Stefane Fermigier
neo
Commits
eff9cc88
Commit
eff9cc88
authored
Sep 16, 2011
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rewrite tests of Storage.history() with a threaded test
parent
59c8a2bf
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
56 deletions
+7
-56
neo/tests/client/testClientApp.py
neo/tests/client/testClientApp.py
+0
-44
neo/tests/client/testStorageHandler.py
neo/tests/client/testStorageHandler.py
+0
-12
neo/tests/threaded/test.py
neo/tests/threaded/test.py
+7
-0
No files found.
neo/tests/client/testClientApp.py
View file @
eff9cc88
...
@@ -777,50 +777,6 @@ class ClientApplicationTests(NeoUnitTestBase):
...
@@ -777,50 +777,6 @@ class ClientApplicationTests(NeoUnitTestBase):
self
.
assertEqual
(
result
[
0
][
'id'
],
tid1
)
self
.
assertEqual
(
result
[
0
][
'id'
],
tid1
)
self
.
assertEqual
(
result
[
1
][
'id'
],
tid2
)
self
.
assertEqual
(
result
[
1
][
'id'
],
tid2
)
def
test_history
(
self
):
app
=
self
.
getApp
()
oid
=
self
.
makeOID
(
1
)
tid1
,
tid2
=
self
.
makeTID
(
1
),
self
.
makeTID
(
2
)
object_history
=
(
(
tid1
,
42
),
(
tid2
,
42
),)
# object history, first is a wrong oid, second is valid
p2
=
Packets
.
AnswerObjectHistory
(
oid
,
object_history
)
extension
=
dumps
({
'k'
:
'v'
})
# transaction history
p3
=
Packets
.
AnswerTransactionInformation
(
tid2
,
'u'
,
'd'
,
extension
,
False
,
(
oid
,
))
p4
=
Packets
.
AnswerTransactionInformation
(
tid1
,
'u'
,
'd'
,
extension
,
False
,
(
oid
,
))
p2
.
setId
(
0
)
p3
.
setId
(
1
)
p4
.
setId
(
2
)
# faked environnement
conn
=
Mock
({
'getNextId'
:
1
,
'fakeGetApp'
:
app
,
'fakeReceived'
:
ReturnValues
(
p3
,
p4
),
'getAddress'
:
(
'127.0.0.1'
,
10010
),
})
object_cells
=
[
Mock
({}),
]
history_cells
=
[
Mock
({}),
Mock
({})
]
app
.
pt
=
Mock
({
'getCellListForOID'
:
object_cells
,
'getCellListForTID'
:
ReturnValues
(
history_cells
,
history_cells
),
})
app
.
cp
=
Mock
({
'iterateForObject'
:
[(
Mock
(),
conn
)],
})
def
waitResponses
(
queue
,
handler_data
):
app
.
setHandlerData
(
handler_data
)
app
.
_handlePacket
(
Mock
(),
p2
,
handler
=
app
.
storage_handler
)
app
.
waitResponses
=
waitResponses
# start test here
result
=
app
.
history
(
oid
)
self
.
assertEqual
(
len
(
result
),
2
)
self
.
assertEqual
(
result
[
0
][
'tid'
],
tid2
)
self
.
assertEqual
(
result
[
1
][
'tid'
],
tid1
)
self
.
assertEqual
(
result
[
0
][
'size'
],
42
)
self
.
assertEqual
(
result
[
1
][
'size'
],
42
)
def
test_connectToPrimaryNode
(
self
):
def
test_connectToPrimaryNode
(
self
):
# here we have three master nodes :
# here we have three master nodes :
# the connection to the first will fail
# the connection to the first will fail
...
...
neo/tests/client/testStorageHandler.py
View file @
eff9cc88
...
@@ -205,18 +205,6 @@ class StorageAnswerHandlerTests(NeoUnitTestBase):
...
@@ -205,18 +205,6 @@ class StorageAnswerHandlerTests(NeoUnitTestBase):
'packed'
:
packed
,
'packed'
:
packed
,
},
ext
))
},
ext
))
def
test_answerObjectHistory
(
self
):
conn
=
self
.
getConnection
()
oid
=
self
.
getOID
(
0
)
history_list
=
[
self
.
getNextTID
(),
self
.
getNextTID
()]
history_set
=
set
()
app
=
Mock
({
'getHandlerData'
:
history_set
,
})
handler
=
StorageAnswersHandler
(
app
)
handler
.
answerObjectHistory
(
conn
,
oid
,
history_list
)
self
.
assertEqual
(
history_set
,
set
(
history_list
))
def
test_oidNotFound
(
self
):
def
test_oidNotFound
(
self
):
conn
=
self
.
getConnection
()
conn
=
self
.
getConnection
()
self
.
assertRaises
(
NEOStorageNotFoundError
,
self
.
handler
.
oidNotFound
,
self
.
assertRaises
(
NEOStorageNotFoundError
,
self
.
handler
.
oidNotFound
,
...
...
neo/tests/threaded/test.py
View file @
eff9cc88
...
@@ -41,6 +41,7 @@ class Test(NEOThreadedTest):
...
@@ -41,6 +41,7 @@ class Test(NEOThreadedTest):
c
.
root
()[
'with_resolution'
]
=
ob
=
PCounterWithResolution
()
c
.
root
()[
'with_resolution'
]
=
ob
=
PCounterWithResolution
()
t
.
commit
()
t
.
commit
()
self
.
assertEqual
(
ob
.
_p_changed
,
0
)
self
.
assertEqual
(
ob
.
_p_changed
,
0
)
oid
=
ob
.
_p_oid
tid1
=
ob
.
_p_serial
tid1
=
ob
.
_p_serial
self
.
assertNotEqual
(
tid1
,
ZERO_TID
)
self
.
assertNotEqual
(
tid1
,
ZERO_TID
)
del
ob
,
t
,
c
del
ob
,
t
,
c
...
@@ -69,6 +70,12 @@ class Test(NEOThreadedTest):
...
@@ -69,6 +70,12 @@ class Test(NEOThreadedTest):
tid3
=
o1
.
_p_serial
tid3
=
o1
.
_p_serial
self
.
assertTrue
(
tid2
<
tid3
)
self
.
assertTrue
(
tid2
<
tid3
)
self
.
assertEqual
(
tid3
,
o2
.
_p_serial
)
self
.
assertEqual
(
tid3
,
o2
.
_p_serial
)
# check history
history
=
c1
.
db
().
history
self
.
assertEqual
([
x
[
'tid'
]
for
x
in
history
(
oid
,
size
=
1
)],
[
tid3
])
self
.
assertEqual
([
x
[
'tid'
]
for
x
in
history
(
oid
,
size
=
10
)],
[
tid3
,
tid2
,
tid1
])
finally
:
finally
:
cluster
.
stop
()
cluster
.
stop
()
...
...
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