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
Iliya Manolov
neoppod
Commits
8552935d
Commit
8552935d
authored
Jan 02, 2012
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use consistent port/node relationship in tests.
parent
62f142d3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
11 deletions
+12
-11
neo/tests/client/testClientApp.py
neo/tests/client/testClientApp.py
+2
-2
neo/tests/master/testClientHandler.py
neo/tests/master/testClientHandler.py
+9
-8
neo/tests/master/testStorageHandler.py
neo/tests/master/testStorageHandler.py
+1
-1
No files found.
neo/tests/client/testClientApp.py
View file @
8552935d
...
@@ -559,7 +559,7 @@ class ClientApplicationTests(NeoUnitTestBase):
...
@@ -559,7 +559,7 @@ class ClientApplicationTests(NeoUnitTestBase):
conn
=
Mock
({
conn
=
Mock
({
'getNextId'
:
1
,
'getNextId'
:
1
,
'fakeReceived'
:
transaction_info
,
'fakeReceived'
:
transaction_info
,
'getAddress'
:
(
'127.0.0.1'
,
100
1
0
),
'getAddress'
:
(
'127.0.0.1'
,
100
2
0
),
})
})
node
=
app
.
nm
.
createStorage
(
address
=
conn
.
getAddress
())
node
=
app
.
nm
.
createStorage
(
address
=
conn
.
getAddress
())
app
.
cp
=
Mock
({
app
.
cp
=
Mock
({
...
@@ -742,7 +742,7 @@ class ClientApplicationTests(NeoUnitTestBase):
...
@@ -742,7 +742,7 @@ class ClientApplicationTests(NeoUnitTestBase):
'getUUID'
:
ReturnValues
(
uuid1
,
uuid2
),
'getUUID'
:
ReturnValues
(
uuid1
,
uuid2
),
'fakeGetApp'
:
app
,
'fakeGetApp'
:
app
,
'fakeReceived'
:
ReturnValues
(
p3
,
p4
),
'fakeReceived'
:
ReturnValues
(
p3
,
p4
),
'getAddress'
:
(
'127.0.0.1'
,
100
10
),
'getAddress'
:
(
'127.0.0.1'
,
100
21
),
})
})
storage_1_conn
=
Mock
()
storage_1_conn
=
Mock
()
storage_2_conn
=
Mock
()
storage_2_conn
=
Mock
()
...
...
neo/tests/master/testClientHandler.py
View file @
8552935d
...
@@ -43,9 +43,12 @@ class MasterClientHandlerTests(NeoUnitTestBase):
...
@@ -43,9 +43,12 @@ class MasterClientHandlerTests(NeoUnitTestBase):
self
.
master_address
=
(
'127.0.0.1'
,
self
.
master_port
)
self
.
master_address
=
(
'127.0.0.1'
,
self
.
master_port
)
self
.
client_address
=
(
'127.0.0.1'
,
self
.
client_port
)
self
.
client_address
=
(
'127.0.0.1'
,
self
.
client_port
)
self
.
storage_address
=
(
'127.0.0.1'
,
self
.
storage_port
)
self
.
storage_address
=
(
'127.0.0.1'
,
self
.
storage_port
)
self
.
storage_uuid
=
self
.
getNewUUID
()
# register the storage
# register the storage
kw
=
{
'uuid'
:
self
.
getNewUUID
(),
'address'
:
self
.
master_address
}
self
.
app
.
nm
.
createStorage
(
self
.
app
.
nm
.
createStorage
(
**
kw
)
uuid
=
self
.
storage_uuid
,
address
=
self
.
storage_address
,
)
def
getLastUUID
(
self
):
def
getLastUUID
(
self
):
return
self
.
uuid
return
self
.
uuid
...
@@ -109,16 +112,14 @@ class MasterClientHandlerTests(NeoUnitTestBase):
...
@@ -109,16 +112,14 @@ class MasterClientHandlerTests(NeoUnitTestBase):
def
test_09_askFinishTransaction
(
self
):
def
test_09_askFinishTransaction
(
self
):
service
=
self
.
service
service
=
self
.
service
uuid
=
self
.
identifyToMasterNode
()
# do the right job
# do the right job
client_uuid
=
self
.
identifyToMasterNode
(
node_type
=
NodeTypes
.
CLIENT
,
port
=
self
.
client_port
)
client_uuid
=
self
.
identifyToMasterNode
(
node_type
=
NodeTypes
.
CLIENT
,
port
=
self
.
client_port
)
storage_uuid
=
self
.
identifyToMasterNode
()
storage_uuid
=
self
.
storage_uuid
storage_conn
=
self
.
getFakeConnection
(
storage_uuid
,
self
.
storage_address
)
storage_conn
=
self
.
getFakeConnection
(
storage_uuid
,
self
.
storage_address
)
storage2_uuid
=
self
.
identifyToMasterNode
()
storage2_uuid
=
self
.
identifyToMasterNode
(
port
=
10022
)
storage2_conn
=
self
.
getFakeConnection
(
storage2_uuid
,
storage2_conn
=
self
.
getFakeConnection
(
storage2_uuid
,
(
self
.
storage_address
[
0
],
self
.
storage_address
[
1
]
+
1
))
(
self
.
storage_address
[
0
],
self
.
storage_address
[
1
]
+
1
))
self
.
app
.
setStorageReady
(
storage2_uuid
)
self
.
app
.
setStorageReady
(
storage2_uuid
)
self
.
assertNotEqual
(
uuid
,
client_uuid
)
conn
=
self
.
getFakeConnection
(
client_uuid
,
self
.
client_address
)
conn
=
self
.
getFakeConnection
(
client_uuid
,
self
.
client_address
)
self
.
app
.
pt
=
Mock
({
self
.
app
.
pt
=
Mock
({
'getPartition'
:
0
,
'getPartition'
:
0
,
...
@@ -182,7 +183,7 @@ class MasterClientHandlerTests(NeoUnitTestBase):
...
@@ -182,7 +183,7 @@ class MasterClientHandlerTests(NeoUnitTestBase):
tid
=
self
.
getNextTID
()
tid
=
self
.
getNextTID
()
peer_id
=
42
peer_id
=
42
conn
=
self
.
getFakeConnection
(
peer_id
=
peer_id
)
conn
=
self
.
getFakeConnection
(
peer_id
=
peer_id
)
storage_uuid
=
self
.
identifyToMasterNode
()
storage_uuid
=
self
.
storage_uuid
storage_conn
=
self
.
getFakeConnection
(
storage_uuid
,
storage_conn
=
self
.
getFakeConnection
(
storage_uuid
,
self
.
storage_address
)
self
.
storage_address
)
self
.
app
.
nm
.
getByUUID
(
storage_uuid
).
setConnection
(
storage_conn
)
self
.
app
.
nm
.
getByUUID
(
storage_uuid
).
setConnection
(
storage_conn
)
...
@@ -195,7 +196,7 @@ class MasterClientHandlerTests(NeoUnitTestBase):
...
@@ -195,7 +196,7 @@ class MasterClientHandlerTests(NeoUnitTestBase):
self
.
assertEqual
(
self
.
app
.
packing
[
1
],
peer_id
)
self
.
assertEqual
(
self
.
app
.
packing
[
1
],
peer_id
)
self
.
assertEqual
(
self
.
app
.
packing
[
2
],
set
([
storage_uuid
,
]))
self
.
assertEqual
(
self
.
app
.
packing
[
2
],
set
([
storage_uuid
,
]))
# Asking again to pack will cause an immediate error
# Asking again to pack will cause an immediate error
storage_uuid
=
self
.
identifyToMasterNode
()
storage_uuid
=
self
.
identifyToMasterNode
(
port
=
10022
)
storage_conn
=
self
.
getFakeConnection
(
storage_uuid
,
storage_conn
=
self
.
getFakeConnection
(
storage_uuid
,
self
.
storage_address
)
self
.
storage_address
)
self
.
app
.
nm
.
getByUUID
(
storage_uuid
).
setConnection
(
storage_conn
)
self
.
app
.
nm
.
getByUUID
(
storage_uuid
).
setConnection
(
storage_conn
)
...
...
neo/tests/master/testStorageHandler.py
View file @
8552935d
...
@@ -159,7 +159,7 @@ class MasterStorageHandlerTests(NeoUnitTestBase):
...
@@ -159,7 +159,7 @@ class MasterStorageHandlerTests(NeoUnitTestBase):
state
=
NodeStates
.
TEMPORARILY_DOWN
state
=
NodeStates
.
TEMPORARILY_DOWN
# define two nodes
# define two nodes
node1
,
conn1
=
self
.
identifyToMasterNode
()
node1
,
conn1
=
self
.
identifyToMasterNode
()
node2
,
conn2
=
self
.
identifyToMasterNode
()
node2
,
conn2
=
self
.
identifyToMasterNode
(
port
=
10022
)
node1
.
setRunning
()
node1
.
setRunning
()
node2
.
setRunning
()
node2
.
setRunning
()
self
.
assertEqual
(
node1
.
getState
(),
NodeStates
.
RUNNING
)
self
.
assertEqual
(
node1
.
getState
(),
NodeStates
.
RUNNING
)
...
...
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