From b9e606e9bfa903fcc15bd8eb41494b29781d6bd7 Mon Sep 17 00:00:00 2001 From: Colin Simmons <5785492+crsimmons@users.noreply.github.com> Date: Mon, 17 May 2021 16:27:35 +0100 Subject: [PATCH] Allow for configuration of quotas in terabytes 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. --- command/flag/megabytes.go | 2 +- command/flag/megabytes_test.go | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/command/flag/megabytes.go b/command/flag/megabytes.go index fba36da4951..edb780c9b7d 100644 --- a/command/flag/megabytes.go +++ b/command/flag/megabytes.go @@ -10,7 +10,7 @@ import ( ) const ( - AllowedUnits = "mg" + AllowedUnits = "mgt" ) type Megabytes struct { diff --git a/command/flag/megabytes_test.go b/command/flag/megabytes_test.go index c790976923e..385efc921f4 100644 --- a/command/flag/megabytes_test.go +++ b/command/flag/megabytes_test.go @@ -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")