-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add integration and performance test scripts
- Loading branch information
Showing
8 changed files
with
1,430 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# This is the official list of rpc-tests authors for copyright purposes. | ||
|
||
Tullio Canepa | ||
lupin012 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,47 @@ | ||
# rpc-tests | ||
Collection of JSON RPC black-box testing tools | ||
|
||
## Table of Contents | ||
1. ### [Installation](#installation) | ||
1. [Prerequisites](#prerequisites) | ||
2. [Obtaining rpc-tests](#obtaining-rpc-tests) | ||
2. ### [Integration Testing](#integration-testing) | ||
3. ### [Performance Testing](#performance-testing) | ||
4. ### [Contributing](#contributing) | ||
|
||
## Installation | ||
|
||
#### Prerequisites | ||
|
||
Using `rpc-tests` requires installing: | ||
* [`Vegeta`](https://github.com/tsenart/vegeta) >= 12.8.4 | ||
* [`Python`](https://python.org/) >= 3.7 | ||
|
||
After installation, make sure `vegeta` command is available at your shell prompt by running `vegeta -h`. | ||
If it is not, you may need to add `go` binary folder to your system `PATH`. | ||
|
||
After installation, make sure `python3` and `pip3` commands are available at your shell prompt by running `python3 -h` and `pip3 -h`. | ||
|
||
#### Obtaining `rpc-tests` | ||
|
||
To obtain `rpc-tests` source code for the first time: | ||
``` | ||
git clone https://github.com/erigontech/rpc-tests.git | ||
``` | ||
|
||
`rpc-tests` uses a few Python third-party libraries, so after you've updated to the latest code with | ||
``` | ||
git pull | ||
``` | ||
update the dependencies as well by running | ||
``` | ||
pip3 install -r requirements.txt | ||
``` | ||
|
||
## Integration Testing | ||
|
||
Check out the dedicated guide in [Integration Tests](./integration/README.md). | ||
|
||
## Performance Testing | ||
|
||
Check out the dedicated guide in [Performance Tests](./perf/README.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
# Integration Test Suite | ||
|
||
These integration tests currently available for Goerli testnet must run as non-regression suite | ||
|
||
# Requirements | ||
|
||
``` | ||
% pip3 install -r requirements.txt | ||
``` | ||
|
||
Currently, `json-diff` is also required: | ||
|
||
``` | ||
% sudo apt update | ||
% sudo apt install npm | ||
% npm install -g json-diff | ||
``` | ||
|
||
# Run tests | ||
|
||
``` | ||
% python3 ./run_tests.py -c -k jwt.hex | ||
``` | ||
|
||
# Synopsis | ||
|
||
``` | ||
% python3 ./run_tests.py -h | ||
Usage: ./run_tests.py: | ||
Launch an automated test sequence on Silkworm RpcDaemon (aka Silkrpc) or Erigon RpcDaemon | ||
-h print this help | ||
-f shows only failed tests (not Skipped) | ||
-c runs all tests even if one test fails [default: exit at first test fail] | ||
-r connect to Erigon RpcDaemon [default: connect to Silkrpc] | ||
-l <number of loops> | ||
-a <test_api>: run all tests of the specified API | ||
-s <start_test_number>: run tests starting from input | ||
-t <test_number>: run single test | ||
-d send requests also to the reference daemon i.e. Erigon RpcDaemon | ||
-i <infura_url> send any request also to the Infura API endpoint as reference | ||
-b blockchain [default: goerly] | ||
-v verbose | ||
-o dump response | ||
-k authentication token file | ||
-x exclude API list (i.e txpool_content,txpool_status,engine_ | ||
-X exclude test list (i.e 18,22 | ||
-H host where the RpcDaemon is located (e.g. 10.10.2.3) | ||
``` | ||
|
||
# Integration test (11/08/23) | ||
# erigon/rpcdaemon version 2.48.1 | ||
|
||
### To run integration tests comparing results with json file: ./run_tests.py -c -k jwt.hex | ||
### (in case Erigon without snapshot & KV access to DB & Rpcdaemon embedded) | ||
|
||
``` | ||
Test time-elapsed (secs): 77 | ||
Number of executed tests: 448/450 | ||
Number of NOT executed tests: 0 | ||
Number of success tests: 448 | ||
Number of failed tests: 0 | ||
``` | ||
|
||
|
||
### To run integration tests comparing results with RPCdaemon response (KV) : ./run_tests.py -f -d -c -k jwt.hex | ||
### (in case Erigon without snapshot & KV access to DB comparing results with RPCDaemon KV, Rpcdaemon embedded) | ||
``` | ||
091. erigon_forks/test_1.json Failed | ||
351. trace_filter/test_06.tar Failed | ||
352. trace_filter/test_07.tar Failed | ||
Test time-elapsed (secs): 90 | ||
Number of executed tests: 424/461 | ||
Number of NOT executed tests: 0 | ||
Number of success tests: 421 | ||
Number of failed tests: 3 | ||
``` | ||
|
||
### To run integration tests comparing results with RPCdaemon response (KV) : ./run_tests.py -f -d -c -k jwt.hex | ||
### (in case Erigon with snapshot & KV access to DB comparing results with RPCDaemon KV & Rpcdaemon embedded) | ||
``` | ||
091. erigon_forks/test_1.json Failed | ||
351. trace_filter/test_06.tar Failed | ||
352. trace_filter/test_07.tar Failed | ||
Test time-elapsed (secs): 90 | ||
Number of executed tests: 424/461 | ||
Number of NOT executed tests: 0 | ||
Number of success tests: 421 | ||
Number of failed tests: 3 | ||
``` | ||
|
||
|
||
### To run integration tests comparing results with local DB: ./run_tests.py -f -d -c -k jwt.hex | ||
### (in case Erigon without snapshot & local access to DB comparing results with RPCDaemon) | ||
``` | ||
091. erigon_forks/test_1.json Failed | ||
097. erigon_getBlockByTimestamp/test_1.json Failed | ||
351. trace_filter/test_06.tar Failed | ||
352. trace_filter/test_07.tar Failed | ||
Test time-elapsed (secs): 86 | ||
Number of executed tests: 424/461 | ||
Number of NOT executed tests: 0 | ||
Number of success tests: 420 | ||
Number of failed tests: 4 | ||
``` | ||
|
||
|
||
### To run integration tests comparing results with local DB: ./run_tests.py -f -d -c -k jwt.hex | ||
### (in case Erigon with snapshot & local access to DB comparing results with RPCDaemon) | ||
``` | ||
091. erigon_forks/test_1.json Failed | ||
351. trace_filter/test_06.tar Failed | ||
352. trace_filter/test_07.tar Failed | ||
Test time-elapsed (secs): 89 | ||
Number of executed tests: 424/461 | ||
Number of NOT executed tests: 0 | ||
Number of success tests: 421 | ||
Number of failed tests: 3 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/usr/bin/python3 | ||
""" Creates a Raw transaction """ | ||
|
||
import sys | ||
import getopt | ||
from web3 import Web3 | ||
w3 = Web3(Web3.HTTPProvider('https://goerli.infura.io/v3/06ffc77ca4534edb84483033573d18cb')) | ||
|
||
|
||
def usage(argv): | ||
""" print usage string | ||
""" | ||
print("Usage: " + argv[0] + | ||
" -k <key-file> -p <password> -f <from account address> -t <to account address>") | ||
# | ||
# main | ||
# | ||
def main(argv): | ||
""" parse command line and generated signed transaction | ||
""" | ||
try: | ||
opts, _ = getopt.getopt(argv[1:], "k:p:f:t:") | ||
for option, optarg in opts: | ||
if option in ("-h", "--help"): | ||
usage(argv) | ||
sys.exit(-1) | ||
elif option == "-k": | ||
key_file = optarg | ||
elif option == "-p": | ||
password = optarg | ||
elif option == "-f": | ||
from_account = optarg | ||
elif option == "-t": | ||
to_account = optarg | ||
elif option == "-h": | ||
usage(argv) | ||
else: | ||
usage(argv) | ||
sys.exit(-1) | ||
|
||
except getopt.GetoptError as err: | ||
# print help information and exit: | ||
print(err) | ||
usage(argv) | ||
sys.exit(-1) | ||
|
||
with open(key_file, encoding="utf8") as key_file: | ||
encrypted_key = key_file.read() | ||
private_key = w3.eth.account.decrypt(encrypted_key, password) | ||
|
||
signed_txn = w3.eth.account.signTransaction(dict( | ||
nonce=w3.eth.getTransactionCount(from_account), | ||
gasPrice = w3.eth.gasPrice, | ||
gas = 100000, | ||
chainId=5, | ||
to=to_account, | ||
value=w3.toWei(0,'ether')), | ||
private_key) | ||
|
||
print (signed_txn) | ||
|
||
# | ||
# module as main | ||
# | ||
if __name__ == "__main__": | ||
main(sys.argv) | ||
sys.exit(0) |
Oops, something went wrong.