2023-05-10 08:53:47 +00:00
|
|
|
from typing import Optional
|
|
|
|
|
2022-12-23 18:40:30 +00:00
|
|
|
import allure
|
2022-12-05 22:31:45 +00:00
|
|
|
import pytest
|
2023-01-09 12:46:03 +00:00
|
|
|
from frostfs_testlib.shell import Shell
|
2022-12-05 22:31:45 +00:00
|
|
|
|
2023-02-27 16:54:27 +00:00
|
|
|
from pytest_tests.helpers import epoch
|
2023-05-03 08:45:44 +00:00
|
|
|
from pytest_tests.helpers.cluster import Cluster, StorageNode
|
2023-02-27 16:54:27 +00:00
|
|
|
|
2022-12-05 22:31:45 +00:00
|
|
|
|
|
|
|
# To skip adding every mandatory singleton dependency to EACH test function
|
|
|
|
class ClusterTestBase:
|
|
|
|
shell: Shell
|
|
|
|
cluster: Cluster
|
|
|
|
|
|
|
|
@pytest.fixture(scope="session", autouse=True)
|
|
|
|
def fill_mandatory_dependencies(self, cluster: Cluster, client_shell: Shell):
|
|
|
|
ClusterTestBase.shell = client_shell
|
|
|
|
ClusterTestBase.cluster = cluster
|
|
|
|
yield
|
|
|
|
|
2022-12-23 18:40:30 +00:00
|
|
|
@allure.title("Tick {epochs_to_tick} epochs")
|
2023-05-10 08:53:47 +00:00
|
|
|
def tick_epochs(self, epochs_to_tick: int, alive_node: Optional[StorageNode] = None):
|
2022-12-23 18:40:30 +00:00
|
|
|
for _ in range(epochs_to_tick):
|
2023-05-03 08:45:44 +00:00
|
|
|
self.tick_epoch(alive_node)
|
2022-12-23 18:40:30 +00:00
|
|
|
|
2023-05-10 08:53:47 +00:00
|
|
|
def tick_epoch(self, alive_node: Optional[StorageNode] = None):
|
2023-05-03 08:45:44 +00:00
|
|
|
epoch.tick_epoch(self.shell, self.cluster, alive_node=alive_node)
|
2022-12-05 22:31:45 +00:00
|
|
|
|
2023-01-16 10:48:17 +00:00
|
|
|
def wait_for_epochs_align(self):
|
|
|
|
epoch.wait_for_epochs_align(self.shell, self.cluster)
|
|
|
|
|
2022-12-05 22:31:45 +00:00
|
|
|
def get_epoch(self):
|
|
|
|
return epoch.get_epoch(self.shell, self.cluster)
|
|
|
|
|
|
|
|
def ensure_fresh_epoch(self):
|
|
|
|
return epoch.ensure_fresh_epoch(self.shell, self.cluster)
|