2024-10-28 06:56:08 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
from test_framework.test_framework import TestFramework
|
|
|
|
from utility.utils import wait_until
|
|
|
|
|
2024-12-19 08:36:53 +00:00
|
|
|
class AutoSyncHistoricalTest(TestFramework):
|
2024-10-28 06:56:08 +00:00
|
|
|
def setup_params(self):
|
|
|
|
self.num_nodes = 4
|
|
|
|
|
2024-12-19 08:36:53 +00:00
|
|
|
# Enable auto sync
|
2024-10-28 06:56:08 +00:00
|
|
|
for i in range(self.num_nodes):
|
|
|
|
self.zgs_node_configs[i] = {
|
|
|
|
"sync": {
|
2024-12-19 08:36:53 +00:00
|
|
|
"auto_sync_enabled": True
|
2024-10-28 06:56:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
def run_test(self):
|
2024-11-15 02:00:58 +00:00
|
|
|
# Stop the last node to verify historical file sync
|
|
|
|
self.stop_storage_node(self.num_nodes - 1)
|
|
|
|
|
2024-10-28 06:56:08 +00:00
|
|
|
# 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
|
2024-11-15 02:00:58 +00:00
|
|
|
for i in range(1, self.num_nodes - 1):
|
2024-10-28 06:56:08 +00:00
|
|
|
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"])
|
|
|
|
|
2024-11-15 02:00:58 +00:00
|
|
|
# Start the last node to verify historical file sync
|
|
|
|
self.start_storage_node(self.num_nodes - 1)
|
|
|
|
self.nodes[self.num_nodes - 1].wait_for_rpc_connection()
|
|
|
|
wait_until(lambda: self.nodes[self.num_nodes - 1].zgs_get_file_info(data_root_1) is not None)
|
|
|
|
wait_until(lambda: self.nodes[self.num_nodes - 1].zgs_get_file_info(data_root_1)["finalized"])
|
|
|
|
wait_until(lambda: self.nodes[self.num_nodes - 1].zgs_get_file_info(data_root_2) is not None)
|
|
|
|
wait_until(lambda: self.nodes[self.num_nodes - 1].zgs_get_file_info(data_root_2)["finalized"])
|
|
|
|
|
2024-10-28 06:56:08 +00:00
|
|
|
if __name__ == "__main__":
|
2024-12-19 08:36:53 +00:00
|
|
|
AutoSyncHistoricalTest().main()
|