Exemplo n.º 1
0
			fakeConnection.NotifyDisconnected()

			_, err = client.Create(warden.ContainerSpec{})
			Ω(err).ShouldNot(HaveOccurred())

			Ω(reconnectedConnection.Created()).Should(HaveLen(1))
		})
	})

	Describe("Capacity", func() {
		BeforeEach(func() {
			fakeConnection.WhenGettingCapacity = func() (warden.Capacity, error) {
				return warden.Capacity{
					MemoryInBytes: 1111,
					DiskInBytes:   2222,
					MaxContainers: 42,
				}, nil
			}
		})

		It("sends a capacity request and returns the capacity", func() {
			capacity, err := client.Capacity()
			Ω(err).ShouldNot(HaveOccurred())
			Ω(capacity.MemoryInBytes).Should(Equal(uint64(1111)))
			Ω(capacity.DiskInBytes).Should(Equal(uint64(2222)))
		})

		Context("when getting capacity fails", func() {
			disaster := errors.New("oh no!")