forked from TrueCloudLab/frostfs-testcases
[#294] Fixed test metrics garbage collector
This commit is contained in:
parent
0a5ce7f21a
commit
19a690361d
1 changed files with 26 additions and 28 deletions
|
@ -33,9 +33,7 @@ class TestGarbageCollectorMetrics(ClusterTestBase):
|
||||||
return sum(map(int, result))
|
return sum(map(int, result))
|
||||||
|
|
||||||
@allure.title("Garbage collector expire_at object")
|
@allure.title("Garbage collector expire_at object")
|
||||||
def test_garbage_collector_metrics_expire_at_object(
|
def test_garbage_collector_metrics_expire_at_object(self, simple_object_size: ObjectSize, default_wallet: WalletInfo, cluster: Cluster):
|
||||||
self, simple_object_size: ObjectSize, default_wallet: WalletInfo, cluster: Cluster
|
|
||||||
):
|
|
||||||
file_path = generate_file(simple_object_size.value)
|
file_path = generate_file(simple_object_size.value)
|
||||||
placement_policy = "REP 2 IN X CBF 2 SELECT 2 FROM * AS X"
|
placement_policy = "REP 2 IN X CBF 2 SELECT 2 FROM * AS X"
|
||||||
metrics_step = 1
|
metrics_step = 1
|
||||||
|
@ -43,9 +41,7 @@ class TestGarbageCollectorMetrics(ClusterTestBase):
|
||||||
with reporter.step("Get current garbage collector metrics for each nodes"):
|
with reporter.step("Get current garbage collector metrics for each nodes"):
|
||||||
metrics_counter = {}
|
metrics_counter = {}
|
||||||
for node in cluster.cluster_nodes:
|
for node in cluster.cluster_nodes:
|
||||||
metrics_counter[node] = get_metrics_value(
|
metrics_counter[node] = get_metrics_value(node, command="frostfs_node_garbage_collector_marked_for_removal_objects_total")
|
||||||
node, command="frostfs_node_garbage_collector_marked_for_removal_objects_total"
|
|
||||||
)
|
|
||||||
|
|
||||||
with reporter.step(f"Create container with policy {placement_policy}"):
|
with reporter.step(f"Create container with policy {placement_policy}"):
|
||||||
cid = create_container(default_wallet, self.shell, cluster.default_rpc_endpoint, placement_policy)
|
cid = create_container(default_wallet, self.shell, cluster.default_rpc_endpoint, placement_policy)
|
||||||
|
@ -63,18 +59,12 @@ class TestGarbageCollectorMetrics(ClusterTestBase):
|
||||||
|
|
||||||
with reporter.step("Get object nodes"):
|
with reporter.step("Get object nodes"):
|
||||||
object_storage_nodes = get_nodes_with_object(cid, oid, self.shell, cluster.storage_nodes)
|
object_storage_nodes = get_nodes_with_object(cid, oid, self.shell, cluster.storage_nodes)
|
||||||
object_nodes = [
|
object_nodes = [cluster_node for cluster_node in cluster.cluster_nodes if cluster_node.storage_node in object_storage_nodes]
|
||||||
cluster_node
|
|
||||||
for cluster_node in cluster.cluster_nodes
|
|
||||||
if cluster_node.storage_node in object_storage_nodes
|
|
||||||
]
|
|
||||||
|
|
||||||
with reporter.step("Tick Epoch"):
|
with reporter.step("Tick Epoch"):
|
||||||
self.tick_epochs(epochs_to_tick=2, wait_block=2)
|
self.tick_epochs(epochs_to_tick=2, wait_block=2)
|
||||||
|
|
||||||
with reporter.step(
|
with reporter.step(f"Check garbage collector metrics 'the counter should increase by {metrics_step}' in object nodes"):
|
||||||
f"Check garbage collector metrics 'the counter should increase by {metrics_step}' in object nodes"
|
|
||||||
):
|
|
||||||
for node in object_nodes:
|
for node in object_nodes:
|
||||||
metrics_counter[node] += metrics_step
|
metrics_counter[node] += metrics_step
|
||||||
|
|
||||||
|
@ -86,30 +76,38 @@ class TestGarbageCollectorMetrics(ClusterTestBase):
|
||||||
)
|
)
|
||||||
|
|
||||||
@allure.title("Garbage collector delete object")
|
@allure.title("Garbage collector delete object")
|
||||||
def test_garbage_collector_metrics_deleted_objects(
|
def test_garbage_collector_metrics_deleted_objects(self, simple_object_size: ObjectSize, default_wallet: WalletInfo, cluster: Cluster):
|
||||||
self, simple_object_size: ObjectSize, default_wallet: WalletInfo, cluster: Cluster
|
|
||||||
):
|
|
||||||
file_path = generate_file(simple_object_size.value)
|
file_path = generate_file(simple_object_size.value)
|
||||||
placement_policy = "REP 2 IN X CBF 2 SELECT 2 FROM * AS X"
|
placement_policy = "REP 2 IN X CBF 2 SELECT 2 FROM * AS X"
|
||||||
metrics_step = 1
|
metrics_step = 1
|
||||||
|
|
||||||
with reporter.step("Select random node"):
|
with reporter.step("Get current garbage collector metrics for each nodes"):
|
||||||
node = random.choice(cluster.cluster_nodes)
|
metrics_counter = {}
|
||||||
|
for node in cluster.cluster_nodes:
|
||||||
with reporter.step("Get current garbage collector metrics for selected node"):
|
metrics_counter[node] = get_metrics_value(node, command="frostfs_node_garbage_collector_deleted_objects_total")
|
||||||
metrics_counter = get_metrics_value(node, command="frostfs_node_garbage_collector_deleted_objects_total")
|
|
||||||
|
|
||||||
with reporter.step(f"Create container with policy {placement_policy}"):
|
with reporter.step(f"Create container with policy {placement_policy}"):
|
||||||
cid = create_container(default_wallet, self.shell, node.storage_node.get_rpc_endpoint(), placement_policy)
|
cid = create_container(default_wallet, self.shell, node.storage_node.get_rpc_endpoint(), placement_policy)
|
||||||
|
|
||||||
with reporter.step("Put object to selected node"):
|
with reporter.step("Put object to random node"):
|
||||||
oid = put_object(default_wallet, file_path, cid, self.shell, node.storage_node.get_rpc_endpoint())
|
oid = put_object_to_random_node(
|
||||||
|
default_wallet,
|
||||||
|
file_path,
|
||||||
|
cid,
|
||||||
|
self.shell,
|
||||||
|
cluster,
|
||||||
|
)
|
||||||
|
|
||||||
|
with reporter.step("Get object nodes"):
|
||||||
|
object_storage_nodes = get_nodes_with_object(cid, oid, self.shell, cluster.storage_nodes)
|
||||||
|
object_nodes = [cluster_node for cluster_node in cluster.cluster_nodes if cluster_node.storage_node in object_storage_nodes]
|
||||||
|
|
||||||
with reporter.step("Delete file, wait until gc remove object"):
|
with reporter.step("Delete file, wait until gc remove object"):
|
||||||
delete_object(default_wallet, cid, oid, self.shell, node.storage_node.get_rpc_endpoint())
|
delete_object(default_wallet, cid, oid, self.shell, node.storage_node.get_rpc_endpoint())
|
||||||
|
|
||||||
with reporter.step(f"Check garbage collector metrics 'the counter should increase by {metrics_step}'"):
|
with reporter.step(f"Check garbage collector metrics 'the counter should increase by {metrics_step}'"):
|
||||||
metrics_counter += metrics_step
|
for node in object_nodes:
|
||||||
|
exp_metrics_counter = metrics_counter[node] + metrics_step
|
||||||
check_metrics_counter(
|
check_metrics_counter(
|
||||||
[node], counter_exp=metrics_counter, command="frostfs_node_garbage_collector_deleted_objects_total"
|
[node], counter_exp=exp_metrics_counter, command="frostfs_node_garbage_collector_deleted_objects_total"
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue