From cc6a9bd6e61e9b3a200535baf5812479e753fe99 Mon Sep 17 00:00:00 2001 From: Prateek Gogia Date: Wed, 18 Nov 2020 00:06:20 -0600 Subject: [PATCH] Add error checks for SetReplicas call --- pkg/cloudprovider/fake/errors.go | 3 --- pkg/controllers/scalablenodegroup/v1alpha1/suite_test.go | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/pkg/cloudprovider/fake/errors.go b/pkg/cloudprovider/fake/errors.go index f5e829c6144b..d88a91e537af 100644 --- a/pkg/cloudprovider/fake/errors.go +++ b/pkg/cloudprovider/fake/errors.go @@ -14,8 +14,6 @@ limitations under the License. package fake -import "fmt" - // fakeError implements controllers.RetryableError & controllers.CodedError type fakeError struct { error @@ -26,7 +24,6 @@ func (e *fakeError) IsRetryable() bool { return e.retryAble } func (e *fakeError) ErrorCode() string { - fmt.Println("Returning error code ", e.Error()) return e.Error() } diff --git a/pkg/controllers/scalablenodegroup/v1alpha1/suite_test.go b/pkg/controllers/scalablenodegroup/v1alpha1/suite_test.go index 25d03a611ccf..7f9efee182f3 100644 --- a/pkg/controllers/scalablenodegroup/v1alpha1/suite_test.go +++ b/pkg/controllers/scalablenodegroup/v1alpha1/suite_test.go @@ -85,13 +85,13 @@ var _ = Describe("Examples", func() { }) It("Test reconciler to scale down nodes", func() { - ng.SetReplicas(10) // set existing replicas higher than desired + Expect(ng.SetReplicas(10)).To(Succeed()) // set existing replicas higher than desired Expect(fakeController.Reconcile(sng)).To(Succeed()) Expect(ng.GetReplicas()).To(Equal(*desiredReplicas)) }) It("Test reconciler to make no change to node count", func() { - ng.SetReplicas(*desiredReplicas) // set existing replicas equal to desired + Expect(ng.SetReplicas(*desiredReplicas)).To(Succeed()) // set existing replicas equal to desired Expect(fakeController.Reconcile(sng)).To(Succeed()) Expect(ng.GetReplicas()).To(Equal(*desiredReplicas)) })