diff --git a/api/cloudcontroller/ccv3/process_instance.go b/api/cloudcontroller/ccv3/process_instance.go index 17bb5277941..12d37f63389 100644 --- a/api/cloudcontroller/ccv3/process_instance.go +++ b/api/cloudcontroller/ccv3/process_instance.go @@ -40,6 +40,8 @@ type ProcessInstance struct { LogRate uint64 // State is the state of the instance. State constant.ProcessInstanceState + // Routeable is the readiness state of the instance, can be true, false or null. + Routable *bool // Type is the process type for the instance. Type string // Uptime is the duration that the instance has been running. @@ -56,6 +58,7 @@ func (instance *ProcessInstance) UnmarshalJSON(data []byte) error { MemQuota uint64 `json:"mem_quota"` LogRateLimit int64 `json:"log_rate_limit"` State string `json:"state"` + Routable *bool `json:"routable"` Type string `json:"type"` Uptime int64 `json:"uptime"` Usage struct { @@ -84,6 +87,7 @@ func (instance *ProcessInstance) UnmarshalJSON(data []byte) error { instance.LogRateLimit = inputInstance.LogRateLimit instance.LogRate = inputInstance.Usage.LogRate instance.State = constant.ProcessInstanceState(inputInstance.State) + instance.Routable = inputInstance.Routable instance.Type = inputInstance.Type instance.Uptime, err = time.ParseDuration(fmt.Sprintf("%ds", inputInstance.Uptime)) if err != nil { diff --git a/command/v7/shared/app_summary_displayer.go b/command/v7/shared/app_summary_displayer.go index 60a587f7252..55a9a182175 100644 --- a/command/v7/shared/app_summary_displayer.go +++ b/command/v7/shared/app_summary_displayer.go @@ -80,12 +80,21 @@ func formatCPUEntitlement(cpuEntitlement types.NullFloat64) string { return fmt.Sprintf("%.1f%%", cpuEntitlement.Value*100) } +func formatRoutable(b *bool) string { + if b == nil { + return "-" + } + + return fmt.Sprintf("%t", *b) +} + func (display AppSummaryDisplayer) displayAppInstancesTable(processSummary v7action.ProcessSummary) { table := [][]string{ { "", display.UI.TranslateText("state"), display.UI.TranslateText("since"), + display.UI.TranslateText("ready"), display.UI.TranslateText("cpu"), display.UI.TranslateText("memory"), display.UI.TranslateText("disk"), @@ -100,6 +109,7 @@ func (display AppSummaryDisplayer) displayAppInstancesTable(processSummary v7act fmt.Sprintf("#%d", instance.Index), display.UI.TranslateText(strings.ToLower(string(instance.State))), display.appInstanceDate(instance.StartTime()), + formatRoutable(instance.Routable), fmt.Sprintf("%.1f%%", instance.CPU*100), display.UI.TranslateText("{{.MemUsage}} of {{.MemQuota}}", map[string]interface{}{ "MemUsage": bytefmt.ByteSize(instance.MemoryUsage), diff --git a/command/v7/shared/app_summary_displayer_test.go b/command/v7/shared/app_summary_displayer_test.go index 18fd016a264..5eedd5f45b2 100644 --- a/command/v7/shared/app_summary_displayer_test.go +++ b/command/v7/shared/app_summary_displayer_test.go @@ -17,7 +17,7 @@ import ( var _ = Describe("app summary displayer", func() { - const instanceStatsTitles = `state\s+since\s+cpu\s+memory\s+disk\s+logging\s+cpu entitlement\s+details` + const instanceStatsTitles = `state\s+since\s+ready\s+cpu\s+memory\s+disk\s+logging\s+cpu entitlement\s+details` var ( appSummaryDisplayer *AppSummaryDisplayer @@ -48,6 +48,10 @@ var _ = Describe("app summary displayer", func() { BeforeEach(func() { uptime = time.Since(time.Unix(267321600, 0)) + var ( + bTrue = true + bFalse = false + ) summary = v7action.DetailedApplicationSummary{ ApplicationSummary: v7action.ApplicationSummary{ Application: resources.Application{ @@ -67,6 +71,7 @@ var _ = Describe("app summary displayer", func() { v7action.ProcessInstance{ Index: 0, State: constant.ProcessInstanceRunning, + Routable: nil, CPUEntitlement: types.NullFloat64{Value: 0, IsSet: true}, MemoryUsage: 1000000, DiskUsage: 1000000, @@ -80,6 +85,7 @@ var _ = Describe("app summary displayer", func() { v7action.ProcessInstance{ Index: 1, State: constant.ProcessInstanceRunning, + Routable: &bTrue, CPUEntitlement: types.NullFloat64{Value: 0, IsSet: false}, MemoryUsage: 2000000, DiskUsage: 2000000, @@ -93,6 +99,7 @@ var _ = Describe("app summary displayer", func() { v7action.ProcessInstance{ Index: 2, State: constant.ProcessInstanceRunning, + Routable: &bFalse, CPUEntitlement: types.NullFloat64{Value: 0.03, IsSet: true}, MemoryUsage: 3000000, DiskUsage: 3000000, @@ -116,6 +123,7 @@ var _ = Describe("app summary displayer", func() { v7action.ProcessInstance{ Index: 0, State: constant.ProcessInstanceRunning, + Routable: &bTrue, MemoryUsage: 1000000, DiskUsage: 1000000, LogRate: 128, @@ -655,7 +663,7 @@ var _ = Describe("app summary displayer", func() { When("there is an active deployment", func() { var LastStatusChangeTimeString = "2024-07-29T17:32:29Z" - var dateTimeRegexPattern = `[a-zA-Z]{3}\s\d{2}\s[a-zA-Z]{3}\s\d{2}\:\d{2}\:\d{2}\s[A-Z]{3}\s\d{4}` + var dateTimeRegexPattern = `[a-zA-Z]{3}\s\d{2}\s[a-zA-Z]{3}\s\d{2}\:\d{2}\:\d{2}\s[A-Z]+\s\d{4}` var maxInFlightDefaultValue = 1 When("the deployment strategy is rolling", func() { diff --git a/integration/helpers/app_instance_table.go b/integration/helpers/app_instance_table.go index 5ee6c136989..1c0a4a91299 100644 --- a/integration/helpers/app_instance_table.go +++ b/integration/helpers/app_instance_table.go @@ -10,6 +10,7 @@ import ( type AppInstanceRow struct { Index string State string + Ready string Since string CPU string Memory string @@ -57,7 +58,7 @@ func ParseV3AppProcessTable(input []byte) AppTable { switch { case strings.HasPrefix(row, "#"): - const columnCount = 9 + const columnCount = 10 // instance row columns := splitColumns(row) @@ -73,10 +74,11 @@ func ParseV3AppProcessTable(input []byte) AppTable { Index: columns[0], State: columns[1], Since: columns[2], - CPU: columns[3], - Memory: columns[4], - Disk: columns[5], - LogRate: columns[6], + Ready: columns[3], + CPU: columns[4], + Memory: columns[5], + Disk: columns[6], + LogRate: columns[7], CPUEntitlement: cpuEntitlement, Details: details, }