Skip to content

Commit

Permalink
Merge branch 'master' into v2_test_node
Browse files Browse the repository at this point in the history
  • Loading branch information
yangchiu authored Feb 17, 2025
2 parents c778320 + faed93b commit 8b47ff1
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 16 deletions.
8 changes: 6 additions & 2 deletions manager/integration/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -5539,12 +5539,16 @@ def create_backing_image_with_matching_url(client, name, url,
if url == BACKING_IMAGE_RAW_URL:
expected_checksum = BACKING_IMAGE_RAW_CHECKSUM
elif url == BACKING_IMAGE_QCOW2_URL:
expected_checksum = BACKING_IMAGE_QCOW2_CHECKSUM
if DATA_ENGINE == "v2":
expected_checksum = BACKING_IMAGE_RAW_CHECKSUM
else:
expected_checksum = BACKING_IMAGE_QCOW2_CHECKSUM
bi = client.create_backing_image(
name=name, sourceType=BACKING_IMAGE_SOURCE_TYPE_DOWNLOAD,
parameters={"url": url}, expectedChecksum=expected_checksum,
minNumberOfCopies=minNumberOfCopies,
nodeSelector=nodeSelector, diskSelector=diskSelector)
nodeSelector=nodeSelector, diskSelector=diskSelector,
dataEngine=DATA_ENGINE)
assert bi

is_ready = False
Expand Down
34 changes: 29 additions & 5 deletions manager/integration/tests/test_backing_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@
from common import BACKING_IMAGE_STATE_FAILED_AND_CLEANUP
from common import BACKING_IMAGE_STATE_IN_PROGRESS
from common import RETRY_COUNTS_LONG
from common import DATA_ENGINE
import time


@pytest.mark.v2_volume_test # NOQA
@pytest.mark.coretest # NOQA
@pytest.mark.backing_image # NOQA
def test_backing_image_basic_operation(client, volume_name): # NOQA
Expand Down Expand Up @@ -123,6 +125,7 @@ def backing_image_basic_operation_test(client, volume_name, bi_name, bi_url): #
client.delete(backing_image)


@pytest.mark.v2_volume_test # NOQA
@pytest.mark.coretest # NOQA
@pytest.mark.backing_image # NOQA
def test_backing_image_content(client, volume_name): # NOQA
Expand Down Expand Up @@ -206,6 +209,7 @@ def backing_image_content_test(client, volume_name_prefix, bi_name, bi_url): #
cleanup_host_disk(volume_name2)


