コード例 #1
0
		handle := "suitcase"

		limits := garden.CPULimits{
			LimitInShares: 7,
		}

		var gotLimits garden.CPULimits

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

				calledHandle, calledLimits := innerConnection.LimitCPUArgsForCall(0)
				Ω(calledHandle).Should(Equal(handle))
				Ω(calledLimits).Should(Equal(limits))
			})

			It("returns the limits", func() {
				Ω(gotLimits).Should(Equal(limits))
			})
		})
	})
コード例 #2
0
		handle := "suitcase"

		limits := garden.CPULimits{
			LimitInShares: 7,
		}

		var gotLimits garden.CPULimits

		itRetries(func() error {
			var err error
			gotLimits, err = conn.LimitCPU(handle, limits)
			return err
		}, func(err error) {
			innerConnection.LimitCPUReturns(limits, err)
		}, func() int {
			return innerConnection.LimitCPUCallCount()
		}, func() {
			It("calls through to garden", func() {
				Expect(innerConnection.LimitCPUCallCount()).To(Equal(1))

				calledHandle, calledLimits := innerConnection.LimitCPUArgsForCall(0)
				Expect(calledHandle).To(Equal(handle))
				Expect(calledLimits).To(Equal(limits))
			})

			It("returns the limits", func() {
				Expect(gotLimits).To(Equal(limits))
			})
		})
	})