Skip to content

Add lvm test cases#2678

Open
khushboo-rancher wants to merge 1 commit into
harvester:mainfrom
khushboo-rancher:test_lvm
Open

Add lvm test cases#2678
khushboo-rancher wants to merge 1 commit into
harvester:mainfrom
khushboo-rancher:test_lvm

Conversation

@khushboo-rancher

Copy link
Copy Markdown
Collaborator

Which issue(s) this PR fixes:

Issue #
harvester/harvester#10564

What this PR does / why we need it:

It covers test cases for lvm

Special notes for your reviewer:

The rest API are pending for implementation

Additional documentation or context

While implementing the test cases, I've done some improvements in naming of keywords too.

Copilot AI review requested due to automatic review settings June 4, 2026 00:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds end-to-end Robot Framework regression coverage for Harvester’s LVM local storage addon, including provisioning LVM volume groups, creating LVM-backed PVCs/StorageClasses, attaching them to VMs, validating data integrity, snapshot/restore flows, and volume expansion. It also refactors/renames several addon-related Robot keywords and introduces new supporting Python components (StorageClass, Snapshot) and CRD helpers required by the LVM tests.

Changes:

  • Add a new LVM regression suite (test_lvm.robot) plus new/updated Robot resource keywords to create LVM SCs/volumes/VMs and run snapshot + expand scenarios.
  • Introduce new Python components and CRD implementations to support LVM flows (StorageClass, Snapshot, VM/Volume PVC expand helpers, blockdevice LVM VG provisioning).
  • Rename/standardize addon Robot keywords (monitoring/PCI/NVIDIA toolkit) and update affected test suites accordingly.

Reviewed changes

Copilot reviewed 56 out of 56 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
harvester_robot_tests/tests/regression/test_nvidia_toolkit_addon.robot Updates test to use renamed addon keywords.
harvester_robot_tests/tests/regression/test_lvm.robot New LVM regression test suite covering attach, snapshot/restore, and expansion scenarios.
harvester_robot_tests/tests/regression/test_addon.robot Updates teardown keyword name for Prometheus port-forward stop.
harvester_robot_tests/libs/volume/volume.py Adds expand_pvc pass-through for LVM PVC resize operations.
harvester_robot_tests/libs/volume/rest.py Adds REST stub for expand_pvc.
harvester_robot_tests/libs/volume/crd.py Adds PVC volumeMode, improves PVC delete retry, and adds CRD expand_pvc.
harvester_robot_tests/libs/volume/base.py Adds abstract expand_pvc to the Volume interface.
harvester_robot_tests/libs/vm/vm.py Adds LVM-oriented VM helper methods (attach/check disk/write/delete/expand/verify).
harvester_robot_tests/libs/vm/rest.py Adds REST stubs and sets default cloud-init user data.
harvester_robot_tests/libs/vm/crd.py Adds substantial CRD support for LVM VM creation/attach and in-guest validation via guest agent exec.
harvester_robot_tests/libs/vm/base.py Extends VM base interface with attach/checksum/delete/expand/verify methods.
harvester_robot_tests/libs/storageclass/storageclass.py New StorageClass component selecting CRD/REST strategy.
harvester_robot_tests/libs/storageclass/rest.py REST stub for StorageClass operations.
harvester_robot_tests/libs/storageclass/crd.py CRD implementation to create/delete/get-node for LVM StorageClasses.
harvester_robot_tests/libs/storageclass/base.py Base interface for StorageClass implementations.
harvester_robot_tests/libs/storageclass/init.py Exposes StorageClass component package.
harvester_robot_tests/libs/snapshot/snapshot.py New Snapshot component selecting CRD/REST strategy.
harvester_robot_tests/libs/snapshot/rest.py REST stub for Snapshot operations.
harvester_robot_tests/libs/snapshot/crd.py CRD implementation to take and restore Harvester VM snapshots (VirtualMachineBackup/Restore).
harvester_robot_tests/libs/snapshot/base.py Base interface for Snapshot implementations.
harvester_robot_tests/libs/snapshot/init.py Exposes Snapshot component package.
harvester_robot_tests/libs/setting/setting.py Adds Setting APIs for configuring/removing CSI driver entries.
harvester_robot_tests/libs/setting/rest.py Adds REST stubs for new Setting operations.
harvester_robot_tests/libs/setting/crd.py Implements CRD update logic for csi-driver-config setting (add/remove provisioner).
harvester_robot_tests/libs/setting/base.py Extends Setting base interface with CSI driver config methods.
harvester_robot_tests/libs/network/rest.py Adds VLAN-config deletion wait, but also inadvertently breaks cluster-network readiness in REST impl.
harvester_robot_tests/libs/network/network.py Exposes VLAN-config deletion wait via component wrapper.
harvester_robot_tests/libs/network/crd.py Adds CRD wait for VLAN-config deletion.
harvester_robot_tests/libs/network/base.py Extends Network base interface with VLAN-config deletion wait.
harvester_robot_tests/libs/keywords/volume_keywords.py Adjusts volume create defaults and adds LVM PVC expansion keyword.
harvester_robot_tests/libs/keywords/vm_keywords.py Adds LVM-oriented VM keywords and integrates Snapshot component lazily.
harvester_robot_tests/libs/keywords/storage_keywords.py Adds LVM disk/VG/SC provisioning and cleanup keywords.
harvester_robot_tests/libs/keywords/setting_keywords.py Adds keywords to configure/remove CSI driver entries.
harvester_robot_tests/libs/keywords/rancher_keywords.py Switches to shared DEFAULT_USER_DATA constant for user-data defaults.
harvester_robot_tests/libs/keywords/network_keywords.py Adds keyword for waiting until VLAN config deletion completes.
harvester_robot_tests/libs/keywords/common_keywords.py Removes no-op cleanup keyword stubs.
harvester_robot_tests/libs/keywords/addon_keywords.py Adds keyword to install addon YAML from URL.
harvester_robot_tests/libs/constant.py Adds LVM/snapshot-related constants and unifies cloud-init user data constant.
harvester_robot_tests/libs/blockdevice/rest.py Adds REST stubs for new blockdevice LVM methods.
harvester_robot_tests/libs/blockdevice/crd.py Adds CRD logic to select disks, provision LVM VGs, wait for active, and cleanup.
harvester_robot_tests/libs/blockdevice/blockdevice.py Exposes new blockdevice LVM methods via wrapper.
harvester_robot_tests/libs/blockdevice/base.py Extends Blockdevice base interface with LVM provisioning methods.
harvester_robot_tests/libs/addon/rest.py Adds REST stub for addon YAML installation.
harvester_robot_tests/libs/addon/crd.py Adds CRD method to apply addon YAML from URL.
harvester_robot_tests/libs/addon/base.py Extends addon base interface with addon YAML installation.
harvester_robot_tests/libs/addon/addon.py Exposes addon YAML installation via wrapper.
harvester_robot_tests/keywords/volume.resource Adds/centralizes volume resource keywords file.
harvester_robot_tests/keywords/virtualmachine.resource Adds LVM VM data/snapshot/expand keywords and imports snapshot keyword library.
harvester_robot_tests/keywords/variables.resource Adds configurable LVM_VG_TYPE variable.
harvester_robot_tests/keywords/storageclass.resource Adds LVM StorageClass resource keyword.
harvester_robot_tests/keywords/storage.resource Adds LVM setup/volume creation/expand/cleanup keywords and suite-scoped LVM state.
harvester_robot_tests/keywords/setting.resource Adds LVM CSI driver setting configuration/reset keywords.
harvester_robot_tests/keywords/network.resource Adds keyword to wait for VLAN config deletion before deleting ClusterNetwork.
harvester_robot_tests/keywords/image.resource Removes unnecessary common.resource dependency.
harvester_robot_tests/keywords/common.resource Adds shared-resource suite setup/teardown (network + image) used by LVM suite.
harvester_robot_tests/keywords/addon.resource Renames addon keywords consistently and adds “Install Addon From URL” keyword.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread harvester_robot_tests/keywords/virtualmachine.resource
Comment thread harvester_robot_tests/libs/vm/vm.py Outdated
Comment thread harvester_robot_tests/libs/vm/vm.py Outdated
Comment thread harvester_robot_tests/libs/vm/base.py
Comment thread harvester_robot_tests/libs/vm/rest.py Outdated
Comment thread harvester_robot_tests/libs/storageclass/rest.py Outdated
Comment thread harvester_robot_tests/libs/blockdevice/base.py
Comment thread harvester_robot_tests/libs/blockdevice/rest.py
Comment thread harvester_robot_tests/libs/volume/crd.py
Comment thread harvester_robot_tests/libs/volume/crd.py
@khushboo-rancher khushboo-rancher force-pushed the test_lvm branch 2 times, most recently from 3539264 to 09affa3 Compare June 4, 2026 22:31
@khushboo-rancher khushboo-rancher requested a review from a team June 4, 2026 22:31
jbrockmeyer
jbrockmeyer previously approved these changes Jun 4, 2026
Log Setting up shared resources for the test suite

