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
Levin Zimmermann
neoppod
Commits
ffa5f6fc
Commit
ffa5f6fc
authored
Jan 07, 2014
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix connection to storage when not connected to master
parent
9b05eff4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
53 deletions
+4
-53
neo/client/handlers/storage.py
neo/client/handlers/storage.py
+3
-2
neo/tests/client/testStorageHandler.py
neo/tests/client/testStorageHandler.py
+1
-51
No files found.
neo/client/handlers/storage.py
View file @
ffa5f6fc
...
...
@@ -50,8 +50,9 @@ class StorageBootstrapHandler(AnswerBaseHandler):
def
_acceptIdentification
(
self
,
node
,
uuid
,
num_partitions
,
num_replicas
,
your_uuid
,
primary
,
master_list
):
assert
primary
==
self
.
app
.
primary_master_node
.
getAddress
(),
(
primary
,
self
.
app
.
primary_master_node
)
assert
self
.
app
.
master_conn
is
None
or
\
primary
==
self
.
app
.
master_conn
.
getAddress
(),
(
primary
,
self
.
app
.
master_conn
)
assert
uuid
==
node
.
getUUID
(),
(
uuid
,
node
.
getUUID
())
class
StorageAnswersHandler
(
AnswerBaseHandler
):
...
...
neo/tests/client/testStorageHandler.py
View file @
ffa5f6fc
...
...
@@ -17,61 +17,11 @@
import
unittest
from
mock
import
Mock
from
..
import
NeoUnitTestBase
from
neo.lib.protocol
import
NodeTypes
from
neo.client.handlers.storage
import
StorageBootstrapHandler
,
\
StorageAnswersHandler
from
neo.client.handlers.storage
import
StorageAnswersHandler
from
neo.client.exception
import
NEOStorageError
,
NEOStorageNotFoundError
from
neo.client.exception
import
NEOStorageDoesNotExistError
from
neo.lib.exception
import
NodeNotReady
from
neo.lib.node
import
NodeManager
from
ZODB.TimeStamp
import
TimeStamp
MARKER
=
[]
class
StorageBootstrapHandlerTests
(
NeoUnitTestBase
):
def
setUp
(
self
):
super
(
StorageBootstrapHandlerTests
,
self
).
setUp
()
self
.
app
=
Mock
()
self
.
app
.
nm
=
NodeManager
()
self
.
handler
=
StorageBootstrapHandler
(
self
.
app
)
self
.
app
.
primary_master_node
=
node
=
Mock
({
'getConnection'
:
self
.
getFakeConnection
(),
'getUUID'
:
self
.
getMasterUUID
(),
'getAddress'
:
(
self
.
local_ip
,
2999
)
})
self
.
_next_port
=
3000
def
getKnownStorage
(
self
):
node
=
self
.
app
.
nm
.
createStorage
(
uuid
=
self
.
getStorageUUID
(),
address
=
(
self
.
local_ip
,
self
.
_next_port
),
)
self
.
_next_port
+=
1
conn
=
self
.
getFakeConnection
(
address
=
node
.
getAddress
(),
uuid
=
node
.
getUUID
())
node
.
setConnection
(
conn
)
return
node
,
conn
def
test_notReady
(
self
):
conn
=
self
.
getFakeConnection
()
self
.
assertRaises
(
NodeNotReady
,
self
.
handler
.
notReady
,
conn
,
'message'
)
def
test_acceptIdentification1
(
self
):
""" Not a storage node """
node
,
conn
=
self
.
getKnownStorage
()
self
.
handler
.
acceptIdentification
(
conn
,
NodeTypes
.
CLIENT
,
node
.
getUUID
(),
10
,
0
,
None
,
self
.
app
.
primary_master_node
.
getAddress
(),
[])
self
.
checkClosed
(
conn
)
def
test_acceptIdentification2
(
self
):
node
,
conn
=
self
.
getKnownStorage
()
self
.
handler
.
acceptIdentification
(
conn
,
NodeTypes
.
STORAGE
,
node
.
getUUID
(),
10
,
0
,
None
,
self
.
app
.
primary_master_node
.
getAddress
(),
[])
self
.
checkNotClosed
(
conn
)
class
StorageAnswerHandlerTests
(
NeoUnitTestBase
):
def
setUp
(
self
):
...
...
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