Skip to content

Add TestVolumeEncryption#751

Open
hamistao wants to merge 18 commits into
rancher:mainfrom
hamistao:longhorn_encryption_test
Open

Add TestVolumeEncryption#751
hamistao wants to merge 18 commits into
rancher:mainfrom
hamistao:longhorn_encryption_test

Conversation

@hamistao

@hamistao hamistao commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

This PR introduces the test TestVolumeEncryption to our LonghornTestSuite. Among other small unrelated improvements to the codebase.

Said test required introducing new helper funcitions to handle longhorn resources such as voluemes, backups and backuptargets. These functions can also be moved to shepherd if we think it would make more sense for them to live there. Comments on the operations performed during the test are greatly appreciated as this is a very complex test and there are many possible approaches to satisfying the steps outlined in the pit schema for this test or possibly even improving the current schema.

So main topics that I am looking forward to getting feedback are:
1- Are the new helper functions fine here or should they be moved to shepherd?
2- Are the steps performed able to assure the features explored work as expected?
3- Since the test is quite big and only the second half of it requires interacting with S3, should we break this test into 2 or more tests?

This work performed as part of rancher/qa-tasks#2403, the other test will be available for review in a separate PR.

@hamistao
hamistao requested review from a team as code owners July 7, 2026 19:50
@hamistao
hamistao force-pushed the longhorn_encryption_test branch 3 times, most recently from 00c4fa3 to 3ced3f8 Compare July 8, 2026 20:25

@floatingman floatingman 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.

Just a few comments, but I think the one in secrets.go might cause a panic if not handled.

Comment thread actions/kubeapi/secrets/secrets.go Outdated
Comment thread actions/kubeapi/longhorn/longhorn.go Outdated
Comment thread actions/kubeapi/longhorn/longhorn.go Outdated
Comment thread actions/kubeapi/longhorn/longhorn.go
Comment thread actions/storage/s3/s3.go Outdated
Comment thread actions/storage/s3/s3.go Outdated

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 pull request adds a new Longhorn end-to-end test (TestVolumeEncryption) to validate encrypted volume behavior across on-node replica data and S3 backups, while also refactoring several secret/storage helpers and updating module dependencies to support the new functionality.

Changes:

  • Add TestVolumeEncryption to LonghornTestSuite, including S3 backup/restore validation.
  • Introduce/adjust helper actions for Longhorn resources, S3 access, storage/PVC workflows, and secret templates (switching many call sites to map[string]string / StringData).
  • Update go.mod / go.sum dependencies (root, actions/, and interoperability/) to newer versions required by added Longhorn/AWS functionality.

Reviewed changes

Copilot reviewed 38 out of 41 changed files in this pull request and generated 16 comments.

