mirror of
https://github.com/0glabs/0g-storage-node.git
synced 2024-11-20 15:05:19 +00:00
add readme for python tests (#5)
This commit is contained in:
parent
877f484dd0
commit
613c1a8eb5
@ -1,9 +1,10 @@
|
|||||||
jsonrpcclient
|
jsonrpcclient==4.0.3
|
||||||
pyyaml
|
pyyaml==6.0.1
|
||||||
pysha3
|
pysha3==1.0.2
|
||||||
coincurve
|
coincurve==18.0.0
|
||||||
eth-utils
|
eth-utils==3.0.0
|
||||||
py-ecc
|
py-ecc==7.0.0
|
||||||
web3
|
web3==6.14.0
|
||||||
eth_tester
|
eth_tester
|
||||||
rtoml
|
cffi==1.16.0
|
||||||
|
rtoml==0.10.0
|
43
tests/readme.md
Normal file
43
tests/readme.md
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
# 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](https://github.com/bnb-chain/bsc/releases) 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.
|
||||||
|
|
@ -448,14 +448,13 @@ class TestFramework:
|
|||||||
|
|
||||||
self.stop_nodes()
|
self.stop_nodes()
|
||||||
|
|
||||||
if success == TestStatus.PASSED:
|
|
||||||
self.log.info("Test success")
|
|
||||||
shutil.rmtree(self.root_dir)
|
|
||||||
|
|
||||||
handlers = self.log.handlers[:]
|
handlers = self.log.handlers[:]
|
||||||
for handler in handlers:
|
for handler in handlers:
|
||||||
self.log.removeHandler(handler)
|
self.log.removeHandler(handler)
|
||||||
handler.close()
|
handler.close()
|
||||||
logging.shutdown()
|
logging.shutdown()
|
||||||
|
|
||||||
|
if success == TestStatus.PASSED:
|
||||||
|
shutil.rmtree(self.root_dir)
|
||||||
|
|
||||||
sys.exit(exit_code)
|
sys.exit(exit_code)
|
||||||
|
Loading…
Reference in New Issue
Block a user