Skip to content
Merged
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
5 changes: 2 additions & 3 deletions tests/storage/cdi_import/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ def dv_from_http_import(
content_type=request.param.get("content_type", DataVolume.ContentType.KUBEVIRT),
cert_configmap=request.param.get("configmap_name"),
size=request.param.get("size", DEFAULT_DV_SIZE),
volume_mode=request.param.get("volume_mode"),
Comment thread
jpeimer marked this conversation as resolved.
storage_class=storage_class_name_scope_module,
client=namespace.client,
) as dv:
Expand All @@ -101,15 +102,13 @@ def dv_from_http_import(

@pytest.fixture()
def running_pod_with_dv_pvc(
storage_class_matrix__module__,
storage_class_name_scope_module,
dv_from_http_import,
):
"""Create a running pod with DV's PVC."""
dv_from_http_import.wait_for_dv_success()
with create_pod_for_pvc(
pvc=dv_from_http_import.pvc,
volume_mode=storage_class_matrix__module__[storage_class_name_scope_module]["volume_mode"],
volume_mode=dv_from_http_import.pvc.instance.spec.volumeMode,
) as pod:
yield pod

Expand Down
9 changes: 2 additions & 7 deletions tests/storage/cdi_import/test_import_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ def test_successful_import_image(
"source": HTTPS,
"content_type": DataVolume.ContentType.ARCHIVE,
"configmap_name": INTERNAL_HTTP_CONFIGMAP_NAME,
"volume_mode": DataVolume.VolumeMode.FILE, # Archive type only supports Filesystem volume mode
},
marks=pytest.mark.polarion("CNV-2338"),
),
Expand All @@ -131,13 +132,7 @@ def test_successful_import_image(
)
@pytest.mark.sno
@pytest.mark.s390x
def test_successful_import_secure_archive(
skip_block_volumemode_scope_module, internal_http_configmap, running_pod_with_dv_pvc
):
"""
Skip block volume mode - archive does not support block mode DVs,
https://github.com/kubevirt/containerized-data-importer/blob/main/doc/supported_operations.md
"""
def test_successful_import_secure_archive(internal_http_configmap, running_pod_with_dv_pvc):
Comment thread
coderabbitai[bot] marked this conversation as resolved.
assert_num_files_in_pod(pod=running_pod_with_dv_pvc, expected_num_of_files=3)


Expand Down
11 changes: 0 additions & 11 deletions tests/storage/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,17 +296,6 @@ def download_image():
get_downloaded_artifact(remote_name=f"{Images.Cdi.DIR}/{Images.Cdi.QCOW2_IMG}", local_name=LOCAL_PATH)


def _skip_block_volumemode(storage_class_matrix):
storage_class = [*storage_class_matrix][0]
if storage_class_matrix[storage_class]["volume_mode"] == "Block":
pytest.skip("Test is not supported on Block volume mode")


@pytest.fixture(scope="module")
def skip_block_volumemode_scope_module(storage_class_matrix__module__):
_skip_block_volumemode(storage_class_matrix=storage_class_matrix__module__)


@pytest.fixture()
def default_fs_overhead(cdi_config):
return float(cdi_config.instance.status.filesystemOverhead["global"])
Expand Down
9 changes: 6 additions & 3 deletions tests/storage/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,9 +440,12 @@ def get_file_url(url, file_name):


def assert_num_files_in_pod(pod, expected_num_of_files):
num_of_file_in_pod = pod.execute(command=shlex.split("ls -1 /pvc")).count("\n")
assert num_of_file_in_pod == expected_num_of_files, (
f"Number of file in pod is {num_of_file_in_pod}, while the expected is {expected_num_of_files}"
files = [
line for line in pod.execute(command=shlex.split("ls -1 /pvc")).splitlines() if line and line != "lost+found"
]
num_of_files_in_pod = len(files)
assert num_of_files_in_pod == expected_num_of_files, (
f"Number of files in pod is {num_of_files_in_pod}, while the expected is {expected_num_of_files}"
)


Expand Down