Add chart upgrade test#2731
Conversation
There was a problem hiding this comment.
Pull request overview
Adds Rancher integration coverage for upgrading Harvester CSI and cloud provider charts (n-1 → latest) on imported RKE2 clusters, including new Rancher library capabilities to perform chart upgrades/uninstalls and to validate chart repo/app state during those operations.
Changes:
- Add Robot upgrade test cases for CSI + cloud provider charts on imported RKE2 clusters, plus supporting upgrade/restart/cleanup keywords.
- Extend Rancher client layers (REST/CRD + wrappers) with deployment scaling, chart upgrade/uninstall, and “wait with expected version/branch” verification.
- Introduce optional
CSI_CHART_VERSION/CP_CHART_VERSIONvariables to pin chart versions for install/upgrade scenarios.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| harvester_robot_tests/tests/regression/test_rancher_integration.robot | Adds CSI/cloud provider chart upgrade test cases and updates tags/setup steps. |
| harvester_robot_tests/libs/rancher/rest.py | Implements REST-side deployment scaling, chart upgrade/uninstall, chart deletion wait, and adds optional branch/version verification in waiters. |
| harvester_robot_tests/libs/rancher/crd.py | Implements CRD/kubectl-side deployment scaling, chart upgrade/uninstall, chart deletion wait, and adds optional branch/version verification in waiters. |
| harvester_robot_tests/libs/rancher/rancher.py | Exposes new Rancher operations through the delegating wrapper (REST/CRD). |
| harvester_robot_tests/libs/rancher/base.py | Extends the abstract Rancher interface with the new operations and waiter parameters. |
| harvester_robot_tests/libs/keywords/rancher_keywords.py | Exposes new Rancher operations to Robot keywords, including “upgrade latest if version empty” behavior. |
| harvester_robot_tests/keywords/variables.resource | Adds CSI_CHART_VERSION and CP_CHART_VERSION variables for version pinning. |
| harvester_robot_tests/keywords/rancher.resource | Adds Robot keywords for upgrade/uninstall/scale, upgrade test flows, and expected branch/version verification wiring. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
LGTM.
While I have a question at the time running these test on the lab environment provisioned by the CI Jenkins job.
I trigger the test toward the lab environment provisioned by job harvester-rancher-integration-test/216
The test report shows Skipped on Test Upgrade Harvester Cloud Provider Chart On Imported RKE2 Cluster
Only 1 harvester-cloud-provider chart version(s) available; need at least 2 to test upgrade
Environment file:
Related report files:
I also notice the Jenkins job have the same situation
Not sure whether we need to specify the current or previous version to make the upgrade cloud provider chart test running well.
| ${base}= Set Variable ${IMPORT_CLUSTER_NAME} | ||
| ELSE | ||
| ${base}= Set Variable ${suffix}-${IMPORT_CLUSTER_NAME} | ||
| END |
There was a problem hiding this comment.
nit:
${base}= Set Variable If '${suffix}' == '${EMPTY}' ${IMPORT_CLUSTER_NAME} ${suffix}-${IMPORT_CLUSTER_NAME}
| # Resolve CSI driver chart version (latest when not specified) | ||
| IF '${version}' == '${EMPTY}' | ||
| ${csi_versions}= Get Chart Versions rancher-charts harvester-csi-driver ${cluster_id} | ||
| ${version}= Get From List ${csi_versions} 0 |
There was a problem hiding this comment.
imo it's good to add a keyword Get Latest Chart Version and we can also check empty return value there.
There was a problem hiding this comment.
Addressed
| ${versions}= Get Chart Versions rancher-charts harvester-cloud-provider ${IMPORT_CLUSTER_ID} | ||
| ${count}= Get Length ${versions} | ||
| IF '${CP_CHART_VERSION}' != '${EMPTY}' | ||
| ${idx}= Get Index From List ${versions} ${CP_CHART_VERSION} |
There was a problem hiding this comment.
In my understanding, there are 2 forms for chart version, e.g. 0.2.5 and 108.0.1+up0.2.11, which one should we give?
There was a problem hiding this comment.
108.0.1+up0.2.11 is the right one. The exact format which displays on Rancher
a14409a to
4fc2a3d
Compare
Signed-off-by: Khushboo <[email protected]>
4fc2a3d to
3c846f7
Compare
Signed-off-by: khushboo-rancher <[email protected]>
|
@TachunLin The upgrade of cloud provider skipped due to the fact that there is only one version available in Rancher. |
|
Tick the box to add this pull request to the merge queue (same as
|

Which issue(s) this PR fixes:
Issue # #2721
What this PR does / why we need it:
This PR adds test to verify the upgrade of chart from n-1 to latest.
Added CSI_CHART_VERSION & CP_CHART_VERSION which enable us to test specific version of chart.
Special notes for your reviewer:
Additional documentation or context