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
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
49631a9f
Commit
49631a9f
authored
Sep 11, 2017
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qa: bug found in assignment of storage node ids, add test
parent
aeeaef89
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
1 deletion
+31
-1
neo/tests/threaded/test.py
neo/tests/threaded/test.py
+31
-1
No files found.
neo/tests/threaded/test.py
View file @
49631a9f
...
...
@@ -32,7 +32,7 @@ from neo.storage.transactions import TransactionManager, ConflictError
from
neo.lib.connection
import
ConnectionClosed
,
\
ServerConnection
,
MTClientConnection
from
neo.lib.exception
import
DatabaseFailure
,
StoppedOperation
from
neo.lib.handler
import
DelayEvent
from
neo.lib.handler
import
DelayEvent
,
EventHandler
from
neo.lib
import
logging
from
neo.lib.protocol
import
(
CellStates
,
ClusterStates
,
NodeStates
,
NodeTypes
,
Packets
,
Packet
,
uuid_str
,
ZERO_OID
,
ZERO_TID
,
MAX_TID
)
...
...
@@ -2321,6 +2321,36 @@ class Test(NEOThreadedTest):
self
.
assertFalse
(
m1
.
primary
)
self
.
assertTrue
(
m1
.
is_alive
())
@
with_cluster
(
start_cluster
=
0
,
master_count
=
2
,
partitions
=
2
,
storage_count
=
2
,
autostart
=
2
)
def
testSplitBrainAtCreation
(
self
,
cluster
):
"""
Check cluster creation when storage nodes are identified before all
masters see each other and elect a primary.
XXX: Do storage nodes need a node id before the cluster is created ?
Another solution is that they treat their ids as temporary as long
as the partition table is empty.
"""
for
m
,
s
in
zip
((
min
,
max
),
cluster
.
storage_list
):
s
.
nm
.
remove
(
m
(
s
.
nm
.
getMasterList
(),
key
=
lambda
node
:
node
.
getAddress
()))
with
ConnectionFilter
()
as
f
:
f
.
add
(
lambda
conn
,
packet
:
isinstance
(
packet
,
Packets
.
RequestIdentification
)
and
packet
.
decode
()[
0
]
==
NodeTypes
.
MASTER
)
cluster
.
start
(
recovering
=
True
)
neoctl
=
cluster
.
neoctl
getClusterState
=
neoctl
.
getClusterState
getStorageList
=
lambda
:
neoctl
.
getNodeList
(
NodeTypes
.
STORAGE
)
self
.
assertEqual
(
getClusterState
(),
ClusterStates
.
RECOVERING
)
self
.
assertEqual
(
1
,
len
(
getStorageList
()))
with
Patch
(
EventHandler
,
protocolError
=
lambda
*
_
:
sys
.
exit
()):
self
.
tic
()
expectedFailure
(
self
.
assertEqual
)(
neoctl
.
getClusterState
(),
ClusterStates
.
RUNNING
)
self
.
assertEqual
({
1
:
NodeStates
.
RUNNING
,
2
:
NodeStates
.
RUNNING
},
{
x
[
2
]:
x
[
3
]
for
x
in
neoctl
.
getNodeList
(
NodeTypes
.
STORAGE
)})
@
with_cluster
(
partitions
=
2
,
storage_count
=
2
)
def
testStorageBackendLastIDs
(
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