Commit d112bfbd authored by Julien Muchembled's avatar Julien Muchembled

neoctl: do not wait forever if master disconnects

parent 57956ec9
......@@ -42,14 +42,10 @@ class CommandEventHandler(EventHandler):
super(CommandEventHandler, self).connectionFailed(conn)
self.__disconnected()
def ack(self, conn, msg):
self.__respond((Packets.Error, ErrorCodes.ACK, msg))
def denied(self, conn, msg):
sys.exit(msg)
def notReady(self, conn, msg):
self.__respond((Packets.Error, ErrorCodes.NOT_READY, msg))
def error(self, conn, code, message, **kw):
if code == ErrorCodes.DENIED:
sys.exit(message)
self.__respond((Packets.Error, code, message))
def __answer(packet_type):
def answer(self, conn, *args):
......
......@@ -2856,6 +2856,15 @@ class Test(NEOThreadedTest):
self.assertRaises(SystemExit, cluster.neoctl.setClusterState,
ClusterStates.STARTING_BACKUP)
@with_cluster()
def testNeoctlVsDisconnectingMaster(self, cluster):
def setClusterState(orig, conn, *args):
conn.close()
with Patch(cluster.master.administration_handler,
setClusterState=setClusterState):
self.assertRaises(RuntimeError, cluster.neoctl.setClusterState,
ClusterStates.STARTING_BACKUP)
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