@pytest.mark.v2_volume_test # NOQA
@pytest.mark.coretest # NOQA
@pytest.mark.backing_image # NOQA
def test_volume_basic_with_backing_image(client, volume_name): # NOQA
Expand Down Expand Up @@ -262,6 +266,7 @@ def test_snapshot_prune_and_coalesce_simultaneously_with_backing_image(client, v
cleanup_all_backing_images(client)


@pytest.mark.v2_volume_test # NOQA
@pytest.mark.coretest # NOQA
@pytest.mark.backing_image # NOQA
@pytest.mark.parametrize("volume_size", [str(BACKING_IMAGE_EXT4_SIZE), SIZE]) # NOQA
Expand All @@ -276,6 +281,7 @@ def test_backup_with_backing_image(set_random_backupstore, client, volume_name,
backupstore_cleanup(client)


@pytest.mark.v2_volume_test # NOQA
@pytest.mark.coretest # NOQA
@pytest.mark.backing_image # NOQA
def test_backup_labels_with_backing_image(set_random_backupstore, client, random_labels, volume_name): # NOQA
Expand All @@ -289,6 +295,7 @@ def test_backup_labels_with_backing_image(set_random_backupstore, client, random
backupstore_cleanup(client)


@pytest.mark.v2_volume_test # NOQA
@pytest.mark.coretest # NOQA
@pytest.mark.backing_image # NOQA
def test_ha_simple_recovery_with_backing_image(client, volume_name): # NOQA
Expand Down Expand Up @@ -359,6 +366,7 @@ def test_engine_live_upgrade_rollback_with_backing_image(client, core_api, volum
cleanup_all_backing_images(client)


@pytest.mark.v2_volume_test # NOQA
@pytest.mark.backing_image # NOQA
@pytest.mark.csi # NOQA
def test_csi_mount_with_backing_image(client, core_api, csi_pv_backingimage, pvc_backingimage, pod_make): # NOQA
Expand All @@ -372,6 +380,7 @@ def test_csi_mount_with_backing_image(client, core_api, csi_pv_backingimage, pvc
cleanup_all_backing_images(client)


@pytest.mark.v2_volume_test # NOQA
@pytest.mark.coretest # NOQA
@pytest.mark.backing_image # NOQA
@pytest.mark.csi # NOQA
Expand All @@ -385,6 +394,7 @@ def test_csi_io_with_backing_image(client, core_api, csi_pv_backingimage, pvc_ba
cleanup_all_backing_images(client)


@pytest.mark.v2_volume_test # NOQA
@pytest.mark.coretest # NOQA
@pytest.mark.backing_image # NOQA
@pytest.mark.csi # NOQA
Expand All @@ -399,6 +409,7 @@ def test_csi_backup_with_backing_image(set_random_backupstore, client, core_api,
backupstore_cleanup(client)


@pytest.mark.v2_volume_test # NOQA
@pytest.mark.backing_image # NOQA
@pytest.mark.recurring_job # NOQA
def test_recurring_job_labels_with_backing_image(set_random_backupstore, client, random_labels, volume_name): # NOQA
Expand Down Expand Up @@ -486,7 +497,8 @@ def test_exporting_backing_image_from_volume(client, volume_name): # NOQA
name=backing_img1_name,
sourceType=BACKING_IMAGE_SOURCE_TYPE_FROM_VOLUME,
parameters={"export-type": "qcow2", "volume-name": volume1_name},
expectedChecksum="")
expectedChecksum="",
dataEngine=DATA_ENGINE)

# Step4
volume2_name = "vol2"
Expand All @@ -508,7 +520,8 @@ def test_exporting_backing_image_from_volume(client, volume_name): # NOQA
name="bi-test2",
sourceType=BACKING_IMAGE_SOURCE_TYPE_FROM_VOLUME,
parameters={"export-type": "qcow2", "volume-name": volume2_name},
expectedChecksum="")
expectedChecksum="",
dataEngine=DATA_ENGINE)

# Step9
volume3_name = "vol3"
Expand All @@ -521,6 +534,7 @@ def test_exporting_backing_image_from_volume(client, volume_name): # NOQA
# Step10
check_volume_data(volume3, data2)


@pytest.mark.backing_image # NOQA
@pytest.mark.parametrize("bi_url", [BACKING_IMAGE_QCOW2_URL, BACKING_IMAGE_RAW_URL]) # NOQA
def test_backing_image_auto_resync(bi_url, client, volume_name): # NOQA
Expand Down Expand Up @@ -567,6 +581,7 @@ def test_backing_image_auto_resync(bi_url, client, volume_name): # NOQA
assert volume.size == str(BACKING_IMAGE_EXT4_SIZE)


@pytest.mark.v2_volume_test # NOQA
@pytest.mark.backing_image # NOQA
def test_backing_image_cleanup(core_api, client): # NOQA
"""
Expand Down Expand Up @@ -630,6 +645,7 @@ def backing_image_cleanup(core_api, client): # NOQA
assert exist is False


@pytest.mark.v2_volume_test # NOQA
@pytest.mark.backing_image # NOQA
@pytest.mark.parametrize("bi_url", [BACKING_IMAGE_QCOW2_URL, BACKING_IMAGE_RAW_URL]) # NOQA
def test_backing_image_with_wrong_md5sum(bi_url, client): # NOQA
Expand All @@ -640,7 +656,8 @@ def test_backing_image_with_wrong_md5sum(bi_url, client): # NOQA
client.create_backing_image(name=BACKING_IMAGE_NAME,
sourceType=BACKING_IMAGE_SOURCE_TYPE_DOWNLOAD,
parameters={"url": bi_url},
expectedChecksum=backing_image_wrong_checksum)
expectedChecksum=backing_image_wrong_checksum,
dataEngine=DATA_ENGINE)

wait_for_backing_image_status(client, BACKING_IMAGE_NAME,
BACKING_IMAGE_STATE_FAILED_AND_CLEANUP)
Expand Down Expand Up @@ -680,7 +697,8 @@ def test_volume_wait_for_backing_image_condition(client): # NOQA
name=backing_img_name,
sourceType=BACKING_IMAGE_SOURCE_TYPE_FROM_VOLUME,
parameters={"export-type": "qcow2", "volume-name": volume1_name},
expectedChecksum="")
expectedChecksum="",
dataEngine=DATA_ENGINE)

# Create volume with that backing image
volume2_name = "vol2"
Expand All @@ -707,6 +725,7 @@ def test_volume_wait_for_backing_image_condition(client): # NOQA
assert vol1_cksum == vol2_cksum


@pytest.mark.v2_volume_test # NOQA
@pytest.mark.backing_image # NOQA
def test_backing_image_min_number_of_replicas(client): # NOQA
"""
Expand Down Expand Up @@ -750,6 +769,7 @@ def test_backing_image_min_number_of_replicas(client): # NOQA
cleanup_all_backing_images(client)


@pytest.mark.v2_volume_test # NOQA
@pytest.mark.backing_image # NOQA
def test_backing_image_selector_setting(client, volume_name): # NOQA
"""
Expand Down Expand Up @@ -792,7 +812,8 @@ def test_backing_image_selector_setting(client, volume_name): # NOQA
numberOfReplicas=1,
diskSelector=volume_disk_selector,
nodeSelector=volume_node_selector,
backingImage=BACKING_IMAGE_NAME)
backingImage=BACKING_IMAGE_NAME,
dataEngine=DATA_ENGINE)
vol = wait_for_volume_detached(client, volume_name)
assert vol.diskSelector == volume_disk_selector
assert vol.nodeSelector == volume_node_selector
Expand All @@ -802,6 +823,7 @@ def test_backing_image_selector_setting(client, volume_name): # NOQA
cleanup_all_backing_images(client)


@pytest.mark.v2_volume_test # NOQA
@pytest.mark.backing_image # NOQA
def test_backing_image_node_eviction(client): # NOQA
"""
Expand Down Expand Up @@ -834,6 +856,7 @@ def test_backing_image_node_eviction(client): # NOQA
cleanup_all_backing_images(client)


@pytest.mark.v2_volume_test # NOQA
@pytest.mark.backing_image # NOQA
def test_backing_image_disk_eviction(client): # NOQA
"""
Expand Down Expand Up @@ -877,6 +900,7 @@ def test_backing_image_disk_eviction(client): # NOQA
cleanup_all_backing_images(client)


@pytest.mark.v2_volume_test # NOQA
@pytest.mark.backing_image # NOQA
def test_backing_image_unable_eviction(client): # NOQA
"""
Expand Down
3 changes: 3 additions & 0 deletions manager/integration/tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -5797,6 +5797,7 @@ def test_backuptarget_invalid(apps_api, # NOQA
BACKUP_TARGET_MESSAGES_INVALID)


@pytest.mark.v2_volume_test # NOQA
@pytest.mark.volume_backup_restore # NOQA
def test_volume_backup_and_restore_with_lz4_compression_method(client, set_random_backupstore, volume_name): # NOQA
"""
Expand Down Expand Up @@ -5829,6 +5830,7 @@ def test_volume_backup_and_restore_with_lz4_compression_method(client, set_rando
compression_method=BACKUP_COMPRESSION_METHOD_LZ4)


@pytest.mark.v2_volume_test # NOQA
@pytest.mark.volume_backup_restore # NOQA
def test_volume_backup_and_restore_with_gzip_compression_method(client, set_random_backupstore, volume_name): # NOQA
"""
Expand Down Expand Up @@ -5861,6 +5863,7 @@ def test_volume_backup_and_restore_with_gzip_compression_method(client, set_rand
compression_method=BACKUP_COMPRESSION_METHOD_GZIP)


@pytest.mark.v2_volume_test # NOQA
@pytest.mark.volume_backup_restore # NOQA
def test_volume_backup_and_restore_with_none_compression_method(client, set_random_backupstore, volume_name): # NOQA
"""
Expand Down
24 changes: 19 additions & 5 deletions manager/integration/tests/test_kubernetes.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from common import update_setting
from common import SETTING_DEGRADED_AVAILABILITY
from common import wait_statefulset, crash_engine_process_with_sigkill
from common import DATA_ENGINE

from backupstore import backupstore_cleanup

Expand Down Expand Up @@ -108,6 +109,7 @@ def provision_and_wait_pv(client, core_api, storage_class, pvc): # NOQA
return pv


@pytest.mark.v2_volume_test # NOQA
@pytest.mark.csi # NOQA
def test_kubernetes_status(client, core_api, storage_class, # NOQA
statefulset, csi_pv, pvc, pod): # NOQA
Expand Down Expand Up @@ -311,6 +313,7 @@ def test_kubernetes_status(client, core_api, storage_class, # NOQA
wait_delete_pv(core_api, p['pv_name'])


@pytest.mark.v2_volume_test # NOQA
@pytest.mark.csi # NOQA
def test_pv_creation(client, core_api): # NOQA
"""
Expand All @@ -323,7 +326,8 @@ def test_pv_creation(client, core_api): # NOQA
"""
volume_name = "test-pv-creation" # NOQA
client.create_volume(name=volume_name, size=SIZE,
numberOfReplicas=2)
numberOfReplicas=2,
dataEngine=DATA_ENGINE)
volume = wait_for_volume_detached(client, volume_name)

pv_name = "pv-" + volume_name
Expand All @@ -348,6 +352,7 @@ def test_pv_creation(client, core_api): # NOQA
delete_and_wait_pv(core_api, pv_name)


@pytest.mark.v2_volume_test # NOQA
@pytest.mark.csi # NOQA
def test_pvc_creation_with_default_sc_set(
client, core_api, storage_class, pod): # NOQA
Expand Down Expand Up @@ -385,7 +390,8 @@ def test_pvc_creation_with_default_sc_set(
volume_name = "test-pvc-creation-with-sc" # NOQA
pod_name = "pod-" + volume_name
client.create_volume(name=volume_name, size=SIZE,
numberOfReplicas=2)
numberOfReplicas=2,
dataEngine=DATA_ENGINE)
volume = wait_for_volume_detached(client, volume_name)

pv_name = "pv-" + volume_name
Expand Down Expand Up @@ -498,6 +504,7 @@ def test_pvc_creation_with_default_sc_set(
delete_and_wait_pv(core_api, pv_name)


@pytest.mark.v2_volume_test # NOQA
@pytest.mark.csi # NOQA
def test_backup_kubernetes_status(set_random_backupstore, client, core_api, pod, storage_class): # NOQA
"""
Expand Down Expand Up @@ -536,7 +543,8 @@ def test_backup_kubernetes_status(set_random_backupstore, client, core_api, pod,

volume_name = "test-backup-kubernetes-status-pod" # NOQA
client.create_volume(name=volume_name, size=SIZE,
numberOfReplicas=2)
numberOfReplicas=2,
dataEngine=DATA_ENGINE)
volume = wait_for_volume_detached(client, volume_name)

pod_name = "pod-" + volume_name
Expand Down Expand Up @@ -602,7 +610,8 @@ def test_backup_kubernetes_status(set_random_backupstore, client, core_api, pod,
restore_name = generate_volume_name()
client.create_volume(name=restore_name, size=SIZE,
numberOfReplicas=2,
fromBackup=b.url)
fromBackup=b.url,
dataEngine=DATA_ENGINE)
wait_for_volume_restoration_completed(client, restore_name)
wait_for_volume_detached(client, restore_name)

Expand Down Expand Up @@ -671,7 +680,8 @@ def test_backup_kubernetes_status(set_random_backupstore, client, core_api, pod,
restore_name = generate_volume_name()
client.create_volume(name=restore_name, size=SIZE,
numberOfReplicas=2,
fromBackup=b.url)
fromBackup=b.url,
dataEngine=DATA_ENGINE)
wait_for_volume_restoration_completed(client, restore_name)
wait_for_volume_detached(client, restore_name)

Expand All @@ -694,6 +704,7 @@ def test_backup_kubernetes_status(set_random_backupstore, client, core_api, pod,
cleanup_volume(client, volume)


@pytest.mark.v2_volume_test # NOQA
@pytest.mark.csi # NOQA
def test_delete_with_static_pv(client, core_api, volume_name): # NOQA
"""
Expand Down Expand Up @@ -731,6 +742,7 @@ def test_delete_with_static_pv(client, core_api, volume_name): # NOQA
wait_delete_pvc(core_api, pvc_name)


@pytest.mark.v2_volume_test # NOQA
@pytest.mark.csi # NOQA
def test_delete_with_provisioned_pv(client, core_api, storage_class, pvc): # NOQA
"""
Expand All @@ -757,6 +769,7 @@ def test_delete_with_provisioned_pv(client, core_api, storage_class, pvc): # NOQ
wait_delete_pvc(core_api, pvc['metadata']['name'])


@pytest.mark.v2_volume_test # NOQA
@pytest.mark.csi # NOQA
def test_delete_provisioned_pvc(client, core_api, storage_class, pvc): # NOQA
"""
Expand All @@ -781,6 +794,7 @@ def test_delete_provisioned_pvc(client, core_api, storage_class, pvc): # NOQA
wait_for_volume_delete(client, volume_name)


@pytest.mark.v2_volume_test # NOQA
@pytest.mark.csi # NOQA
def test_csi_umount_when_longhorn_block_device_is_disconnected_unexpectedly(client, core_api, statefulset, storage_class): # NOQA
"""
Expand Down
Loading

0 comments on commit 8b47ff1

Please sign in to comment.