Update epoch align check

Signed-off-by: Andrey Berezin <a.berezin@yadro.com>
This commit is contained in:
Andrey Berezin 2023-06-27 11:47:42 +03:00
parent 182bd6ab36
commit 889e108be9
2 changed files with 8 additions and 21 deletions

View file

@ -54,16 +54,14 @@ def ensure_fresh_epoch(
return epoch return epoch
@reporter.step_deco("Wait for epochs align in whole cluster") @reporter.step_deco("Wait up to {timeout} seconds for nodes on cluster to align epochs")
@wait_for_success(60, 5) def wait_for_epochs_align(shell: Shell, cluster: Cluster, timeout=60):
def wait_for_epochs_align(shell: Shell, cluster: Cluster) -> None: @wait_for_success(timeout, 5, None, True)
epochs = [] def check_epochs():
for node in cluster.services(StorageNode): epochs_by_node = get_epochs_from_nodes(shell, cluster)
epochs.append(get_epoch(shell, cluster, node)) assert len(set(epochs_by_node.values())) == 1, f"unaligned epochs found: {epochs_by_node}"
unique_epochs = list(set(epochs))
assert ( check_epochs()
len(unique_epochs) == 1
), f"unaligned epochs found, {epochs}, count of unique epochs {len(unique_epochs)}"
@reporter.step_deco("Get Epoch") @reporter.step_deco("Get Epoch")

View file

@ -220,17 +220,6 @@ class ClusterStateController:
wait_for_host_online(self.shell, node.storage_node) wait_for_host_online(self.shell, node.storage_node)
wait_for_node_online(node.storage_node) wait_for_node_online(node.storage_node)
@reporter.step_deco("Wait up to {timeout} seconds for nodes on cluster to align epochs")
def wait_for_epochs_align(self, timeout=60):
@wait_for_success(timeout, 5, None, True)
def check_epochs():
epochs_by_node = epoch.get_epochs_from_nodes(self.shell, self.cluster)
assert (
len(set(epochs_by_node.values())) == 1
), f"unaligned epochs found: {epochs_by_node}"
check_epochs()
def _get_disk_controller( def _get_disk_controller(
self, node: StorageNode, device: str, mountpoint: str self, node: StorageNode, device: str, mountpoint: str
) -> DiskController: ) -> DiskController: