mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-09-04 15:16:58 +00:00
Remove finalizers from backups before syncing
Signed-off-by: Nolan Brubaker <nolan@heptio.com>
This commit is contained in:
@@ -27,6 +27,7 @@ import (
|
||||
|
||||
"github.com/heptio/ark/pkg/apis/ark/v1"
|
||||
"github.com/heptio/ark/pkg/generated/clientset/versioned/fake"
|
||||
"github.com/heptio/ark/pkg/util/stringslice"
|
||||
arktest "github.com/heptio/ark/pkg/util/test"
|
||||
)
|
||||
|
||||
@@ -51,6 +52,18 @@ func TestBackupSyncControllerRun(t *testing.T) {
|
||||
arktest.NewTestBackup().WithNamespace("ns-2").WithName("backup-3").Backup,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Finalizer gets removed on sync",
|
||||
cloudBackups: []*v1.Backup{
|
||||
arktest.NewTestBackup().WithNamespace("ns-1").WithFinalizers(gcFinalizer).Backup,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Only target finalizer is removed",
|
||||
cloudBackups: []*v1.Backup{
|
||||
arktest.NewTestBackup().WithNamespace("ns-1").WithFinalizers(gcFinalizer, "blah").Backup,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
@@ -77,6 +90,8 @@ func TestBackupSyncControllerRun(t *testing.T) {
|
||||
|
||||
// we only expect creates for items within the target bucket
|
||||
for _, cloudBackup := range test.cloudBackups {
|
||||
// Verify that the run function stripped the GC finalizer
|
||||
assert.False(t, stringslice.Has(cloudBackup.Finalizers, gcFinalizer))
|
||||
action := core.NewCreateAction(
|
||||
v1.SchemeGroupVersion.WithResource("backups"),
|
||||
cloudBackup.Namespace,
|
||||
|
||||
Reference in New Issue
Block a user