github.com/franc20/ayesa_sap@v7.0.0-beta.28.0.20200124003224-302d4d52fa6c+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 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 routes: dora.bosh-lite.com 18 stack: cflinuxfs2 19 buildpacks: ruby 1.6.44 20 21 type: web 22 instances: 4/4 23 memory usage: 32M 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 type: worker 31 instances: 1/1 32 memory usage: 32M 33 state since cpu memory disk 34 #0 stopped 2017-08-02 17:12:10 PM 0.0% 0M of 32M 0M of 1G 35 ` 36 appInstanceTable := ParseV3AppProcessTable([]byte(input)) 37 Expect(appInstanceTable).To(Equal(AppTable{ 38 Processes: []AppProcessTable{ 39 { 40 Type: "web", 41 InstanceCount: "4/4", 42 MemUsage: "32M", 43 Instances: []AppInstanceRow{ 44 {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"}, 45 {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"}, 46 {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"}, 47 {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"}, 48 }, 49 }, 50 { 51 Type: "worker", 52 InstanceCount: "1/1", 53 MemUsage: "32M", 54 Instances: []AppInstanceRow{ 55 {Index: "#0", State: "stopped", Since: "2017-08-02 17:12:10 PM", CPU: "0.0%", Memory: "0M of 32M", Disk: "0M of 1G"}, 56 }, 57 }, 58 }, 59 })) 60 }) 61 62 It("can parse app instance table from scale", func() { 63 input := ` 64 Showing health and status for app dora in org wut / space wut as admin... 65 66 type: web 67 instances: 4/4 68 memory usage: 32M 69 state since cpu memory disk 70 #0 running 2017-08-02 17:12:10 PM 0.0% 21.2M of 32M 84.5M of 1G 71 #1 running 2017-08-03 09:39:25 AM 0.2% 19.3M of 32M 84.5M of 1G 72 #2 running 2017-08-03 03:29:25 AM 0.1% 22.8M of 32M 84.5M of 1G 73 #3 running 2017-08-02 17:12:10 PM 0.2% 22.9M of 32M 84.5M of 1G 74 ` 75 appInstanceTable := ParseV3AppProcessTable([]byte(input)) 76 Expect(appInstanceTable).To(Equal(AppTable{ 77 Processes: []AppProcessTable{ 78 { 79 Type: "web", 80 InstanceCount: "4/4", 81 MemUsage: "32M", 82 Instances: []AppInstanceRow{ 83 {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"}, 84 {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"}, 85 {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"}, 86 {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"}, 87 }, 88 }, 89 }, 90 })) 91 }) 92 })