0g-storage-node/tests
Bo QIU c2b8b1cab3
Rpc enhancements (#15)
* add admin rpc to terminate file or chunks sync

* Disallow to change file sync goal when failed

* split admin rpc into separate endpoints

* Support to launch public and private rpc at one port

* use one rpc port for python test

* fix lint

* restart to sync file or chunks if sync already completed or failed
2024-01-30 16:50:35 +08:00
..
config fix: contract, tests, clippy (#11) 2024-01-26 16:13:18 +08:00
test_framework Rpc enhancements (#15) 2024-01-30 16:50:35 +08:00
utility fix ci failure (#10) 2024-01-25 19:00:00 +08:00
cache_test.py feat: write cached segments to storage on log synced (#7) 2024-01-23 18:47:14 +08:00
ccov.sh Initial commit 2024-01-04 18:05:32 +08:00
cli_submission_test.py Fix python test (#8) 2024-01-24 20:42:25 +08:00
crash_test.py Fix python test (#8) 2024-01-24 20:42:25 +08:00
dep_pip3.sh Initial commit 2024-01-04 18:05:32 +08:00
example_test.py Initial commit 2024-01-04 18:05:32 +08:00
fuzz_test.py Initial commit 2024-01-04 18:05:32 +08:00
mine_test.py Initial commit 2024-01-04 18:05:32 +08:00
parallel_submission_test.py Initial commit 2024-01-04 18:05:32 +08:00
partial_submission_test.py Initial commit 2024-01-04 18:05:32 +08:00
random_test.py feat: write cached segments to storage on log synced (#7) 2024-01-23 18:47:14 +08:00
readme.md add readme for python tests (#5) 2024-01-19 21:26:33 +08:00
recovery_test.py Initial commit 2024-01-04 18:05:32 +08:00
revert_test.py Initial commit 2024-01-04 18:05:32 +08:00
rpc_test.py Fix python test (#8) 2024-01-24 20:42:25 +08:00
same_root_test.py Initial commit 2024-01-04 18:05:32 +08:00
submission_test.py Fix python test (#8) 2024-01-24 20:42:25 +08:00
sync_test.py add python test for chunks sync by rpc 2024-01-22 18:19:28 +08:00
test_all.py Update the merkle tree with proof data. (#9) 2024-01-26 10:29:09 +08:00

Python Tests for Storage node

Prerequisites

  1. Required python version: 3.8, 3.9, 3.10, higher version is not guaranteed (e.g. failed to install pysha3).

  2. Install dependencies under root folder:

pip3 install -r requirements.txt

Dependent Binaries

Python test framework will launch blockchain fullnodes at local for storage node to interact with. There are 2 kinds of fullnodes supported:

  • Conflux eSpace node (by default).
  • BSC node (geth).

For Conflux eSpace node, the test framework will automatically compile the binary at runtime, and copy the binary to tests/tmp folder. For BSC node, the test framework will automatically download the latest version binary from github to tests/tmp folder.

Alternatively, you could also manually copy specific versoin binaries (conflux or geth) to the tests/tmp folder. Note, do NOT copy released conflux binary on github, since block height of some CIPs are hardcoded.

Run Tests

Go to the tests folder and run following command to run all tests:

python test_all.py

or, run any single test, e.g.

python sync_test.py

Troubleshootings

  1. Test failed due to blockchain fullnode rpc inaccessible.
  • Traceback: node.wait_for_rpc_connection()
  • Solution: unset the http_proxy and https_proxy environment variables if configured.