Skip to content

Commit

Permalink
fixing errors where relationship cannot be set when updating quotas (#…
Browse files Browse the repository at this point in the history
…508)

* fixing errors where relationship cannot be set when updating quotas

* fix unit test for quota
  • Loading branch information
Caleb Washburn authored Feb 13, 2024
1 parent 2946a1b commit 593f330
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ publish-develop.sh
make-binary.sh
.idea
test-for-pagination.sh
export-cli.sh
6 changes: 4 additions & 2 deletions quota/quota.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ import (
"context"
"encoding/json"
"fmt"
"reflect"
"strings"

"github.com/cloudfoundry-community/go-cfclient/v3/client"
"github.com/cloudfoundry-community/go-cfclient/v3/resource"
"github.com/pkg/errors"
"github.com/vmwarepivotallabs/cf-mgmt/config"
"github.com/vmwarepivotallabs/cf-mgmt/organizationreader"
"github.com/vmwarepivotallabs/cf-mgmt/space"
"github.com/xchapter7x/lo"
"reflect"
"strings"
)

// NewManager -
Expand Down Expand Up @@ -274,6 +275,7 @@ func (m *Manager) UpdateSpaceQuota(quotaGUID string, quota *resource.SpaceQuotaC
return nil
}
lo.G.Infof("Updating space quota %s", *quota.Name)
quota.Relationships = nil
_, err := m.SpaceQuoteClient.Update(context.Background(), quotaGUID, quota)
return err
}
Expand Down
2 changes: 1 addition & 1 deletion quota/quota_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ var _ = Describe("given QuotaManager", func() {
_, quotaGUID, quotaRequest := fakeSpaceQuotaClient.UpdateArgsForCall(0)
Expect(quotaGUID).Should(Equal("space-quota-guid"))
Expect(*quotaRequest.Name).Should(Equal("space1"))
Expect(quotaRequest.Relationships).ShouldNot(BeNil())
Expect(quotaRequest.Relationships).Should(BeNil())
Expect(fakeSpaceQuotaClient.ApplyCallCount()).Should(Equal(1))
_, quotaGUID, spaceGUIDs := fakeSpaceQuotaClient.ApplyArgsForCall(0)
Expect(quotaGUID).Should(Equal("space-quota-guid"))
Expand Down

0 comments on commit 593f330

Please # to comment.