diff --git a/command/v7/org_quota_command_test.go b/command/v7/org_quota_command_test.go index 187fcda8d56..18d29c157c0 100644 --- a/command/v7/org_quota_command_test.go +++ b/command/v7/org_quota_command_test.go @@ -105,6 +105,7 @@ var _ = Describe("Org Quota Command", func() { TotalMemory: &types.NullInt{IsSet: true, Value: 2048}, InstanceMemory: &types.NullInt{IsSet: true, Value: 1024}, TotalAppInstances: &types.NullInt{IsSet: true, Value: 2}, + TotalLogVolume: &types.NullInt{IsSet: true, Value: 512}, }, Services: resources.ServiceLimit{ TotalServiceInstances: &types.NullInt{IsSet: false}, @@ -138,6 +139,7 @@ var _ = Describe("Org Quota Command", func() { Expect(testUI.Out).To(Say(`paid service plans:\s+disallowed`)) Expect(testUI.Out).To(Say(`app instances:\s+2`)) Expect(testUI.Out).To(Say(`route ports:\s+unlimited`)) + Expect(testUI.Out).To(Say(`log volume per second:\s+512B`)) }) }) }) diff --git a/command/v7/shared/quota_displayer.go b/command/v7/shared/quota_displayer.go index d209223b18c..0a74e976f35 100644 --- a/command/v7/shared/quota_displayer.go +++ b/command/v7/shared/quota_displayer.go @@ -12,7 +12,8 @@ import ( ) const ( - MEGABYTE = 1024 * 1024 + KILOBYTE = 1024 + MEGABYTE = 1024 * KILOBYTE GIGABYTE = 1024 * MEGABYTE TERABYTE = 1024 * GIGABYTE ) @@ -60,6 +61,7 @@ func (displayer QuotaDisplayer) DisplaySingleQuota(quota resources.Quota) { {displayer.ui.TranslateText("paid service plans:"), displayer.presentBooleanValue(*quota.Services.PaidServicePlans)}, {displayer.ui.TranslateText("app instances:"), displayer.presentQuotaValue(*quota.Apps.TotalAppInstances)}, {displayer.ui.TranslateText("route ports:"), displayer.presentQuotaValue(*quota.Routes.TotalReservedPorts)}, + {displayer.ui.TranslateText("log volume per second:"), displayer.presentQuotaBytesValue(*quota.Apps.TotalLogVolume)}, } displayer.ui.DisplayKeyValueTable("", quotaTable, 3) @@ -81,6 +83,14 @@ func (displayer QuotaDisplayer) presentQuotaValue(limit types.NullInt) string { } } +func (displayer QuotaDisplayer) presentQuotaBytesValue(limit types.NullInt) string { + if !limit.IsSet { + return "unlimited" + } else { + return addMemoryUnits(float64(limit.Value)) + } +} + func (displayer QuotaDisplayer) presentQuotaMemoryValue(limit types.NullInt) string { if !limit.IsSet { return "unlimited" @@ -103,6 +113,11 @@ func addMemoryUnits(bytes float64) string { case bytes >= MEGABYTE: unit = "M" value /= MEGABYTE + case bytes >= KILOBYTE: + unit = "K" + value /= KILOBYTE + case bytes >= 1: + unit = "B" case bytes == 0: return "0" } diff --git a/command/v7/space_quota_command_test.go b/command/v7/space_quota_command_test.go index ce15a9c9fc4..20952d63888 100644 --- a/command/v7/space_quota_command_test.go +++ b/command/v7/space_quota_command_test.go @@ -102,6 +102,7 @@ var _ = Describe("Space Quota Command", func() { TotalMemory: &types.NullInt{IsSet: true, Value: 2048}, InstanceMemory: &types.NullInt{IsSet: true, Value: 1024}, TotalAppInstances: &types.NullInt{IsSet: true, Value: 2}, + TotalLogVolume: &types.NullInt{IsSet: true, Value: 512}, }, Services: resources.ServiceLimit{ TotalServiceInstances: &types.NullInt{IsSet: false}, @@ -135,6 +136,7 @@ var _ = Describe("Space Quota Command", func() { Expect(testUI.Out).To(Say(`paid service plans:\s+disallowed`)) Expect(testUI.Out).To(Say(`app instances:\s+2`)) Expect(testUI.Out).To(Say(`route ports:\s+unlimited`)) + Expect(testUI.Out).To(Say(`log volume per second:\s+512B`)) }) }) }) diff --git a/integration/v7/global/org_quota_command_test.go b/integration/v7/global/org_quota_command_test.go index 7161c979982..ccd33cde2ba 100644 --- a/integration/v7/global/org_quota_command_test.go +++ b/integration/v7/global/org_quota_command_test.go @@ -70,6 +70,7 @@ var _ = Describe("org-quota command", func() { Eventually(session).Should(Say(`paid service plans:\s+allowed`)) Eventually(session).Should(Say(`app instances:\s+unlimited`)) Eventually(session).Should(Say(`route ports:\s+100`)) + Eventually(session).Should(Say(`log volume per second:\s+unlimited`)) Eventually(session).Should(Exit(0)) }) diff --git a/integration/v7/isolated/space_quota_command_test.go b/integration/v7/isolated/space_quota_command_test.go index 34798df7ef7..d30a0fa7aee 100644 --- a/integration/v7/isolated/space_quota_command_test.go +++ b/integration/v7/isolated/space_quota_command_test.go @@ -85,6 +85,7 @@ var _ = Describe("space-quota command", func() { Eventually(session).Should(Say(`paid service plans:\s+allowed`)) Eventually(session).Should(Say(`app instances:\s+unlimited`)) Eventually(session).Should(Say(`route ports:\s+0`)) + Eventually(session).Should(Say(`log volume per second:\s+unlimited`)) Eventually(session).Should(Exit(0)) })