From faf11d20d2e285d9b6b7081b3530d7757afb3092 Mon Sep 17 00:00:00 2001 From: Mateus Oliveira Date: Thu, 10 Oct 2024 08:58:44 -0300 Subject: [PATCH] fixup! fix: Reconcile duplication change functions name Signed-off-by: Mateus Oliveira --- internal/common/function/function.go | 8 ++++---- internal/common/function/function_test.go | 8 ++++---- internal/controller/nonadminbackup_controller.go | 4 ++-- internal/controller/nonadminbackup_controller_test.go | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/common/function/function.go b/internal/common/function/function.go index 663e1a6..66a34c9 100644 --- a/internal/common/function/function.go +++ b/internal/common/function/function.go @@ -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, diff --git a/internal/common/function/function_test.go b/internal/common/function/function_test.go index dd08417..034b963 100644 --- a/internal/common/function/function_test.go +++ b/internal/common/function/function_test.go @@ -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, @@ -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) } diff --git a/internal/controller/nonadminbackup_controller.go b/internal/controller/nonadminbackup_controller.go index da674ba..e1ca726 100644 --- a/internal/controller/nonadminbackup_controller.go +++ b/internal/controller/nonadminbackup_controller.go @@ -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, } diff --git a/internal/controller/nonadminbackup_controller_test.go b/internal/controller/nonadminbackup_controller_test.go index 954bbd0..d72ece9 100644 --- a/internal/controller/nonadminbackup_controller_test.go +++ b/internal/controller/nonadminbackup_controller_test.go @@ -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},