From c3c401baafc1d7aaba2b650effd9ca3fe177b7e3 Mon Sep 17 00:00:00 2001 From: Andrianto Lie Date: Thu, 28 Feb 2019 16:33:21 +0800 Subject: [PATCH] Enable cacheopen for the node relaunch --- tests/Node.py | 7 ++++--- tests/nodeos_irreversible_mode_test.py | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/Node.py b/tests/Node.py index 0b0e57dae2c..16eede1b46a 100644 --- a/tests/Node.py +++ b/tests/Node.py @@ -1204,7 +1204,7 @@ def kill(self, killSignal): else: os.kill(self.pid, killSignal) except OSError as ex: - Utils.Print("ERROR: Failed to kill node (%d)." % (self.cmd), ex) + Utils.Print("ERROR: Failed to kill node (%s)." % (self.cmd), ex) return False # wait for kill validation @@ -1365,8 +1365,9 @@ def isNodeAlive(): else: Utils.Print("ERROR: Node relaunch Failed.") # Ensure the node process is really killed - self.popenProc.send_signal(signal.SIGTERM) - self.popenProc.wait() + if self.popenProc: + self.popenProc.send_signal(signal.SIGTERM) + self.popenProc.wait() self.pid=None return False diff --git a/tests/nodeos_irreversible_mode_test.py b/tests/nodeos_irreversible_mode_test.py index 522dcfde251..1e8f9191a6a 100755 --- a/tests/nodeos_irreversible_mode_test.py +++ b/tests/nodeos_irreversible_mode_test.py @@ -120,7 +120,7 @@ def confirmHeadLibAndForkDbHeadOfSpecMode(nodeToTest, headLibAndForkDbHeadBefore "Fork db head ({}) should be equal to fork db head before switch mode ({}) ".format(forkDbHead, forkDbHeadBeforeSwitchMode) def relaunchNode(node: Node, nodeId, chainArg="", addOrSwapFlags=None, relaunchAssertMessage="Fail to relaunch"): - isRelaunchSuccess = node.relaunch(nodeId, chainArg=chainArg, addOrSwapFlags=addOrSwapFlags, timeout=relaunchTimeout) + isRelaunchSuccess = node.relaunch(nodeId, chainArg=chainArg, addOrSwapFlags=addOrSwapFlags, timeout=relaunchTimeout, cachePopen=True) assert isRelaunchSuccess, relaunchAssertMessage return isRelaunchSuccess @@ -153,7 +153,7 @@ def stopProdNode(): def startProdNode(): if producingNode.killed: - producingNode.relaunch(producingNodeId, "", timeout=relaunchTimeout) + relaunchNode(producingNode, producingNodeId) # Give some time for it to produce, so lib is advancing waitForBlksProducedAndLibAdvanced()