Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.

Commit 7516746

Browse files
authored
Merge pull request #236 from Peripli/visibility
continue to disable even if enable fail
2 parents 9bd885f + c9b5975 commit 7516746

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

pkg/sbproxy/notifications/handlers/visibilities_handler.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,10 @@ func (vnh *VisibilityResourceNotificationsHandler) OnUpdate(ctx context.Context,
179179

180180
if err := vnh.enableServiceAccess(ctx, labelsToAdd, newVisibilityPayload, platformBrokerName); err != nil {
181181
logger.Error(err)
182-
return
183182
}
184183

185184
if err := vnh.disableServiceAccess(ctx, labelsToRemove, newVisibilityPayload, platformBrokerName); err != nil {
186185
logger.Error(err)
187-
return
188186
}
189187
}
190188

pkg/sbproxy/notifications/handlers/visibility_handler_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,18 @@ var _ = Describe("Visibility Handler", func() {
493493
})
494494
})
495495
})
496+
Context("when an error occurs while enabling access it should continue to disable", func() {
497+
BeforeEach(func() {
498+
fakeVisibilityClient.EnableAccessForPlanReturns(fmt.Errorf("error"))
499+
})
496500

501+
It("logs an error", func() {
502+
VerifyErrorLogged(func() {
503+
visibilityHandler.OnUpdate(ctx, &types.Notification{Payload: json.RawMessage(visibilityNotificationPayload)})
504+
Expect(fakeVisibilityClient.DisableAccessForPlanCallCount()).To(Equal(1))
505+
})
506+
})
507+
})
497508
Context("when an error occurs while disabling access", func() {
498509
BeforeEach(func() {
499510
fakeVisibilityClient.EnableAccessForPlanReturns(nil)

0 commit comments

Comments
 (0)