Skip to content

[e2e] update test cases for volume storage class naming changes#2524

Merged
khushboo-rancher merged 2 commits intoharvester:mainfrom
lanfon72:e2e-rework
Mar 19, 2026
Merged

[e2e] update test cases for volume storage class naming changes#2524
khushboo-rancher merged 2 commits intoharvester:mainfrom
lanfon72:e2e-rework

Conversation

@lanfon72
Copy link
Copy Markdown
Member

Which issue(s) this PR fixes:

Issue #1189 (from harvester/harvester#5165)

What this PR does / why we need it:

v1.8.0 introduce the new storage class naming for volume (created with image), it will affect our existing test cases.

Special notes for your reviewer:

Test case updated:

<Package integrations>
  <Module test_1_images.py>
    <Class TestBackendImages>
      <Function test_edit_image_in_use[image_opensuse]>
      <Function test_edit_image_in_use[image_ubuntu]>
    <Class TestImageEnhancements>
      <Function test_image_concurrent_operations>
      <Function test_image_complete_lifecycle[image_opensuse]>
      <Function test_image_complete_lifecycle[image_ubuntu]>
  <Module test_1_volumes.py>
    <Function test_create_volume[New-json]>
    <Function test_create_volume[New-yaml]>
    <Function test_create_volume[VM Image-json]>
    <Function test_create_volume[VM Image-yaml]>
    <Function test_create_volume_bad_checksum[New-json]>
    <Function test_create_volume_bad_checksum[New-yaml]>
    <Function test_create_volume_bad_checksum[VM Image-json]>
    <Function test_create_volume_bad_checksum[VM Image-yaml]>
    <Function test_delete_volume_when_exporting>
    <Function test_concurrent_volume_creation[3]>
    <Function test_concurrent_volume_creation[5]>
    <Function test_volume_resize_operations>
    <Function test_volume_shrink_not_allowed>
  <Module test_3_vm_functions.py>
    <Class TestVMWithVolumes>
      <Function test_create_with_volume_image>

Implementation details

  1. ADD new volume manager VolManager180 to expand the create function for image_uid
  2. ADD new volume model VolumeSpec180 to handle the new argument image_uid
  3. ADD new class method VolumeSpec.for_image as the handy method to create volume with image.

Demonstration

imgmgr = "api.images"
volmgr = "api.volumes"
image_info = "dict from image, must contains 'metadata' and 'status'"

# fast way: create the volume as the image size
spec = volmgr.Spec.for_image(image_info)
volmgr.create("volume name", spec)

# old way
spec = volmgr.Spec("volume size, ideally it should >= virtual image size")
image_id = image_info['metadata']['namespace'] + / + image_info['metadata']['name']
volmgr.create("volume name", spec, image_id=image_id, image_uid=image_info['metadata']['uid'])

Caveats

  1. Volume manager will support the new image_uid but do nothing in old implementation
  2. The new class method for_image will handle the legacy/new storage class name via image_info.status.storageClassName, but the value might be empty if the image was not succeed downloaded. (or other case that the image is not usable)
  3. You can still use old way to assign the image_uid to VolumeSpec. (the old way)

Signed-off-by: Lanfon Fan <lanfon.fan@suse.com>
@lanfon72 lanfon72 requested a review from a team March 19, 2026 19:51
@lanfon72 lanfon72 self-assigned this Mar 19, 2026
@lanfon72 lanfon72 force-pushed the e2e-rework branch 2 times, most recently from ddaf660 to 4c4a938 Compare March 19, 2026 19:58
@lanfon72
Copy link
Copy Markdown
Member Author

lanfon72 commented Mar 19, 2026

the keyword to filter test cases (which changed in this PR):

(edit_image and depends) or image_complete or (create_volume and not spec and not terra) or bad_checksum or exporting or create_with_vol or concurrent or resize_oper or shrink

Signed-off-by: Lanfon Fan <lanfon.fan@suse.com>
@khushboo-rancher khushboo-rancher merged commit a7aa88a into harvester:main Mar 19, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants