Commit 2c0bf157 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Nodes are initialy in unknown state since r1192, fix tests.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1472 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 60700d00
...@@ -69,18 +69,18 @@ class MasterPartitionTableTests(NeoTestBase): ...@@ -69,18 +69,18 @@ class MasterPartitionTableTests(NeoTestBase):
# add nodes # add nodes
uuid1 = self.getNewUUID() uuid1 = self.getNewUUID()
server1 = ("127.0.0.1", 19001) server1 = ("127.0.0.1", 19001)
sn1 = StorageNode(Mock(), server1, uuid1) sn1 = StorageNode(Mock(), server1, uuid1, NodeStates.RUNNING)
pt.setCell(0, sn1, CellStates.UP_TO_DATE) pt.setCell(0, sn1, CellStates.UP_TO_DATE)
pt.setCell(1, sn1, CellStates.UP_TO_DATE) pt.setCell(1, sn1, CellStates.UP_TO_DATE)
pt.setCell(2, sn1, CellStates.UP_TO_DATE) pt.setCell(2, sn1, CellStates.UP_TO_DATE)
uuid2 = self.getNewUUID() uuid2 = self.getNewUUID()
server2 = ("127.0.0.2", 19001) server2 = ("127.0.0.2", 19001)
sn2 = StorageNode(Mock(), server2, uuid2) sn2 = StorageNode(Mock(), server2, uuid2, NodeStates.RUNNING)
pt.setCell(0, sn2, CellStates.UP_TO_DATE) pt.setCell(0, sn2, CellStates.UP_TO_DATE)
pt.setCell(1, sn2, CellStates.UP_TO_DATE) pt.setCell(1, sn2, CellStates.UP_TO_DATE)
uuid3 = self.getNewUUID() uuid3 = self.getNewUUID()
server3 = ("127.0.0.3", 19001) server3 = ("127.0.0.3", 19001)
sn3 = StorageNode(Mock(), server3, uuid3) sn3 = StorageNode(Mock(), server3, uuid3, NodeStates.RUNNING)
pt.setCell(0, sn3, CellStates.UP_TO_DATE) pt.setCell(0, sn3, CellStates.UP_TO_DATE)
# test # test
node = pt.findLeastUsedNode() node = pt.findLeastUsedNode()
...@@ -298,16 +298,16 @@ class MasterPartitionTableTests(NeoTestBase): ...@@ -298,16 +298,16 @@ class MasterPartitionTableTests(NeoTestBase):
# add nodes # add nodes
uuid1 = self.getNewUUID() uuid1 = self.getNewUUID()
server1 = ("127.0.0.1", 19001) server1 = ("127.0.0.1", 19001)
sn1 = StorageNode(Mock(), server1, uuid1) sn1 = StorageNode(Mock(), server1, uuid1, NodeStates.RUNNING)
uuid2 = self.getNewUUID() uuid2 = self.getNewUUID()
server2 = ("127.0.0.2", 19002) server2 = ("127.0.0.2", 19002)
sn2 = StorageNode(Mock(), server2, uuid2) sn2 = StorageNode(Mock(), server2, uuid2, NodeStates.RUNNING)
uuid3 = self.getNewUUID() uuid3 = self.getNewUUID()
server3 = ("127.0.0.3", 19001) server3 = ("127.0.0.3", 19001)
sn3 = StorageNode(Mock(), server3, uuid3) sn3 = StorageNode(Mock(), server3, uuid3, NodeStates.RUNNING)
uuid4 = self.getNewUUID() uuid4 = self.getNewUUID()
server4 = ("127.0.0.4", 19001) server4 = ("127.0.0.4", 19001)
sn4 = StorageNode(Mock(), server4, uuid4) sn4 = StorageNode(Mock(), server4, uuid4, NodeStates.RUNNING)
# partition looks like: # partition looks like:
# 0 : sn1, sn2 # 0 : sn1, sn2
# 1 : sn1, sn3 # 1 : sn1, sn3
...@@ -365,7 +365,7 @@ class MasterPartitionTableTests(NeoTestBase): ...@@ -365,7 +365,7 @@ class MasterPartitionTableTests(NeoTestBase):
# add nodes # add nodes
uuid1 = self.getNewUUID() uuid1 = self.getNewUUID()
server1 = ("127.0.0.1", 19001) server1 = ("127.0.0.1", 19001)
sn1 = StorageNode(Mock(), server1, uuid1) sn1 = StorageNode(Mock(), server1, uuid1, NodeStates.RUNNING)
# add not running node # add not running node
uuid2 = self.getNewUUID() uuid2 = self.getNewUUID()
server2 = ("127.0.0.2", 19001) server2 = ("127.0.0.2", 19001)
...@@ -373,14 +373,14 @@ class MasterPartitionTableTests(NeoTestBase): ...@@ -373,14 +373,14 @@ class MasterPartitionTableTests(NeoTestBase):
sn2.setState(NodeStates.TEMPORARILY_DOWN) sn2.setState(NodeStates.TEMPORARILY_DOWN)
# add node without uuid # add node without uuid
server3 = ("127.0.0.3", 19001) server3 = ("127.0.0.3", 19001)
sn3 = StorageNode(Mock(), server3, None) sn3 = StorageNode(Mock(), server3, None, NodeStates.RUNNING)
# add clear node # add clear node
uuid4 = self.getNewUUID() uuid4 = self.getNewUUID()
server4 = ("127.0.0.4", 19001) server4 = ("127.0.0.4", 19001)
sn4 = StorageNode(Mock(), server4, uuid4) sn4 = StorageNode(Mock(), server4, uuid4, NodeStates.RUNNING)
uuid5 = self.getNewUUID() uuid5 = self.getNewUUID()
server5 = ("127.0.0.5", 1900) server5 = ("127.0.0.5", 1900)
sn5 = StorageNode(Mock(), server5, uuid5) sn5 = StorageNode(Mock(), server5, uuid5, NodeStates.RUNNING)
# make the table # make the table
pt.make([sn1, sn2, sn3, sn4, sn5,]) pt.make([sn1, sn2, sn3, sn4, sn5,])
# check it's ok, only running nodes and node with uuid # check it's ok, only running nodes and node with uuid
...@@ -419,19 +419,19 @@ class MasterPartitionTableTests(NeoTestBase): ...@@ -419,19 +419,19 @@ class MasterPartitionTableTests(NeoTestBase):
# create nodes # create nodes
uuid1 = self.getNewUUID() uuid1 = self.getNewUUID()
server1 = ("127.0.0.1", 19001) server1 = ("127.0.0.1", 19001)
sn1 = StorageNode(Mock(), server1, uuid1) sn1 = StorageNode(Mock(), server1, uuid1, NodeStates.RUNNING)
uuid2 = self.getNewUUID() uuid2 = self.getNewUUID()
server2 = ("127.0.0.2", 19002) server2 = ("127.0.0.2", 19002)
sn2 = StorageNode(Mock(), server2, uuid2) sn2 = StorageNode(Mock(), server2, uuid2, NodeStates.RUNNING)
uuid3 = self.getNewUUID() uuid3 = self.getNewUUID()
server3 = ("127.0.0.3", 19003) server3 = ("127.0.0.3", 19003)
sn3 = StorageNode(Mock(), server3, uuid3) sn3 = StorageNode(Mock(), server3, uuid3, NodeStates.RUNNING)
uuid4 = self.getNewUUID() uuid4 = self.getNewUUID()
server4 = ("127.0.0.4", 19004) server4 = ("127.0.0.4", 19004)
sn4 = StorageNode(Mock(), server4, uuid4) sn4 = StorageNode(Mock(), server4, uuid4, NodeStates.RUNNING)
uuid5 = self.getNewUUID() uuid5 = self.getNewUUID()
server5 = ("127.0.0.5", 19005) server5 = ("127.0.0.5", 19005)
sn5 = StorageNode(Mock(), server5, uuid5) sn5 = StorageNode(Mock(), server5, uuid5, NodeStates.RUNNING)
# create partition table # create partition table
# 0 : sn1(discarded), sn2(up), -> sn2 must remain # 0 : sn1(discarded), sn2(up), -> sn2 must remain
# 1 : sn1(feeding), sn2(feeding), sn3(up) -> one feeding and sn3 must remain # 1 : sn1(feeding), sn2(feeding), sn3(up) -> one feeding and sn3 must remain
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment