mirror of
https://github.com/0glabs/0g-storage-node.git
synced 2024-11-14 20:15:17 +00:00
506d234562
Some checks are pending
abi-consistent-check / build-and-compare (push) Waiting to run
code-coverage / unittest-cov (push) Waiting to run
rust / check (push) Waiting to run
rust / test (push) Waiting to run
rust / lints (push) Waiting to run
functional-test / test (push) Waiting to run
* Add trait. * Update merkle tree trait. * Use NodeManager. * fix. * Use LRU for cache. * fix clippy. * Save layer size. * Initialize LogManager with NodeManager. * Fix. * Fix test. * fix.
44 lines
1.5 KiB
Python
Executable File
44 lines
1.5 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
from test_framework.test_framework import TestFramework
|
|
from utility.submission import create_submission, submit_data
|
|
from utility.utils import wait_until
|
|
|
|
|
|
class NodeCacheTest(TestFramework):
|
|
def setup_params(self):
|
|
self.zgs_node_configs[0] = {
|
|
"merkle_node_cache_capacity": 1024,
|
|
}
|
|
|
|
def run_test(self):
|
|
client = self.nodes[0]
|
|
|
|
chunk_data = b"\x02" * 256 * 1024 * 1024 * 3
|
|
submissions, data_root = create_submission(chunk_data)
|
|
self.contract.submit(submissions)
|
|
wait_until(lambda: self.contract.num_submissions() == 1)
|
|
wait_until(lambda: client.zgs_get_file_info(data_root) is not None)
|
|
|
|
segment = submit_data(client, chunk_data)
|
|
self.log.info("segment: %s", len(segment))
|
|
wait_until(lambda: client.zgs_get_file_info(data_root)["finalized"])
|
|
|
|
self.stop_storage_node(0)
|
|
self.start_storage_node(0)
|
|
self.nodes[0].wait_for_rpc_connection()
|
|
|
|
chunk_data = b"\x03" * 256 * (1024 * 765 + 5)
|
|
submissions, data_root = create_submission(chunk_data)
|
|
self.contract.submit(submissions)
|
|
wait_until(lambda: self.contract.num_submissions() == 2)
|
|
wait_until(lambda: client.zgs_get_file_info(data_root) is not None)
|
|
|
|
segment = submit_data(client, chunk_data)
|
|
self.log.info("segment: %s", len(segment))
|
|
wait_until(lambda: client.zgs_get_file_info(data_root)["finalized"])
|
|
|
|
|
|
if __name__ == "__main__":
|
|
NodeCacheTest().main()
|