Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small Misc python test improvements #575

Merged
merged 2 commits into from
Dec 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions tests/TestHarness/Node.py
Original file line number Diff line number Diff line change
Expand Up @@ -821,8 +821,9 @@ def publishContract(self, account, contractDir, wasmFile, abiFile, waitForTransB
except subprocess.CalledProcessError as ex:
if not shouldFail:
end=time.perf_counter()
out=ex.output.decode("utf-8")
msg=ex.stderr.decode("utf-8")
Utils.Print("ERROR: Exception during set contract. cmd Duration: %.3f sec. %s" % (end-start, msg))
Utils.Print("ERROR: Exception during set contract. stderr: %s. stdout: %s. cmd Duration: %.3f sec." % (msg, out, end-start))
greg7mdp marked this conversation as resolved.
Show resolved Hide resolved
return None
else:
retMap={}
Expand Down Expand Up @@ -905,13 +906,15 @@ def pushTransaction(self, trans, opts="", silentErrors=False, permissions=None):
return (False, msg)

# returns tuple with transaction execution status and transaction
def pushMessage(self, account, action, data, opts, silentErrors=False, signatures=None, expectTrxTrace=True):
def pushMessage(self, account, action, data, opts, silentErrors=False, signatures=None, expectTrxTrace=True, force=False):
cmd="%s %s push action -j %s %s" % (Utils.EosClientPath, self.eosClientArgs(), account, action)
cmdArr=cmd.split()
# not using __sign_str, since cmdArr messes up the string
if signatures is not None:
cmdArr.append("--sign-with")
cmdArr.append("[ \"%s\" ]" % ("\", \"".join(signatures)))
if force:
cmdArr.append("-f")
if data is not None:
cmdArr.append(data)
if opts is not None:
Expand All @@ -927,9 +930,10 @@ def pushMessage(self, account, action, data, opts, silentErrors=False, signature
return (Node.getTransStatus(trans) == 'executed' if expectTrxTrace else True, trans)
except subprocess.CalledProcessError as ex:
msg=ex.stderr.decode("utf-8")
output=ex.output.decode("utf-8")
if not silentErrors:
end=time.perf_counter()
Utils.Print("ERROR: Exception during push message. cmd Duration=%.3f sec. %s" % (end - start, msg))
Utils.Print("ERROR: Exception during push message. stderr: %s. stdout: %s. cmd Duration=%.3f sec." % (msg, output, end - start))
return (False, msg)

@staticmethod
Expand Down Expand Up @@ -1027,8 +1031,9 @@ def processCleosCmd(self, cmd, cmdDesc, silentErrors=True, exitOnError=False, ex
except subprocess.CalledProcessError as ex:
if not silentErrors:
end=time.perf_counter()
out=ex.output.decode("utf-8")
msg=ex.stderr.decode("utf-8")
errorMsg="Exception during \"%s\". Exception message: %s. cmd Duration=%.3f sec. %s" % (cmdDesc, msg, end-start, exitMsg)
errorMsg="Exception during \"%s\". Exception message: %s. stdout: %s. cmd Duration=%.3f sec. %s" % (cmdDesc, msg, out, end-start, exitMsg)
if exitOnError:
Utils.cmdError(errorMsg)
Utils.errorExit(errorMsg)
Expand Down
2 changes: 1 addition & 1 deletion tests/TestHarness/WalletMgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def launch(self):
statusMsg+=" port %d is NOT available." % (self.port)
Utils.Print("Launching %s, note similar processes running. %s" % (Utils.EosWalletName, statusMsg))

cmd="%s --data-dir %s --config-dir %s --http-server-address=%s:%d --http-max-response-time-ms 99999 --verbose-http-errors" % (
cmd="%s --data-dir %s --config-dir %s --unlock-timeout=999999 --http-server-address=%s:%d --http-max-response-time-ms 99999 --verbose-http-errors" % (
Utils.EosWalletPath, WalletMgr.__walletDataDir, WalletMgr.__walletDataDir, self.host, self.port)
if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
with open(WalletMgr.__walletLogOutFile, 'w') as sout, open(WalletMgr.__walletLogErrFile, 'w') as serr:
Expand Down