Show a summary per file
File Description
validation/upgrade/workload.go Switch secret helper import and update secret template to use StringData-style input.
validation/snapshot/rke2/snapshot_s3_restore_test.go Use new actions/storage/s3 helpers for bucket lifecycle.
validation/snapshot/k3s/snapshot_s3_restore_test.go Use new actions/storage/s3 helpers for bucket lifecycle.
validation/rbac/secrets/rbac_registry_secrets_test.go Update secret data setup to map[string]string for secret creation.
validation/rbac/secrets/rbac_opaque_secrets_test.go Update secret data setup to map[string]string and assertions for updated secret data.
validation/rbac/globalrolesv2/namespacedrules_test.go Update secret data setup to map[string]string.
validation/rbac/clusterandprojectroles/cluster_role_test.go Update secret data setup to map[string]string.
validation/rbac/certificates/certificate_rbac_test.go Update TLS secret data setup to map[string]string.
validation/rbac/aggregatedclusterroles/aggregated_cluster_roles_prtb_test.go Update secret data setup to map[string]string.
validation/rbac/aggregatedclusterroles/aggregated_cluster_roles_crtb_test.go Update secret data setup to map[string]string.
validation/rbac/aggregatedclusterroles/aggregated_cluster_roles_cleanup_test.go Update secret data setup to map[string]string.
validation/projects/project_scoped_secrets_test.go Update project-scoped secret helper signature and secret data to map[string]string.
validation/longhorn/longhorn_test.go Add TestVolumeEncryption and supporting imports/constants; adjust Longhorn config loading usage.
validation/longhorn/chartinstall/installation_test.go Improve workload pod selection and mounted-volume checks; reuse chart constants.
validation/charts/webhook.go Remove unused constant.
validation/charts/monitoring_test.go Switch secret helper import path to actions/kubeapi/secrets.
validation/charts/backup_restore/backup_restore.go Switch secret helper import path and use StringData-style secret template input.
validation/certificates/cert_test.go Update TLS secret creation data to map[string]string.
interoperability/longhorn/longhorn.go Change Longhorn test config loader to return a value instead of pointer.
interoperability/go.mod Bump dependency versions for interoperability module.
interoperability/go.sum Update dependency checksums for interoperability module.
go.mod Bump dependency versions; add replace for beszel; update k8s/prometheus/x/* versions.
actions/storage/verify.go Update node filesystem checks to poll via backoff; update mounted-volume checks to accept kubeconfig.
actions/storage/s3/s3.go Rename package to s3 and add helpers to locate/read backup objects.
actions/storage/pvc.go Refactor PVC creation to separate CreatePVC and add workload labeling for pod lookup.
actions/secrets/secrets.go Remove old secrets template helper (moved to actions/kubeapi/secrets).
actions/provisioning/verify.go Remove unused constants and simplify SSH command string formatting.
actions/provisioning/creates.go Switch secret helper import path and use map[string]string for secret template data.
actions/kubeapi/storageclasses/storageclasses.go Expand NewStorageClass constructor to set provisioner/parameters/expansion.
actions/kubeapi/secrets/template.go Move secret stevetype constant here and switch template to StringData.
actions/kubeapi/secrets/secrets.go Update SecretCopyWithNewData to accept map[string]string.
actions/kubeapi/secrets/create.go Update secret creation helpers to accept map[string]string.
actions/kubeapi/longhorn/longhorn.go Add Longhorn helper actions for volumes, backup targets, backups, restore, and deletion.
actions/go.mod Bump module dependencies for actions module (AWS SDK v2, Longhorn manager, etc.).
actions/go.sum Update dependency checksums for actions module.
actions/cloudprovider/verify.go Remove pod-status check and unused constants/import.
actions/cloudprovider/cloudprovider.go Switch Harvester credential secret data to map[string]string.
actions/charts/ranchermonitoring.go Adjust watch handling; update failure error formatting.
actions/charts/longhorn.go Add exported Longhorn storage class constants alongside namespace/chart name.
.github/scripts/check-gomod.sh Adjust messaging/quoting and fix an indentation/fi formatting issue.
Comments suppressed due to low confidence (1)

actions/storage/s3/s3.go:112

  • ReadS3Object ignores the error from GetObject and doesn't close the response body. This can cause panics on error and leak HTTP connections/file descriptors during test runs.

Comment thread validation/longhorn/longhorn_test.go
Comment thread validation/longhorn/longhorn_test.go
Comment thread validation/longhorn/longhorn_test.go
Comment thread validation/longhorn/longhorn_test.go
Comment thread validation/longhorn/longhorn_test.go
Comment thread actions/charts/ranchermonitoring.go
Comment thread actions/charts/ranchermonitoring.go
Comment thread actions/charts/ranchermonitoring.go
Comment thread actions/storage/verify.go
Comment thread actions/kubeapi/longhorn/longhorn.go
@hamistao
hamistao force-pushed the longhorn_encryption_test branch from 3ced3f8 to 12f6b33 Compare July 14, 2026 02:05
Comment thread actions/charts/ranchermonitoring.go Outdated
Comment thread validation/longhorn/longhorn_test.go Outdated
Comment thread actions/kubeapi/longhorn/longhorn.go Outdated
Comment thread actions/storage/pvc.go Outdated
@hamistao hamistao self-assigned this Jul 16, 2026
hamistao added 14 commits July 20, 2026 22:09
Signed-off-by: hamistao <pedro.ribeiro@suse.com>
Signed-off-by: hamistao <pedro.ribeiro@suse.com>
Signed-off-by: hamistao <pedro.ribeiro@suse.com>
Signed-off-by: hamistao <pedro.ribeiro@suse.com>
Signed-off-by: hamistao <pedro.ribeiro@suse.com>
Signed-off-by: hamistao <pedro.ribeiro@suse.com>
Signed-off-by: hamistao <pedro.ribeiro@suse.com>
Signed-off-by: hamistao <pedro.ribeiro@suse.com>
Signed-off-by: hamistao <pedro.ribeiro@suse.com>
Also moves the pre-existing functions to `actions/storage/s3`

Signed-off-by: hamistao <pedro.ribeiro@suse.com>
Signed-off-by: hamistao <pedro.ribeiro@suse.com>
Signed-off-by: hamistao <pedro.ribeiro@suse.com>
Signed-off-by: hamistao <pedro.ribeiro@suse.com>
Signed-off-by: hamistao <pedro.ribeiro@suse.com>
hamistao added 4 commits July 21, 2026 11:37
Signed-off-by: hamistao <pedro.ribeiro@suse.com>
CI tries to run these commands when they are between `

https://github.com/rancher/tests/actions/runs/28968388225/job/85957411738?pr=751
Signed-off-by: hamistao <pedro.ribeiro@suse.com>
Signed-off-by: hamistao <pedro.ribeiro@suse.com>
Signed-off-by: hamistao <pedro.ribeiro@suse.com>
@hamistao
hamistao force-pushed the longhorn_encryption_test branch from 12f6b33 to 71fb2da Compare July 21, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team/pit-crew slack notifier for pit crew

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants