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
Carlos Ramos Carreño
neoppod
Commits
dfa346a6
Commit
dfa346a6
authored
Mar 06, 2017
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qa: in threaded tests, nodes can now be reset with a different configuration
parent
f2f44cd5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
15 deletions
+19
-15
neo/tests/threaded/__init__.py
neo/tests/threaded/__init__.py
+19
-15
No files found.
neo/tests/threaded/__init__.py
View file @
dfa346a6
...
@@ -268,6 +268,10 @@ class TestSerialized(Serialized):
...
@@ -268,6 +268,10 @@ class TestSerialized(Serialized):
class
Node
(
object
):
class
Node
(
object
):
@
staticmethod
def
convertInitArgs
(
**
kw
):
return
{
'get'
+
k
.
capitalize
():
v
for
k
,
v
in
kw
.
iteritems
()}
def
getConnectionList
(
self
,
*
peers
):
def
getConnectionList
(
self
,
*
peers
):
addr
=
lambda
c
:
c
and
(
c
.
addr
if
c
.
is_server
else
c
.
getAddress
())
addr
=
lambda
c
:
c
and
(
c
.
addr
if
c
.
is_server
else
c
.
getAddress
())
addr_set
=
{
addr
(
c
.
connector
)
for
peer
in
peers
addr_set
=
{
addr
(
c
.
connector
)
for
peer
in
peers
...
@@ -338,11 +342,15 @@ class ServerNode(Node):
...
@@ -338,11 +342,15 @@ class ServerNode(Node):
def
getVirtualAddress
(
self
):
def
getVirtualAddress
(
self
):
return
self
.
_init_args
[
'address'
]
return
self
.
_init_args
[
'address'
]
def
resetNode
(
self
):
def
resetNode
(
self
,
**
kw
):
assert
not
self
.
is_alive
()
assert
not
self
.
is_alive
()
kw
=
self
.
_init_args
kw
=
self
.
convertInitArgs
(
**
kw
)
init_args
=
self
.
_init_args
init_args
[
'getReset'
]
=
False
assert
set
(
kw
).
issubset
(
init_args
),
(
kw
,
init_args
)
init_args
.
update
(
kw
)
self
.
close
()
self
.
close
()
self
.
__init__
(
**
kw
)
self
.
__init__
(
**
init_args
)
def
start
(
self
):
def
start
(
self
):
Serialized
(
self
)
Serialized
(
self
)
...
@@ -382,10 +390,6 @@ class StorageApplication(ServerNode, neo.storage.app.Application):
...
@@ -382,10 +390,6 @@ class StorageApplication(ServerNode, neo.storage.app.Application):
dm
=
type
(
''
,
(),
{
'close'
:
lambda
self
:
None
})()
dm
=
type
(
''
,
(),
{
'close'
:
lambda
self
:
None
})()
def
resetNode
(
self
,
clear_database
=
False
):
self
.
_init_args
[
'getReset'
]
=
clear_database
super
(
StorageApplication
,
self
).
resetNode
()
def
_afterRun
(
self
):
def
_afterRun
(
self
):
super
(
StorageApplication
,
self
).
_afterRun
()
super
(
StorageApplication
,
self
).
_afterRun
()
try
:
try
:
...
@@ -651,10 +655,10 @@ class NEOCluster(object):
...
@@ -651,10 +655,10 @@ class NEOCluster(object):
master_list
=
[
MasterApplication
.
newAddress
()
master_list
=
[
MasterApplication
.
newAddress
()
for
_
in
xrange
(
master_count
)]
for
_
in
xrange
(
master_count
)]
self
.
master_nodes
=
' '
.
join
(
'%s:%s'
%
x
for
x
in
master_list
)
self
.
master_nodes
=
' '
.
join
(
'%s:%s'
%
x
for
x
in
master_list
)
weak_self
=
weakref
.
proxy
(
self
)
kw
=
Node
.
convertInitArgs
(
replicas
=
replicas
,
adapter
=
adapter
,
kw
=
dict
(
cluster
=
weak_self
,
getReplicas
=
replicas
,
getAdapter
=
adapter
,
partitions
=
partitions
,
reset
=
clear_databases
)
getPartitions
=
partitions
,
getReset
=
clear_databases
,
kw
[
'cluster'
]
=
weak_self
=
weakref
.
proxy
(
self
)
getSSL
=
self
.
SSL
)
kw
[
'getSSL'
]
=
self
.
SSL
if
upstream
is
not
None
:
if
upstream
is
not
None
:
self
.
upstream
=
weakref
.
proxy
(
upstream
)
self
.
upstream
=
weakref
.
proxy
(
upstream
)
kw
.
update
(
getUpstreamCluster
=
upstream
.
name
,
kw
.
update
(
getUpstreamCluster
=
upstream
.
name
,
...
@@ -758,7 +762,7 @@ class NEOCluster(object):
...
@@ -758,7 +762,7 @@ class NEOCluster(object):
assert
state
in
(
ClusterStates
.
RUNNING
,
ClusterStates
.
BACKINGUP
),
state
assert
state
in
(
ClusterStates
.
RUNNING
,
ClusterStates
.
BACKINGUP
),
state
self
.
enableStorageList
(
storage_list
)
self
.
enableStorageList
(
storage_list
)
def
stop
(
self
,
clear_database
=
False
,
__print_exc
=
traceback
.
print_exc
):
def
stop
(
self
,
clear_database
=
False
,
__print_exc
=
traceback
.
print_exc
,
**
kw
):
if
self
.
started
:
if
self
.
started
:
del
self
.
started
del
self
.
started
logging
.
debug
(
"stopping %s"
,
self
)
logging
.
debug
(
"stopping %s"
,
self
)
...
@@ -786,11 +790,11 @@ class NEOCluster(object):
...
@@ -786,11 +790,11 @@ class NEOCluster(object):
raise
raise
else
:
else
:
for
node_type
in
'master'
,
'storage'
,
'admin'
:
for
node_type
in
'master'
,
'storage'
,
'admin'
:
kw
=
{}
reset_kw
=
kw
.
copy
()
if
node_type
==
'storage'
:
if
node_type
==
'storage'
:
kw
[
'clear_database
'
]
=
clear_database
reset_kw
[
'reset
'
]
=
clear_database
for
node
in
getattr
(
self
,
node_type
+
'_list'
):
for
node
in
getattr
(
self
,
node_type
+
'_list'
):
node
.
resetNode
(
**
kw
)
node
.
resetNode
(
**
reset_
kw
)
def
_newClient
(
self
):
def
_newClient
(
self
):
return
ClientApplication
(
name
=
self
.
name
,
master_nodes
=
self
.
master_nodes
,
return
ClientApplication
(
name
=
self
.
name
,
master_nodes
=
self
.
master_nodes
,
...
...
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