vmware-tanzu / velero

Backup and migrate Kubernetes applications and their persistent volumes
https://velero.io
Apache License 2.0
8.79k stars 1.41k forks source link

E2E test cases labelled with PVBackup don't clean the created namespace. #8298

Closed blackpiglet closed 1 month ago

blackpiglet commented 1 month ago

What steps did you take and what happened:

time="2024-10-14T08:22:18Z" level=info msg="Retrieved 2 items" backup=velero/backup-pv-filter-08898514opt-out group=v1 logSource="pkg/backup/item_collector.go:558" namespace=pv-filter-08898514-opt-out-1 resource=pods

From the log, the backup's name is backup-pv-filter-08898514opt-out, and the created namespace name is pv-filter-08898514-opt-out-1. The E2E test assumes the namespaces that start with the backup's name are created by the backup, then they are deleted after the backup completes. This E2E test case doesn't follow that rule.

Those cases create namespaces by those lines. https://github.com/vmware-tanzu/velero/blob/f02613d2f7a7cfbf687f84d1deac7414d679569e/test/e2e/pv-backup/pv-backup-filter.go#L38-L40

Those namespaces are not deleted by default test case Destroy method. https://github.com/vmware-tanzu/velero/blob/f02613d2f7a7cfbf687f84d1deac7414d679569e/test/e2e/test/test.go#L128-L133

And those cases don't have their own specific Destroy method.

What did you expect to happen: Those namespaces should be deleted after test cases completed.

The following information will help us better understand what's going on:

The name mismatch between the backup and the created namespace happens here. https://github.com/vmware-tanzu/velero/blob/f02613d2f7a7cfbf687f84d1deac7414d679569e/test/e2e/pv-backup/pv-backup-filter.go#L33-L40 Align them should fix this issue.

If you are using velero v1.7.0+:
Please use velero debug --backup <backupname> --restore <restorename> to generate the support bundle, and attach to this issue, more options please refer to velero debug --help

If you are using earlier versions:
Please provide the output of the following commands (Pasting long output into a GitHub gist or other pastebin is fine.)

Anything else you would like to add:

Environment:

Vote on this issue!

This is an invitation to the Velero community to vote on issues, you can see the project's top voted issues listed here.
Use the "reaction smiley face" up to the right of this comment to vote.