mirror of
https://github.com/0glabs/0g-storage-node.git
synced 2024-12-26 16:25:18 +00:00
9b68a8b7d7
Some checks failed
abi-consistent-check / build-and-compare (push) Has been cancelled
code-coverage / unittest-cov (push) Has been cancelled
rust / check (push) Has been cancelled
rust / test (push) Has been cancelled
rust / lints (push) Has been cancelled
functional-test / test (push) Has been cancelled
* Add new P2P protocol NewFile * Publish NewFile message when any file finalized * handle NewFile message in router * handle NewFile in sync servic to write in db * use propagation source to handle NewFile message * Disable sequential sync and store new file in v2 sync store * Add shard config in FindFile * Add AnnounceFile RPC message in network layer * do not propagate FindFile to whole network * Mark peer connected if FileAnnouncement RPC message received * fix unit test failures * Change P2P protocol version * Ignore py tests of sequential auto sync * Add py test for auto sync v2 * fmt code * remove dummy code in py test * fix random test failure * Add comments * Enable file sync protocol v2 in config file by default
35 lines
1.3 KiB
Python
35 lines
1.3 KiB
Python
#!/usr/bin/env python3
|
|
|
|
from test_framework.test_framework import TestFramework
|
|
from utility.utils import wait_until
|
|
|
|
class AutoRandomSyncV2Test(TestFramework):
|
|
def setup_params(self):
|
|
self.num_nodes = 4
|
|
|
|
# Enable random auto sync v2
|
|
for i in range(self.num_nodes):
|
|
self.zgs_node_configs[i] = {
|
|
"sync": {
|
|
"auto_sync_enabled": True,
|
|
"max_sequential_workers": 0,
|
|
"max_random_workers": 3,
|
|
"neighbors_only": True,
|
|
}
|
|
}
|
|
|
|
def run_test(self):
|
|
# Submit and upload files on node 0
|
|
data_root_1 = self.__upload_file__(0, 256 * 1024)
|
|
data_root_2 = self.__upload_file__(0, 256 * 1024)
|
|
|
|
# Files should be available on other nodes via auto sync
|
|
for i in range(1, self.num_nodes):
|
|
wait_until(lambda: self.nodes[i].zgs_get_file_info(data_root_1) is not None)
|
|
wait_until(lambda: self.nodes[i].zgs_get_file_info(data_root_1)["finalized"])
|
|
wait_until(lambda: self.nodes[i].zgs_get_file_info(data_root_2) is not None)
|
|
wait_until(lambda: self.nodes[i].zgs_get_file_info(data_root_2)["finalized"])
|
|
|
|
if __name__ == "__main__":
|
|
AutoRandomSyncV2Test().main()
|