Ejemplo n.º 1
0
			})

			It("returns the error", func() {
				err := container.Stop(true)
				Ω(err).Should(Equal(disaster))
			})
		})
	})

	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)
			})
Ejemplo n.º 2
0
			})
		})
	})

	Describe("Info", func() {
		handle := "doorknob"

		var gotInfo garden.ContainerInfo

		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",
				}))