Skip to content

Commit aea0615

Browse files
committed
fixed syntax errors and logic
1 parent d28c501 commit aea0615

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

tests/observability/metrics/conftest.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,9 @@ def virt_api_pods(admin_client, hco_namespace):
627627
wait_for_pod_running_by_prefix(
628628
admin_client=admin_client, namespace_name=hco_namespace.name, pod_prefix="virt-api", expected_number_of_pods=2
629629
)
630-
pods = get_pod_by_name_prefix(dyn_client=admin_client, pod_prefix="virt-api", namespace=hco_namespace.name)
630+
pods = get_pod_by_name_prefix(
631+
dyn_client=admin_client, pod_prefix="virt-api", namespace=hco_namespace.name, get_all=True
632+
)
631633
return pods
632634

633635

tests/observability/metrics/test_vms_metrics.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -528,15 +528,16 @@ def test_kubevirt_vm_created_by_pod_total(
528528
for pod in virt_api_pods:
529529
metric_query = f"{KUBEVIRT_VM_CREATED_BY_POD_TOTAL}{{pod='{pod.name}',namespace='{pod.namespace}'}}"
530530
current_values[pod.name] = int(get_metrics_value(prometheus=prometheus, metrics_name=metric_query))
531-
if initial_values[pod.name] == current_values[pod.name]:
531+
if current_values[pod.name] == initial_values[pod.name]:
532532
continue
533-
if not is_increase_found and initial_values[pod.name] == current_values[pod.name] + 1:
533+
if not is_increase_found and current_values[pod.name] == initial_values[pod.name] + 1:
534534
is_increase_found = True
535535
continue
536-
raise LOGGER.error(
536+
LOGGER.error(
537537
f"Metrics value: {current_values[pod.name]},"
538538
f"expected: {initial_values[pod.name]} or {initial_values[pod.name] + 1},"
539539
f"initial values: {initial_values}"
540540
)
541+
return
541542

542543
LOGGER.info("One metric value increased correctly!")

0 commit comments

Comments
 (0)