# Initialize test variables
${timestamp}= Evaluate __import__('datetime').datetime.now().strftime("%Y%m%d%H%M%S")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fetching timestamps is a frequently used operation, may have a common keyword Get Timestamp and support different forms?

# Create shared resources
network_keywords.create_cluster_network ${CLUSTER_NETWORK_NAME}
network_keywords.create_vlan_config ${VLAN_CONFIG_NAME} ${CLUSTER_NETWORK_NAME} ${VLAN_NIC}
network_keywords.wait_for_cluster_network_ready ${CLUSTER_NETWORK_NAME}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we prefer the style to handle most logic in python layer and just call them in the RF layer?
If that's the case, we can make it a guide in README.md

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea! I'll update the Readme

Comment thread harvester_robot_tests/keywords/variables.resource Outdated
${_vg_name}= Set Variable If '${LVM_VG_TYPE}' == 'dm-thin' vg-dm-thin vg-dm-striped
${_sc_name}= Set Variable If '${LVM_VG_TYPE}' == 'dm-thin' lvm-sc-dm-thin lvm-sc-dm-striped
${_suffix}= Set Variable If '${LVM_VG_TYPE}' == 'dm-thin' thin striped
Set Suite Variable ${LVM_VG_ACTIVE} ${_vg_name}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imo, we should avoid or less update suite variable in keyword cuz it's implicit for keyword user. Some explicit ways are

  1. Passing variables via arguments, return them back and let layer 4 (.robot) to handle it.
  2. Emphasize in keyword name to let user know the value of passing variable will be change. (e.g. Create Volume Group and Update Suite Variable)
  3. ...

*** Test Cases ***
Test LVM Block Volume Attach And Data Integrity
[Tags] p0 smoke
[Documentation] Create LVM block volume, attach to VM, write data and verify md5sum

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the BDD test cases themselves are already step-by-step and quite descriptive, so no need to duplicate the steps in the documentation.

Signed-off-by: Khushboo <fnu.khushboo@suse.com>
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.

4 participants