From e38f5822cbefb05bfe00e200e90f68ca47f2592a Mon Sep 17 00:00:00 2001 From: Ekaterina Kazakova Date: Tue, 26 Nov 2024 15:18:44 +0400 Subject: [PATCH] Rename SetStatusConditions to GetStatusConditions as discussed in https://github.com/Mirantis/hmc/pull/673#discussion_r1858055811 --- internal/controller/multiclusterservice_controller.go | 2 +- internal/sveltos/status.go | 4 ++-- internal/sveltos/status_test.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/controller/multiclusterservice_controller.go b/internal/controller/multiclusterservice_controller.go index 20b1dd69..d2bd10fd 100644 --- a/internal/controller/multiclusterservice_controller.go +++ b/internal/controller/multiclusterservice_controller.go @@ -239,7 +239,7 @@ func updateServicesStatus(ctx context.Context, c client.Client, profileRef clien idx = len(servicesStatus) - 1 } - conditions, err := sveltos.SetStatusConditions(&summary) + conditions, err := sveltos.GetStatusConditions(&summary) if err != nil { return nil, err } diff --git a/internal/sveltos/status.go b/internal/sveltos/status.go index 25e9b294..61bddfe3 100644 --- a/internal/sveltos/status.go +++ b/internal/sveltos/status.go @@ -25,8 +25,8 @@ import ( hmc "github.com/Mirantis/hmc/api/v1alpha1" ) -// SetStatusConditions creates & sets a list of conditions from provided ClusterSummary and returns it. -func SetStatusConditions(summary *sveltosv1beta1.ClusterSummary) ([]metav1.Condition, error) { +// GetStatusConditions returns a list of conditions from provided ClusterSummary. +func GetStatusConditions(summary *sveltosv1beta1.ClusterSummary) ([]metav1.Condition, error) { if summary == nil { return nil, errors.New("error getting status from ClusterSummary: nil summary provided") } diff --git a/internal/sveltos/status_test.go b/internal/sveltos/status_test.go index f0ebb107..2fb21c35 100644 --- a/internal/sveltos/status_test.go +++ b/internal/sveltos/status_test.go @@ -134,7 +134,7 @@ func TestSetStatusConditions(t *testing.T) { }, } { t.Run(tc.name, func(t *testing.T) { - conditions, err := SetStatusConditions(&tc.summary) + conditions, err := GetStatusConditions(&tc.summary) require.NoError(t, err) assert.Len(t, conditions, 1) assert.Equal(t, tc.expectCondition.Type, conditions[0].Type)