Ejemplo n.º 1
0
				Ω(err).Should(Equal(disaster))
			})
		})
	})

	Describe("CurrentDiskLimits", func() {
		It("sends an empty limit request and returns its response", func() {
			limitsToReturn := garden.DiskLimits{
				InodeSoft: 7,
				InodeHard: 8,
				ByteSoft:  11,
				ByteHard:  12,
				Scope:     garden.DiskLimitScopeExclusive,
			}

			fakeConnection.CurrentDiskLimitsReturns(limitsToReturn, nil)

			limits, err := container.CurrentDiskLimits()
			Ω(err).ShouldNot(HaveOccurred())

			Ω(limits).Should(Equal(limitsToReturn))
		})

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

			BeforeEach(func() {
				fakeConnection.CurrentDiskLimitsReturns(garden.DiskLimits{}, disaster)
			})

			It("returns the error", func() {
Ejemplo n.º 2
0
	Describe("CurrentDiskLimits", func() {
		handle := "suitcase"

		limits := garden.DiskLimits{
			ByteHard: 234,
		}

		var gotLimits garden.DiskLimits

		itRetries(func() error {
			var err error
			gotLimits, err = conn.CurrentDiskLimits(handle)
			return err
		}, func(err error) {
			innerConnection.CurrentDiskLimitsReturns(limits, err)
		}, func() int {
			return innerConnection.CurrentDiskLimitsCallCount()
		}, func() {
			It("calls through to garden", func() {
				Ω(innerConnection.CurrentDiskLimitsCallCount()).Should(Equal(1))

				calledHandle := innerConnection.CurrentDiskLimitsArgsForCall(0)
				Ω(calledHandle).Should(Equal(handle))
			})

			It("returns the limits", func() {
				Ω(gotLimits).Should(Equal(limits))
			})
		})
	})