Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fixing errors where relationship cannot be set when updating quotas #508

Merged
merged 2 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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