Skip to content
Open
Show file tree
Hide file tree
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
31 changes: 0 additions & 31 deletions tests/storage/hpp/conftest.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
import pytest
from ocp_resources.persistent_volume import PersistentVolume
from ocp_resources.persistent_volume_claim import PersistentVolumeClaim
from ocp_resources.resource import ResourceEditor

from tests.storage.hpp.utils import (
DV_NAME,
HPP_KEY,
HPP_NODE_PLACEMENT_DICT,
TYPE,
VM_NAME,
update_node_taint,
wait_for_desired_hpp_pods_running,
)
from tests.utils import create_cirros_vm
from utilities.constants.timeouts import TIMEOUT_5MIN
Expand Down Expand Up @@ -89,32 +84,6 @@ def update_node_labels(worker_node1):
worker_resource.restore()


@pytest.fixture()
def updated_hpp_with_node_placement(
worker_node2,
worker_node3,
hostpath_provisioner_scope_module,
request,
hpp_daemonset_scope_session,
schedulable_nodes,
):
node_placement_type = request.param[TYPE]
with ResourceEditor(
patches={hostpath_provisioner_scope_module: HPP_NODE_PLACEMENT_DICT[node_placement_type]}
) as updated_resource:
if node_placement_type == "tolerations":
with update_node_taint(node=worker_node2), update_node_taint(node=worker_node3):
# Wait for 1 hpp pod to be running, and for others to be deleted
wait_for_desired_hpp_pods_running(hpp_daemonset=hpp_daemonset_scope_session, number_of_pods=1)
yield updated_resource
else:
# Wait for 1 hpp pod to be running, and for others to be deleted
wait_for_desired_hpp_pods_running(hpp_daemonset=hpp_daemonset_scope_session, number_of_pods=1)
yield updated_resource
# Wait for hpp pods to be restored
wait_for_desired_hpp_pods_running(hpp_daemonset=hpp_daemonset_scope_session, number_of_pods=len(schedulable_nodes))


@pytest.fixture()
def cirros_pvc_on_hpp(cirros_vm_for_node_placement_tests):
return PersistentVolumeClaim(
Expand Down
29 changes: 1 addition & 28 deletions tests/storage/hpp/test_hostpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@
from ocp_resources.service_monitor import ServiceMonitor

from utilities.constants.components import HOSTPATH_PROVISIONER_OPERATOR, HPP_POOL
from utilities.constants.timeouts import TIMEOUT_1MIN, TIMEOUT_5MIN
from utilities.constants.timeouts import TIMEOUT_1MIN
from utilities.infra import get_pod_by_name_prefix

LOGGER = logging.getLogger(__name__)

HOSTPATH_PROVISIONER_ADMIN = "hostpath-provisioner-admin"
VOLUME_BINDING_MODE = "volumeBindingMode"

pytestmark = pytest.mark.hpp

Expand Down Expand Up @@ -76,13 +75,6 @@ def verify_hpp_app_label(hpp_resources, cnv_version):
), f"Missing label {Resource.ApiGroup.APP_KUBERNETES_IO}/managed-by for {resource.name}"


@pytest.fixture(scope="module")
def hpp_operator_deployment(hco_namespace):
hpp_operator_deployment = Deployment(name=HOSTPATH_PROVISIONER_OPERATOR, namespace=hco_namespace.name)
assert hpp_operator_deployment.exists
return hpp_operator_deployment


@pytest.fixture(scope="module")
def hpp_prometheus_resources(hco_namespace):
rbac_name = "hostpath-provisioner-monitoring"
Expand Down Expand Up @@ -240,25 +232,6 @@ def test_hpp_operator_pod(hpp_operator_pod):
assert hpp_operator_pod.status == Pod.Status.RUNNING, f"HPP operator pod {hpp_operator_pod.name} is not running"


@pytest.mark.destructive
@pytest.mark.polarion("CNV-3277")
def test_hpp_operator_recreate_after_deletion(
hpp_operator_deployment,
storage_class_matrix_hpp_matrix__module__,
):
"""
Check that Hostpath-provisioner operator will be created again by HCO after its deletion.
The Deployment is deleted, then its RepliceSet and Pod will be deleted and created again.
"""
pre_delete_binding_mode = storage_class_matrix_hpp_matrix__module__.instance[VOLUME_BINDING_MODE]
hpp_operator_deployment.delete()
hpp_operator_deployment.wait_for_replicas(timeout=TIMEOUT_5MIN)
recreated_binding_mode = storage_class_matrix_hpp_matrix__module__.instance[VOLUME_BINDING_MODE]
assert pre_delete_binding_mode == recreated_binding_mode, (
f"Pre delete binding mode: {pre_delete_binding_mode}, differs from recreated: {recreated_binding_mode}"
)


@pytest.mark.sno
@pytest.mark.polarion("CNV-6097")
@pytest.mark.s390x
Expand Down
44 changes: 0 additions & 44 deletions tests/storage/hpp/test_hpp_node_placement.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,60 +8,16 @@

from tests.storage.hpp.utils import (
DV_NAME,
HCO_NODE_PLACEMENT,
NODE_SELECTOR,
TYPE,
VM_NAME,
edit_hpp_with_node_selector,
)
from utilities.constants.cluster import NODE_STR
from utilities.storage import check_disk_count_in_vm

LOGGER = logging.getLogger(__name__)

pytestmark = pytest.mark.hpp


@pytest.mark.destructive
@pytest.mark.parametrize(
(
"updated_hpp_with_node_placement",
"hyperconverged_with_node_placement",
"cirros_vm_for_node_placement_tests",
),
[
pytest.param(
{TYPE: NODE_SELECTOR},
HCO_NODE_PLACEMENT,
{DV_NAME: "dv-5711", VM_NAME: "vm-5711", NODE_STR: None},
marks=pytest.mark.polarion("CNV-5711"),
),
pytest.param(
{TYPE: "affinity"},
HCO_NODE_PLACEMENT,
{DV_NAME: "dv-5712", VM_NAME: "vm-5712", NODE_STR: None},
marks=pytest.mark.polarion("CNV-5712"),
),
pytest.param(
{TYPE: "tolerations"},
HCO_NODE_PLACEMENT,
{DV_NAME: "dv-5713", VM_NAME: "vm-5713", NODE_STR: None},
marks=pytest.mark.polarion("CNV-5713"),
),
],
indirect=True,
)
def test_create_dv_on_right_node_with_node_placement(
worker_node1,
update_node_labels,
updated_hpp_with_node_placement,
hyperconverged_with_node_placement,
cirros_vm_for_node_placement_tests,
):
# The VM should be created on the node that have the node labels
assert cirros_vm_for_node_placement_tests.vmi.node.name == worker_node1.name


@pytest.mark.post_upgrade
@pytest.mark.parametrize(
"cirros_vm_for_node_placement_tests",
Expand Down