Add waiting for epoch align for storage group lifetime test
Signed-off-by: Andrey Berezin <a.berezin@yadro.com>
This commit is contained in:
parent
c6ebe1d67d
commit
baf0b4dd0f
4 changed files with 11 additions and 7 deletions
|
@ -24,6 +24,9 @@ class ClusterTestBase:
|
||||||
def tick_epoch(self):
|
def tick_epoch(self):
|
||||||
epoch.tick_epoch(self.shell, self.cluster)
|
epoch.tick_epoch(self.shell, self.cluster)
|
||||||
|
|
||||||
|
def wait_for_epochs_align(self):
|
||||||
|
epoch.wait_for_epochs_align(self.shell, self.cluster)
|
||||||
|
|
||||||
def get_epoch(self):
|
def get_epoch(self):
|
||||||
return epoch.get_epoch(self.shell, self.cluster)
|
return epoch.get_epoch(self.shell, self.cluster)
|
||||||
|
|
||||||
|
|
|
@ -253,6 +253,7 @@ class TestStorageGroup(ClusterTestBase):
|
||||||
with allure.step("Tick two epochs"):
|
with allure.step("Tick two epochs"):
|
||||||
for _ in range(2):
|
for _ in range(2):
|
||||||
self.tick_epoch()
|
self.tick_epoch()
|
||||||
|
self.wait_for_epochs_align()
|
||||||
with pytest.raises(Exception, match=OBJECT_NOT_FOUND):
|
with pytest.raises(Exception, match=OBJECT_NOT_FOUND):
|
||||||
get_storagegroup(
|
get_storagegroup(
|
||||||
shell=self.shell,
|
shell=self.shell,
|
||||||
|
|
|
@ -6,7 +6,7 @@ from typing import Optional
|
||||||
import allure
|
import allure
|
||||||
import pytest
|
import pytest
|
||||||
from container import create_container
|
from container import create_container
|
||||||
from epoch import align_epochs, get_epoch
|
from epoch import get_epoch, wait_for_epochs_align
|
||||||
from file_helper import generate_file
|
from file_helper import generate_file
|
||||||
from grpc_responses import OBJECT_NOT_FOUND
|
from grpc_responses import OBJECT_NOT_FOUND
|
||||||
from http_gate import (
|
from http_gate import (
|
||||||
|
@ -232,7 +232,7 @@ class Test_http_system_header(ClusterTestBase):
|
||||||
), f"Epochs should be equal: {get_epoch(self.shell, self.cluster)} != {expected_epoch + 1}"
|
), f"Epochs should be equal: {get_epoch(self.shell, self.cluster)} != {expected_epoch + 1}"
|
||||||
|
|
||||||
with allure.step("Check object deleted because it expires-on epoch"):
|
with allure.step("Check object deleted because it expires-on epoch"):
|
||||||
align_epochs(self.shell, self.cluster)
|
wait_for_epochs_align(self.shell, self.cluster)
|
||||||
try_to_get_object_and_expect_error(
|
try_to_get_object_and_expect_error(
|
||||||
cid=user_container,
|
cid=user_container,
|
||||||
oid=oid,
|
oid=oid,
|
||||||
|
@ -286,7 +286,7 @@ class Test_http_system_header(ClusterTestBase):
|
||||||
), f"Epochs should be equal: {get_epoch(self.shell, self.cluster)} != {expected_epoch + 1}"
|
), f"Epochs should be equal: {get_epoch(self.shell, self.cluster)} != {expected_epoch + 1}"
|
||||||
|
|
||||||
with allure.step("Check object deleted because it expires-on epoch"):
|
with allure.step("Check object deleted because it expires-on epoch"):
|
||||||
align_epochs(self.shell, self.cluster)
|
wait_for_epochs_align(self.shell, self.cluster)
|
||||||
try_to_get_object_and_expect_error(
|
try_to_get_object_and_expect_error(
|
||||||
cid=user_container,
|
cid=user_container,
|
||||||
oid=oid,
|
oid=oid,
|
||||||
|
@ -340,7 +340,7 @@ class Test_http_system_header(ClusterTestBase):
|
||||||
), f"Epochs should be equal: {get_epoch(self.shell, self.cluster)} != {expected_epoch + 1}"
|
), f"Epochs should be equal: {get_epoch(self.shell, self.cluster)} != {expected_epoch + 1}"
|
||||||
|
|
||||||
with allure.step("Check object deleted because it expires-on epoch"):
|
with allure.step("Check object deleted because it expires-on epoch"):
|
||||||
align_epochs(self.shell, self.cluster)
|
wait_for_epochs_align(self.shell, self.cluster)
|
||||||
try_to_get_object_and_expect_error(
|
try_to_get_object_and_expect_error(
|
||||||
cid=user_container,
|
cid=user_container,
|
||||||
oid=oid,
|
oid=oid,
|
||||||
|
@ -392,7 +392,7 @@ class Test_http_system_header(ClusterTestBase):
|
||||||
), f"Epochs should be equal: {get_epoch(self.shell, self.cluster)} != {expected_epoch + 1}"
|
), f"Epochs should be equal: {get_epoch(self.shell, self.cluster)} != {expected_epoch + 1}"
|
||||||
|
|
||||||
with allure.step("Check object deleted because it expires-on epoch"):
|
with allure.step("Check object deleted because it expires-on epoch"):
|
||||||
align_epochs(self.shell, self.cluster)
|
wait_for_epochs_align(self.shell, self.cluster)
|
||||||
try_to_get_object_and_expect_error(
|
try_to_get_object_and_expect_error(
|
||||||
cid=user_container,
|
cid=user_container,
|
||||||
oid=oid,
|
oid=oid,
|
||||||
|
|
|
@ -34,9 +34,9 @@ def ensure_fresh_epoch(
|
||||||
return epoch
|
return epoch
|
||||||
|
|
||||||
|
|
||||||
@allure.step("Align epochs for the whole cluster")
|
@allure.step("Wait for epochs align in whole cluster")
|
||||||
@wait_for_success(60, 5)
|
@wait_for_success(60, 5)
|
||||||
def align_epochs(shell: Shell, cluster: Cluster) -> bool:
|
def wait_for_epochs_align(shell: Shell, cluster: Cluster) -> bool:
|
||||||
epochs = []
|
epochs = []
|
||||||
for node in cluster.storage_nodes:
|
for node in cluster.storage_nodes:
|
||||||
epochs.append(get_epoch(shell, cluster, node))
|
epochs.append(get_epoch(shell, cluster, node))
|
||||||
|
|
Loading…
Reference in a new issue