Skip to content

Commit

Permalink
Merge pull request #236 from Peripli/visibility
Browse files Browse the repository at this point in the history
continue to disable even if enable fail
  • Loading branch information
sigalmaya authored Mar 23, 2022
2 parents 9bd885f + c9b5975 commit 7516746
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 0 additions & 2 deletions pkg/sbproxy/notifications/handlers/visibilities_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,10 @@ func (vnh *VisibilityResourceNotificationsHandler) OnUpdate(ctx context.Context,

if err := vnh.enableServiceAccess(ctx, labelsToAdd, newVisibilityPayload, platformBrokerName); err != nil {
logger.Error(err)
return
}

if err := vnh.disableServiceAccess(ctx, labelsToRemove, newVisibilityPayload, platformBrokerName); err != nil {
logger.Error(err)
return
}
}

Expand Down
11 changes: 11 additions & 0 deletions pkg/sbproxy/notifications/handlers/visibility_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,18 @@ var _ = Describe("Visibility Handler", func() {
})
})
})
Context("when an error occurs while enabling access it should continue to disable", func() {
BeforeEach(func() {
fakeVisibilityClient.EnableAccessForPlanReturns(fmt.Errorf("error"))
})

It("logs an error", func() {
VerifyErrorLogged(func() {
visibilityHandler.OnUpdate(ctx, &types.Notification{Payload: json.RawMessage(visibilityNotificationPayload)})
Expect(fakeVisibilityClient.DisableAccessForPlanCallCount()).To(Equal(1))
})
})
})
Context("when an error occurs while disabling access", func() {
BeforeEach(func() {
fakeVisibilityClient.EnableAccessForPlanReturns(nil)
Expand Down

0 comments on commit 7516746

Please sign in to comment.