File tree Expand file tree Collapse file tree 2 files changed +17
-20
lines changed
tests/observability/metrics Expand file tree Collapse file tree 2 files changed +17
-20
lines changed Original file line number Diff line number Diff line change 1515
1616from tests .observability .metrics .constants import (
1717 KUBEVIRT_CONSOLE_ACTIVE_CONNECTIONS_BY_VMI ,
18+ KUBEVIRT_VM_CREATED_BY_POD_TOTAL ,
1819 KUBEVIRT_VMI_MIGRATIONS_IN_RUNNING_PHASE ,
1920 KUBEVIRT_VMI_MIGRATIONS_IN_SCHEDULING_PHASE ,
2021 KUBEVIRT_VMI_STATUS_ADDRESSES ,
@@ -622,12 +623,18 @@ def aaq_resource_hard_limit_and_used(application_aware_resource_quota):
622623
623624
624625@pytest .fixture ()
625- def vm_in_hco_namespace (hco_namespace ):
626- vm_name = "hco-vm"
626+ def vm_created_pod_total_initial_metric_value (prometheus , namespace ):
627+ metric_query = f"sum({ KUBEVIRT_VM_CREATED_BY_POD_TOTAL } {{namespace='{ namespace .name } '}})"
628+ return int (get_metrics_value (prometheus = prometheus , metrics_name = metric_query ))
629+
630+
631+ @pytest .fixture ()
632+ def vm_in_new_namespace (namespace ):
633+ vm_name = "vm-created-by-pod-total-vm"
627634
628635 with VirtualMachineForTests (
629636 name = vm_name ,
630- namespace = hco_namespace .name ,
637+ namespace = namespace .name ,
631638 body = fedora_vm_body (name = vm_name ),
632639 ssh = False ,
633640 ) as vm :
Original file line number Diff line number Diff line change @@ -513,27 +513,17 @@ def test_kubevirt_vmi_phase_transition_from_deletion_seconds_sum_windows(
513513
514514
515515class TestVmCreatedByPodTotal :
516- metric_query = f"sum({ KUBEVIRT_VM_CREATED_BY_POD_TOTAL } {{namespace='openshift-cnv'}})"
517-
518- @pytest .mark .parametrize (
519- "initial_metric_value" ,
520- [
521- pytest .param (
522- metric_query ,
523- marks = pytest .mark .polarion ("CNV-12361" ),
524- )
525- ],
526- indirect = True ,
527- )
516+ @pytest .mark .polarion ("CNV-12361" )
528517 def test_kubevirt_vm_created_by_pod_total (
529518 self ,
530519 prometheus ,
531- hco_namespace ,
532- initial_metric_value ,
533- vm_in_hco_namespace ,
520+ namespace ,
521+ vm_created_pod_total_initial_metric_value ,
522+ vm_in_new_namespace ,
534523 ):
524+ metric_query = f"sum({ KUBEVIRT_VM_CREATED_BY_POD_TOTAL } {{namespace='{ namespace .name } '}})"
535525 validate_metrics_value (
536526 prometheus = prometheus ,
537- metric_name = self . metric_query ,
538- expected_value = str (initial_metric_value + 1 ),
527+ metric_name = metric_query ,
528+ expected_value = str (vm_created_pod_total_initial_metric_value + 1 ),
539529 )
You can’t perform that action at this time.
0 commit comments