-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
backup:add unit test for backup controller #406
Conversation
✅ Deploy Preview for kurator-dev canceled.
|
94e0e86
to
822bb94
Compare
Signed-off-by: Xieql <[email protected]>
backupapi "kurator.dev/kurator/pkg/apis/backups/v1alpha1" | ||
) | ||
|
||
const backupTestDataPath = "backup-testdata/backup/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: ./testdata/backup/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok. actually, the path may changes when we add a backup dir and put all related file in it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix in #407
const backupTestDataPath = "backup-testdata/backup/" | ||
|
||
// buildVeleroBackupInstanceForTest is a helper function for testing for buildVeleroBackupInstance, which constructs a Velero Backup instance with a specified TypeMeta. | ||
func buildVeleroBackupInstanceForTest(backupSpec *backupapi.BackupSpec, labels map[string]string, veleroBackupName string, typeMeta *metav1.TypeMeta) *velerov1.Backup { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change typeMeta
to value type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok,fix in #407
if tt.wantFinalizer { | ||
assert.Contains(t, tt.backup.Finalizers, BackupFinalizer) | ||
} else { | ||
assert.NotContains(t, tt.backup.Finalizers, BackupFinalizer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you have any case for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hzxuzhonghu The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
backup:add unit test for backup controller
part of #404
kurator.dev/kurator/pkg/fleet-manager/backup_controller.go:42: SetupWithManager 0.0%
kurator.dev/kurator/pkg/fleet-manager/backup_controller.go:49: Reconcile 83.3%
kurator.dev/kurator/pkg/fleet-manager/backup_controller.go:91: reconcileBackup 66.7%
kurator.dev/kurator/pkg/fleet-manager/backup_controller.go:110: reconcileBackupResources 50.0%
kurator.dev/kurator/pkg/fleet-manager/backup_controller.go:151: reconcileBackupStatus 57.1%
kurator.dev/kurator/pkg/fleet-manager/backup_controller.go:167: reconcileOneTimeBackupStatus 25.0%
kurator.dev/kurator/pkg/fleet-manager/backup_controller.go:210: reconcileScheduleBackupStatus 0.0%
kurator.dev/kurator/pkg/fleet-manager/backup_controller.go:273: reconcileDeleteBackup 82.4%
kurator.dev/kurator/pkg/fleet-manager/backup_restore_migrate_shared.go:62: fetchDestinationClusters 38.1%
kurator.dev/kurator/pkg/fleet-manager/backup_restore_migrate_shared.go:103: buildVeleroBackupInstance 100.0%
kurator.dev/kurator/pkg/fleet-manager/backup_restore_migrate_shared.go:112: buildVeleroScheduleInstance 100.0%
kurator.dev/kurator/pkg/fleet-manager/backup_restore_migrate_shared.go:123: buildVeleroBackupSpec 66.7%
kurator.dev/kurator/pkg/fleet-manager/backup_restore_migrate_shared.go:144: newSyncVeleroTaskFunc 0.0%
kurator.dev/kurator/pkg/fleet-manager/backup_restore_migrate_shared.go:150: syncVeleroObj 0.0%
kurator.dev/kurator/pkg/fleet-manager/backup_restore_migrate_shared.go:165: allBackupsCompleted 100.0%
kurator.dev/kurator/pkg/fleet-manager/backup_restore_migrate_shared.go:185: deleteResourcesInClusters 17.6%
kurator.dev/kurator/pkg/fleet-manager/backup_restore_migrate_shared.go:220: isScheduleBackup 100.0%
kurator.dev/kurator/pkg/fleet-manager/backup_restore_migrate_shared.go:224: generateVeleroInstanceLabel 100.0%
kurator.dev/kurator/pkg/fleet-manager/backup_restore_migrate_shared.go:232: generateVeleroResourceObjectMeta 100.0%
kurator.dev/kurator/pkg/fleet-manager/backup_restore_migrate_shared.go:241: generateVeleroResourceName 100.0%
kurator.dev/kurator/pkg/fleet-manager/backup_restore_migrate_shared.go:247: MostRecentCompletedBackup 100.0%
kurator.dev/kurator/pkg/fleet-manager/backup_restore_migrate_shared.go:269: GetCronInterval 100.0%
kurator.dev/kurator/pkg/fleet-manager/backup_restore_migrate_shared.go:290: getResourceFromClusterClient 0.0%
kurator.dev/kurator/pkg/fleet-manager/backup_restore_migrate_shared.go:301: listResourcesFromClusterClient 0.0%
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: