Skip to content

Commit

Permalink
Allow for configuration of quotas in terabytes
Browse files Browse the repository at this point in the history
At some point between cf6 and cf7 this stopped working. Configuring
memory quotas in TB is especially useful for configuring org quotas in
large foundations.
  • Loading branch information
crsimmons authored and a-b committed Jun 9, 2021
1 parent 8671a5b commit b9e606e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion command/flag/megabytes.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

const (
AllowedUnits = "mg"
AllowedUnits = "mgt"
)

type Megabytes struct {
Expand Down
16 changes: 16 additions & 0 deletions command/flag/megabytes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,22 @@ var _ = Describe("Megabytes", func() {
})
})

When("the suffix is T", func() {
It("interprets the number as terabytes", func() {
err := megabytes.UnmarshalFlag("2T")
Expect(err).ToNot(HaveOccurred())
Expect(megabytes.Value).To(BeEquivalentTo(2097152))
})
})

When("the suffix is TB", func() {
It("interprets the number as terabytes", func() {
err := megabytes.UnmarshalFlag("3TB")
Expect(err).ToNot(HaveOccurred())
Expect(megabytes.Value).To(BeEquivalentTo(3145728))
})
})

When("the suffix is lowercase", func() {
It("is case insensitive", func() {
err := megabytes.UnmarshalFlag("7m")
Expand Down

0 comments on commit b9e606e

Please sign in to comment.