diff --git a/cmd/broker/binding_test.go b/cmd/broker/binding_test.go index fa02062aa2..4af6235165 100644 --- a/cmd/broker/binding_test.go +++ b/cmd/broker/binding_test.go @@ -191,9 +191,9 @@ func TestDeprovisioningWithExistingBindings(t *testing.T) { response = suite.CallAPI(http.MethodDelete, fmt.Sprintf("oauth/v2/service_instances/%s/service_bindings/%s?plan_id=361c511f-f939-4621-b228-d0fb79a1fe15&service_id=47c9dcbf-ff30-448e-ab36-d3bad66ba281", iid, bindingID2), "") assert.Equal(t, http.StatusGone, response.StatusCode) - // then expect bindings to be removed - suite.AssertBindingRemoval(iid, bindingID1) - suite.AssertBindingRemoval(iid, bindingID2) + // then expect bindings to exist in database + suite.AssertBindingExists(iid, bindingID1) + suite.AssertBindingExists(iid, bindingID2) } func TestRemoveBindingsFromSuspended(t *testing.T) { diff --git a/cmd/broker/broker_suite_test.go b/cmd/broker/broker_suite_test.go index 3851055213..a025028a40 100644 --- a/cmd/broker/broker_suite_test.go +++ b/cmd/broker/broker_suite_test.go @@ -446,6 +446,12 @@ func (s *BrokerSuiteTest) AssertBindingRemoval(iid string, bindingID string) { assert.True(s.t, dberr.IsNotFound(err), "bindings should be removed") } +func (s *BrokerSuiteTest) AssertBindingExists(iid string, bindingID string) { + binding, err := s.db.Bindings().Get(iid, bindingID) + assert.NoError(s.t, err) + assert.NotNil(s.t, binding) +} + func (s *BrokerSuiteTest) LastOperation(iid string) *internal.Operation { op, _ := s.db.Operations().GetLastOperation(iid) return op diff --git a/internal/broker/bind_delete.go b/internal/broker/bind_delete.go index a795fd4762..3acd75434e 100644 --- a/internal/broker/bind_delete.go +++ b/internal/broker/bind_delete.go @@ -37,10 +37,6 @@ func (b *UnbindEndpoint) Unbind(ctx context.Context, instanceID, bindingID strin instance, err := b.instancesStorage.GetByID(instanceID) switch { case dberr.IsNotFound(err): - if err != nil { - b.log.Errorf("Unbind error during removal of db entity: %v", err) - return domain.UnbindSpec{}, apiresponses.NewFailureResponse(fmt.Errorf("failed to delete binding for binding %s and not existing instance %s: %v", bindingID, instanceID, err), http.StatusInternalServerError, fmt.Sprintf("failed to delete resources for binding %s and not existing instance %s: %v", bindingID, instanceID, err)) - } return domain.UnbindSpec{}, apiresponses.ErrInstanceDoesNotExist case err != nil: return domain.UnbindSpec{}, apiresponses.NewFailureResponse(fmt.Errorf("failed to get instance %s", instanceID), http.StatusInternalServerError, fmt.Sprintf("failed to get instance %s", instanceID))