Skip to content

Commit ef5444d

Browse files
committed
Remove Artifactory dependency from kubevirt_vmi_non_evictable test
The test for kubevirt_vmi_non_evictable is flaky duo to connectivity issues with the artifactory, in this PR I modified the test to not rely on the artifactory to avoid this kind of failures to stabilize the observability lanes.
1 parent 633eb13 commit ef5444d

File tree

10 files changed

+39
-25
lines changed

10 files changed

+39
-25
lines changed

tests/infrastructure/golden_images/constants.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
DEFAULT_FEDORA_REGISTRY_URL = "docker://quay.io/containerdisks/fedora:latest"
21
DATA_SOURCE_READY_FOR_CONSUMPTION_MESSAGE = "DataSource is ready to be consumed"
32
CUSTOM_DATA_IMPORT_CRON_NAME = "custom-data-import-cron"
43
CUSTOM_DATA_SOURCE_NAME = "custom-data-source"

tests/infrastructure/golden_images/update_boot_source/test_ssp_data_import_crons.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
from tests.infrastructure.golden_images.constants import (
1515
CUSTOM_DATA_IMPORT_CRON_NAME,
1616
CUSTOM_DATA_SOURCE_NAME,
17-
DEFAULT_FEDORA_REGISTRY_URL,
1817
)
1918
from tests.infrastructure.golden_images.update_boot_source.utils import get_all_dic_volume_names, get_image_version
2019
from utilities.constants import (
2120
BIND_IMMEDIATE_ANNOTATION,
21+
DEFAULT_FEDORA_REGISTRY_URL,
2222
TIMEOUT_1MIN,
2323
TIMEOUT_2MIN,
2424
TIMEOUT_5MIN,

tests/infrastructure/golden_images/update_boot_source/test_ssp_data_sources.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@
1414
CUSTOM_DATA_IMPORT_CRON_NAME,
1515
CUSTOM_DATA_SOURCE_NAME,
1616
DATA_SOURCE_READY_FOR_CONSUMPTION_MESSAGE,
17-
DEFAULT_FEDORA_REGISTRY_URL,
1817
PVC_NOT_FOUND_ERROR,
1918
)
2019
from tests.utils import get_parameters_from_template
21-
from utilities.constants import DATA_SOURCE_NAME, TIMEOUT_5MIN, TIMEOUT_10MIN, Images
20+
from utilities.constants import DATA_SOURCE_NAME, DEFAULT_FEDORA_REGISTRY_URL, TIMEOUT_5MIN, TIMEOUT_10MIN, Images
2221
from utilities.exceptions import ResourceValueError
2322
from utilities.infra import (
2423
cleanup_artifactory_secret_and_config_map,

tests/infrastructure/golden_images/update_boot_source/utils.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@
99
from ocp_resources.volume_snapshot import VolumeSnapshot
1010
from packaging.version import Version
1111

12-
from tests.infrastructure.golden_images.constants import (
13-
DEFAULT_FEDORA_REGISTRY_URL,
14-
)
15-
from utilities.constants import TIMEOUT_30SEC, WILDCARD_CRON_EXPRESSION
12+
from utilities.constants import DEFAULT_FEDORA_REGISTRY_URL, TIMEOUT_30SEC, WILDCARD_CRON_EXPRESSION
1613
from utilities.infra import generate_openshift_pull_secret_file
1714
from utilities.storage import RESOURCE_MANAGED_BY_DATA_IMPORT_CRON_LABEL
1815
from utilities.virt import get_oc_image_info

tests/observability/metrics/conftest.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import bitmath
55
import pytest
66
from ocp_resources.data_source import DataSource
7+
from ocp_resources.datavolume import DataVolume
78
from ocp_resources.deployment import Deployment
89
from ocp_resources.pod import Pod
910
from ocp_resources.resource import ResourceEditor
@@ -39,6 +40,7 @@
3940
from tests.utils import create_vms, start_stress_on_vm
4041
from utilities import console
4142
from utilities.constants import (
43+
DEFAULT_FEDORA_REGISTRY_URL,
4244
IPV4_STR,
4345
KUBEVIRT_VMI_MEMORY_PGMAJFAULT_TOTAL,
4446
KUBEVIRT_VMI_MEMORY_PGMINFAULT_TOTAL,
@@ -50,6 +52,7 @@
5052
ONE_CPU_CORE,
5153
ONE_CPU_THREAD,
5254
OS_FLAVOR_FEDORA,
55+
REGISTRY_STR,
5356
SSP_OPERATOR,
5457
STRESS_CPU_MEM_IO_COMMAND,
5558
TIMEOUT_2MIN,
@@ -85,6 +88,7 @@
8588
VirtualMachineForTests,
8689
fedora_vm_body,
8790
running_vm,
91+
vm_instance_from_template,
8892
)
8993
from utilities.vnc_utils import VNCConnection
9094

@@ -660,3 +664,27 @@ def expected_cpu_affinity_metric_value(vm_with_cpu_spec):
660664

661665
# return multiplication for multi-CPU VMs
662666
return str(cpu_count_from_vm_node * cpu_count_from_vm)
667+
668+
669+
@pytest.fixture()
670+
def vm_with_rwo_dv(request, unprivileged_client, namespace):
671+
dv = DataVolume(
672+
client=unprivileged_client,
673+
source=REGISTRY_STR,
674+
name="non-evictable-vm-dv-for-test",
675+
namespace=namespace.name,
676+
url=DEFAULT_FEDORA_REGISTRY_URL,
677+
size=Images.Fedora.DEFAULT_DV_SIZE,
678+
storage_class=py_config["default_storage_class"],
679+
access_modes=DataVolume.AccessMode.RWO,
680+
api_name="storage",
681+
)
682+
dv.to_dict()
683+
dv_res = dv.res
684+
with vm_instance_from_template(
685+
request=request,
686+
unprivileged_client=unprivileged_client,
687+
namespace=namespace,
688+
data_volume_template={"metadata": dv_res["metadata"], "spec": dv_res["spec"]},
689+
) as vm:
690+
yield vm

tests/observability/metrics/test_vms_metrics.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@
33

44
import bitmath
55
import pytest
6-
from ocp_resources.datavolume import DataVolume
76
from ocp_resources.persistent_volume_claim import PersistentVolumeClaim
87
from ocp_resources.virtual_machine import VirtualMachine
98
from ocp_resources.virtual_machine_instance_migration import (
109
VirtualMachineInstanceMigration,
1110
)
12-
from pytest_testconfig import py_config
1311
from timeout_sampler import TimeoutExpiredError, TimeoutSampler
1412

1513
from tests.observability.metrics.constants import (
@@ -26,7 +24,7 @@
2624
validate_vnic_info,
2725
)
2826
from tests.observability.utils import validate_metrics_value
29-
from tests.os_params import FEDORA_LATEST_LABELS, RHEL_LATEST
27+
from tests.os_params import FEDORA_LATEST_LABELS
3028
from utilities.constants import (
3129
CAPACITY,
3230
LIVE_MIGRATE,
@@ -372,16 +370,9 @@ def test_metric_kubevirt_vm_resource_limits(
372370

373371
class TestKubevirtVmiNonEvictable:
374372
@pytest.mark.parametrize(
375-
"data_volume_scope_function, vm_from_template_with_existing_dv",
373+
"vm_with_rwo_dv",
376374
[
377375
pytest.param(
378-
{
379-
"dv_name": "non-evictable-dv",
380-
"image": RHEL_LATEST["image_path"],
381-
"storage_class": py_config["default_storage_class"],
382-
"dv_size": RHEL_LATEST["dv_size"],
383-
"access_modes": DataVolume.AccessMode.RWO,
384-
},
385376
{
386377
"vm_name": "non-evictable-vm",
387378
"template_labels": FEDORA_LATEST_LABELS,
@@ -398,8 +389,7 @@ class TestKubevirtVmiNonEvictable:
398389
def test_kubevirt_vmi_non_evictable(
399390
self,
400391
prometheus,
401-
data_volume_scope_function,
402-
vm_from_template_with_existing_dv,
392+
vm_with_rwo_dv,
403393
):
404394
validate_metrics_value(
405395
prometheus=prometheus,

tests/storage/cdi_import/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
HPP_STORAGE_CLASSES,
1313
HTTP,
1414
QUAY_FEDORA_CONTAINER_IMAGE,
15-
REGISTRY_STR,
1615
)
1716
from tests.storage.utils import (
1817
clean_up_multiprocess,
@@ -23,6 +22,7 @@
2322
from utilities.constants import (
2423
LINUX_BRIDGE,
2524
OS_FLAVOR_FEDORA,
25+
REGISTRY_STR,
2626
TIMEOUT_1MIN,
2727
TIMEOUT_4MIN,
2828
Images,

tests/storage/cdi_import/test_import_registry.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
from kubernetes.client.rest import ApiException
55
from ocp_resources.datavolume import DataVolume
66

7-
from tests.storage.constants import QUAY_FEDORA_CONTAINER_IMAGE, REGISTRY_STR
7+
from tests.storage.constants import QUAY_FEDORA_CONTAINER_IMAGE
88
from tests.storage.utils import (
99
create_vm_from_dv,
1010
get_importer_pod,
1111
wait_for_importer_container_message,
1212
)
13-
from utilities.constants import OS_FLAVOR_FEDORA, TIMEOUT_5MIN, Images
13+
from utilities.constants import OS_FLAVOR_FEDORA, REGISTRY_STR, TIMEOUT_5MIN, Images
1414
from utilities.ssp import wait_for_condition_message_value
1515
from utilities.storage import ErrorMsg, check_disk_count_in_vm, create_dv
1616
from utilities.virt import running_vm

tests/storage/constants.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
HppCsiStorageClass.Name.HOSTPATH_CSI_PVC_BLOCK,
1313
]
1414

15-
REGISTRY_STR = "registry"
1615
INTERNAL_HTTP_CONFIGMAP_NAME = "internal-https-configmap"
1716
HTTPS_CONFIG_MAP_NAME = "https-cert"
1817
HTTP = "http"

utilities/constants.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -968,3 +968,5 @@ class NamespacesNames:
968968
"nohup stress-ng --vm {workers} --vm-bytes {memory} --vm-method all "
969969
"--verify -t {timeout} -v --hdd 1 --io 1 --vm-keep &> /dev/null &"
970970
)
971+
DEFAULT_FEDORA_REGISTRY_URL = "docker://quay.io/containerdisks/fedora:latest"
972+
REGISTRY_STR = "registry"

0 commit comments

Comments
 (0)