Commit e7ddd2df authored by Grégory Wisniewski's avatar Grégory Wisniewski

Bug fix: Accept empty storage node after startup was allowed.

Add a related test case.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1669 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 11d55e48
......@@ -42,7 +42,7 @@ class RecoveryManager(MasterHandler):
"""
Returns the handler for storage nodes
"""
if uuid is None and self.app._startup_allowed:
if uuid is None and not self.app._startup_allowed:
logging.info('reject empty storage node')
raise NotReadyError
return (uuid, NodeStates.RUNNING, self)
......
......@@ -52,8 +52,8 @@ class StorageTests(NEOFunctionalTest):
port_base=20000, master_node_count=master_node_count,
partitions=partitions, replicas=replicas,
temp_dir=self.getTempDirectory(),
clear_databases=True,
)
self.neo.setupDB()
# too many pending storage nodes requested
assert pending_number <= storage_number
storage_processes = self.neo.getStorageProcessList()
......@@ -434,6 +434,20 @@ class StorageTests(NEOFunctionalTest):
self.__expectPending(started[0])
self.__expectRunning(started[1])
def testAcceptFirstEmptyStorageAfterStartupAllowed(self):
""" Create a new cluster with no storage node, allow it to starts
then run the first empty storage, it must be accepted """
(started, stopped) = self.__setup(storage_number=1, replicas=0,
pending_number=1, partitions=10)
# start without storage
self.neo.expectClusterRecovering()
self.__expectNotKnown(stopped[0])
# start the empty storage, it must be accepted
stopped[0].start(with_uuid=False)
self.neo.expectClusterRunning()
self.assertEqual(len(self.neo.getStorageList()), 1)
self.neo.expectOudatedCells(number=0)
if __name__ == "__main__":
unittest.main()
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