}) }) Describe("Metrics", func() { Context("success", func() { BeforeEach(func() { server.AppendHandlers( ghttp.CombineHandlers( ghttp.VerifyRequest("GET", "/api/containers/containerhandle/metrics"), ghttp.RespondWith(200, `{"MemoryStat":{"Cache":34}}`), ), ) }) It("makes a call out to an external service", func() { metrics, err := container.Metrics() Expect(err).NotTo(HaveOccurred()) Expect(server.ReceivedRequests()).Should(HaveLen(1)) Expect(metrics.MemoryStat.Cache).Should(Equal(uint64(34))) }) }) Context("failure", func() { BeforeEach(func() { server.AppendHandlers( ghttp.CombineHandlers( ghttp.VerifyRequest("GET", "/api/containers/containerhandle/metrics"), ghttp.RespondWith(500, `{}`), ), )