Skip to content

Commit

Permalink
GH-1716 Improve read_only_trx_test.py so it can be run without debug …
Browse files Browse the repository at this point in the history
…logging and report specific information when it does fail. Update the test to run without debug in ci/cd so that it can run faster and put more load on nodeos.
  • Loading branch information
heifner committed Oct 4, 2023
1 parent 7ba7d14 commit 18add6b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
8 changes: 4 additions & 4 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@ add_test(NAME nodeos_protocol_feature_test COMMAND tests/nodeos_protocol_feature
set_property(TEST nodeos_protocol_feature_test PROPERTY LABELS nonparallelizable_tests)
add_test(NAME compute_transaction_test COMMAND tests/compute_transaction_test.py -v -p 2 -n 3 ${UNSHARE} WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
set_property(TEST compute_transaction_test PROPERTY LABELS nonparallelizable_tests)
add_test(NAME read-only-trx-basic-test COMMAND tests/read_only_trx_test.py -v -p 2 -n 3 --read-only-threads 1 ${UNSHARE} WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
add_test(NAME read-only-trx-basic-test COMMAND tests/read_only_trx_test.py -p 2 -n 3 --read-only-threads 1 ${UNSHARE} WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
set_property(TEST read-only-trx-basic-test PROPERTY LABELS nonparallelizable_tests)
add_test(NAME read-only-trx-parallel-test COMMAND tests/read_only_trx_test.py -v -p 2 -n 3 --read-only-threads 16 --num-test-runs 3 ${UNSHARE} WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
add_test(NAME read-only-trx-parallel-test COMMAND tests/read_only_trx_test.py -p 2 -n 3 --read-only-threads 16 --num-test-runs 3 ${UNSHARE} WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
set_property(TEST read-only-trx-parallel-test PROPERTY LABELS nonparallelizable_tests)
add_test(NAME read-only-trx-parallel-eos-vm-oc-test COMMAND tests/read_only_trx_test.py -v -p 2 -n 3 --eos-vm-oc-enable all --read-only-threads 16 --num-test-runs 3 ${UNSHARE} WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
add_test(NAME read-only-trx-parallel-eos-vm-oc-test COMMAND tests/read_only_trx_test.py -p 2 -n 3 --eos-vm-oc-enable all --read-only-threads 16 --num-test-runs 3 ${UNSHARE} WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
set_property(TEST read-only-trx-parallel-eos-vm-oc-test PROPERTY LABELS nonparallelizable_tests)
add_test(NAME read-only-trx-parallel-no-oc-test COMMAND tests/read_only_trx_test.py -v -p 2 -n 3 --eos-vm-oc-enable none --read-only-threads 6 --num-test-runs 2 ${UNSHARE} WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
add_test(NAME read-only-trx-parallel-no-oc-test COMMAND tests/read_only_trx_test.py -p 2 -n 3 --eos-vm-oc-enable none --read-only-threads 6 --num-test-runs 2 ${UNSHARE} WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
set_property(TEST read-only-trx-parallel-no-oc-test PROPERTY LABELS nonparallelizable_tests)
add_test(NAME subjective_billing_test COMMAND tests/subjective_billing_test.py -v -p 2 -n 4 ${UNSHARE} WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
set_property(TEST subjective_billing_test PROPERTY LABELS nonparallelizable_tests)
Expand Down
11 changes: 8 additions & 3 deletions tests/read_only_trx_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import threading
import os
import platform
import traceback

from TestHarness import Account, Cluster, ReturnType, TestHelper, Utils, WalletMgr
from TestHarness.TestHelper import AppArgs
Expand Down Expand Up @@ -102,6 +103,7 @@ def startCluster():
specificExtraNodeosArgs={}
# producer nodes will be mapped to 0 through pnodes-1, so the number pnodes is the no-producing API node
specificExtraNodeosArgs[pnodes]=" --plugin eosio::net_api_plugin"
specificExtraNodeosArgs[pnodes]+=" --contracts-console "
specificExtraNodeosArgs[pnodes]+=" --read-only-write-window-time-us "
specificExtraNodeosArgs[pnodes]+=" 10000 "
specificExtraNodeosArgs[pnodes]+=" --read-only-read-window-time-us "
Expand Down Expand Up @@ -228,7 +230,8 @@ def sendReadOnlyTrxOnThread(startId, numTrxs):
assert(results[1]['processed']['action_traces'][0]['console'] == "Im a payloadless slow action")
assert(int(results[1]['processed']['elapsed']) > 100)
except Exception as e:
Print("Exception in sendReadOnlyTrxOnThread: ", e)
Print("Exception in sendReadOnlyTrxOnThread: ", repr(e))
traceback.print_exc()
errorInThread = True

# Send regular trxs from mutltiple threads to bump load
Expand All @@ -242,7 +245,8 @@ def sendTrxsOnThread(startId, numTrxs, opts=None):
results = sendTransaction(testAccountName, 'age', {"user": userAccountName, "id": startId + i}, auth=[{"actor": userAccountName, "permission":"active"}], opts=opts)
assert(results[0])
except Exception as e:
Print("Exception in sendTrxsOnThread: ", e)
Print("Exception in sendTrxsOnThread: ", repr(e))
traceback.print_exc()
errorInThread = True

def doRpc(resource, command, numRuns, fieldIn, expectedValue, code, payload={}):
Expand All @@ -258,7 +262,8 @@ def doRpc(resource, command, numRuns, fieldIn, expectedValue, code, payload={}):
else:
assert(ret_json["code"] == code)
except Exception as e:
Print("Exception in doRpc: ", e)
Print("Exception in doRpc: ", repr(e))
traceback.print_exc()
errorInThread = True

def runReadOnlyTrxAndRpcInParallel(resource, command, fieldIn=None, expectedValue=None, code=None, payload={}):
Expand Down

0 comments on commit 18add6b

Please sign in to comment.