github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/integration/helpers/app_instance_table_test.go (about) 1 package helpers_test 2 3 import ( 4 . "code.cloudfoundry.org/cli/integration/helpers" 5 6 . "github.com/onsi/ginkgo" 7 . "github.com/onsi/gomega" 8 ) 9 10 var _ = Describe("AppInstanceTable", func() { 11 It("can parse app instance table from v3-app", func() { 12 input := ` 13 Showing health and status for app dora in org wut / space wut as admin... 14 15 name: dora 16 requested state: started 17 processes: web:4/4 18 memory usage: 32M x 4 19 routes: dora.bosh-lite.com 20 stack: cflinuxfs2 21 buildpacks: ruby 1.6.44 22 23 web:4/4 24 state since cpu memory disk 25 #0 running 2017-08-02 17:12:10 PM 0.0% 21.2M of 32M 84.5M of 1G 26 #1 running 2017-08-03 09:39:25 AM 0.2% 19.3M of 32M 84.5M of 1G 27 #2 running 2017-08-03 03:29:25 AM 0.1% 22.8M of 32M 84.5M of 1G 28 #3 running 2017-08-02 17:12:10 PM 0.2% 22.9M of 32M 84.5M of 1G 29 30 worker:1/1 31 state since cpu memory disk 32 #0 stopped 2017-08-02 17:12:10 PM 0.0% 0M of 32M 0M of 1G 33 ` 34 appInstanceTable := ParseV3AppProcessTable([]byte(input)) 35 Expect(appInstanceTable).To(Equal(AppTable{ 36 Processes: []AppProcessTable{ 37 { 38 Title: "web:4/4", 39 Instances: []AppInstanceRow{ 40 {Index: "#0", State: "running", Since: "2017-08-02 17:12:10 PM", CPU: "0.0%", Memory: "21.2M of 32M", Disk: "84.5M of 1G"}, 41 {Index: "#1", State: "running", Since: "2017-08-03 09:39:25 AM", CPU: "0.2%", Memory: "19.3M of 32M", Disk: "84.5M of 1G"}, 42 {Index: "#2", State: "running", Since: "2017-08-03 03:29:25 AM", CPU: "0.1%", Memory: "22.8M of 32M", Disk: "84.5M of 1G"}, 43 {Index: "#3", State: "running", Since: "2017-08-02 17:12:10 PM", CPU: "0.2%", Memory: "22.9M of 32M", Disk: "84.5M of 1G"}, 44 }, 45 }, 46 { 47 Title: "worker:1/1", 48 Instances: []AppInstanceRow{ 49 {Index: "#0", State: "stopped", Since: "2017-08-02 17:12:10 PM", CPU: "0.0%", Memory: "0M of 32M", Disk: "0M of 1G"}, 50 }, 51 }, 52 }, 53 })) 54 }) 55 56 It("can parse app instance table from v3-scale", func() { 57 input := ` 58 Showing health and status for app dora in org wut / space wut as admin... 59 60 web:4/4 61 state since cpu memory disk 62 #0 running 2017-08-02 17:12:10 PM 0.0% 21.2M of 32M 84.5M of 1G 63 #1 running 2017-08-03 09:39:25 AM 0.2% 19.3M of 32M 84.5M of 1G 64 #2 running 2017-08-03 03:29:25 AM 0.1% 22.8M of 32M 84.5M of 1G 65 #3 running 2017-08-02 17:12:10 PM 0.2% 22.9M of 32M 84.5M of 1G 66 ` 67 appInstanceTable := ParseV3AppProcessTable([]byte(input)) 68 Expect(appInstanceTable).To(Equal(AppTable{ 69 Processes: []AppProcessTable{ 70 { 71 Title: "web:4/4", 72 Instances: []AppInstanceRow{ 73 {Index: "#0", State: "running", Since: "2017-08-02 17:12:10 PM", CPU: "0.0%", Memory: "21.2M of 32M", Disk: "84.5M of 1G"}, 74 {Index: "#1", State: "running", Since: "2017-08-03 09:39:25 AM", CPU: "0.2%", Memory: "19.3M of 32M", Disk: "84.5M of 1G"}, 75 {Index: "#2", State: "running", Since: "2017-08-03 03:29:25 AM", CPU: "0.1%", Memory: "22.8M of 32M", Disk: "84.5M of 1G"}, 76 {Index: "#3", State: "running", Since: "2017-08-02 17:12:10 PM", CPU: "0.2%", Memory: "22.9M of 32M", Disk: "84.5M of 1G"}, 77 }, 78 }, 79 }, 80 })) 81 }) 82 })