}) }) }) Describe("Info", func() { It("sends an info request", func() { infoToReturn := garden.ContainerInfo{ State: "chillin", } fakeConnection.InfoReturns(infoToReturn, nil) info, err := container.Info() Ω(err).ShouldNot(HaveOccurred()) Ω(fakeConnection.InfoArgsForCall(0)).Should(Equal("some-handle")) Ω(info).Should(Equal(infoToReturn)) }) Context("when getting info fails", func() { disaster := errors.New("oh no!") BeforeEach(func() { fakeConnection.InfoReturns(garden.ContainerInfo{}, disaster) }) It("returns the error", func() { _, err := container.Info() Ω(err).Should(Equal(disaster)) })
itRetries(func() error { var err error gotInfo, err = conn.Info(handle) return err }, func(err error) { innerConnection.InfoReturns(garden.ContainerInfo{ State: "chillin", }, err) }, func() int { return innerConnection.InfoCallCount() }, func() { It("calls through to garden", func() { Ω(innerConnection.InfoCallCount()).Should(Equal(1)) infoedHandle := innerConnection.InfoArgsForCall(0) Ω(infoedHandle).Should(Equal(handle)) }) It("returns the info", func() { Ω(gotInfo).Should(Equal(garden.ContainerInfo{ State: "chillin", })) }) }) }) Describe("NetIn", func() { var hostPort uint32 = 23456 var containerPort uint32 = 34567