Skip to content

Commit

Permalink
fixup! fix: Reconcile duplication
Browse files Browse the repository at this point in the history
change functions name

Signed-off-by: Mateus Oliveira <[email protected]>
  • Loading branch information
mateusoliveira43 committed Oct 10, 2024
1 parent 86e9fce commit faf11d2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions internal/common/function/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ import (
"github.com/migtools/oadp-non-admin/internal/common/constant"
)

// AddNonAdminLabels return the required Non Admin labels
func AddNonAdminLabels() map[string]string {
// GetNonAdminLabels return the required Non Admin labels
func GetNonAdminLabels() map[string]string {
return map[string]string{
constant.OadpLabel: constant.OadpLabelValue,
constant.ManagedByLabel: constant.ManagedByLabelValue,
}
}

// AddNonAdminBackupAnnotations return the required Non Admin annotations
func AddNonAdminBackupAnnotations(objectMeta metav1.ObjectMeta) map[string]string {
// GetNonAdminBackupAnnotations return the required Non Admin annotations
func GetNonAdminBackupAnnotations(objectMeta metav1.ObjectMeta) map[string]string {
return map[string]string{
constant.NabOriginNamespaceAnnotation: objectMeta.Namespace,
constant.NabOriginNameAnnotation: objectMeta.Name,
Expand Down
8 changes: 4 additions & 4 deletions internal/common/function/function_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@ const (
testNonAdminBackupUUID = "12345678-1234-1234-1234-123456789abc"
)

func TestAddNonAdminLabels(t *testing.T) {
func TestGetNonAdminLabels(t *testing.T) {
expected := map[string]string{
constant.OadpLabel: constant.OadpLabelValue,
constant.ManagedByLabel: constant.ManagedByLabelValue,
}

result := AddNonAdminLabels()
result := GetNonAdminLabels()
assert.Equal(t, expected, result)
}

func TestAddNonAdminBackupAnnotations(t *testing.T) {
func TestGetNonAdminBackupAnnotations(t *testing.T) {
nonAdminBackup := &nacv1alpha1.NonAdminBackup{
ObjectMeta: metav1.ObjectMeta{
Namespace: testNonAdminBackupNamespace,
Expand All @@ -65,7 +65,7 @@ func TestAddNonAdminBackupAnnotations(t *testing.T) {
constant.NabOriginUUIDAnnotation: testNonAdminBackupUUID,
}

result := AddNonAdminBackupAnnotations(nonAdminBackup.ObjectMeta)
result := GetNonAdminBackupAnnotations(nonAdminBackup.ObjectMeta)
assert.Equal(t, expected, result)
}

Expand Down
4 changes: 2 additions & 2 deletions internal/controller/nonadminbackup_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ func (r *NonAdminBackupReconciler) syncVeleroBackupWithNonAdminBackup(ctx contex
ObjectMeta: metav1.ObjectMeta{
Name: veleroBackupName,
Namespace: r.OADPNamespace,
Labels: function.AddNonAdminLabels(),
Annotations: function.AddNonAdminBackupAnnotations(nab.ObjectMeta),
Labels: function.GetNonAdminLabels(),
Annotations: function.GetNonAdminBackupAnnotations(nab.ObjectMeta),
},
Spec: *backupSpec,
}
Expand Down
4 changes: 2 additions & 2 deletions internal/controller/nonadminbackup_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ var _ = ginkgo.Describe("Test single reconciles of NonAdminBackup Reconcile func
ObjectMeta: metav1.ObjectMeta{
Name: function.GenerateVeleroBackupName(nonAdminNamespaceName, testNonAdminBackupName),
Namespace: oadpNamespaceName,
Labels: function.AddNonAdminLabels(),
Annotations: function.AddNonAdminBackupAnnotations(nonAdminBackup.ObjectMeta),
Labels: function.GetNonAdminLabels(),
Annotations: function.GetNonAdminBackupAnnotations(nonAdminBackup.ObjectMeta),
},
Spec: velerov1.BackupSpec{
IncludedNamespaces: []string{nonAdminNamespaceName},
Expand Down

0 comments on commit faf11d2

Please sign in to comment.