Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix flaky test case test_volume_metrics #1810

Merged
merged 2 commits into from
Mar 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions manager/integration/tests/test_metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from common import client, core_api, volume_name # NOQA

from common import delete_replica_processes
from common import check_volume_data
from common import create_pv_for_volume
from common import create_pvc_for_volume
from common import create_snapshot
Expand All @@ -22,7 +21,6 @@
from common import wait_for_volume_faulted
from common import wait_for_volume_healthy
from common import write_volume_data
from common import write_volume_random_data
from common import set_node_scheduling
from common import set_node_cordon
from common import Mi
Expand Down Expand Up @@ -287,10 +285,12 @@ def test_volume_metrics(client, core_api, volume_name, pvc_namespace): # NOQA
volume = client.by_id_volume(volume_name)
volume.attach(hostId=lht_hostId)
volume = wait_for_volume_healthy(client, volume_name)
data = write_volume_random_data(volume)
check_volume_data(volume, data)
data_size = 1 * Mi
data = {'pos': 0,
'len': data_size,
'content': generate_random_data(data_size)}
write_volume_data(volume, data)
volume = client.by_id_volume(volume_name)
actual_size = float(volume.controllers[0].actualSize)
capacity_size = float(volume.size)

metric_labels = {
Expand All @@ -303,7 +303,7 @@ def test_volume_metrics(client, core_api, volume_name, pvc_namespace): # NOQA
# check volume metric basic
wait_for_metric_volume_actual_size(core_api,
"longhorn_volume_actual_size_bytes",
metric_labels, actual_size)
metric_labels, data_size)
check_metric(core_api, "longhorn_volume_capacity_bytes",
metric_labels, capacity_size)
check_metric(core_api, "longhorn_volume_read_throughput",
Expand Down