示例#1
0
		JustBeforeEach(func() {
			evacuatable.Evacuate()
		})

		Context("when containers are present", func() {
			Context("and are all destroyed before the timeout elapses", func() {
				BeforeEach(func() {
					containerResponses := [][]executor.Container{
						containers,
						[]executor.Container{},
					}

					index := 0
					executorClient.ListContainersStub = func(lager.Logger) ([]executor.Container, error) {
						containersToReturn := containerResponses[index]
						index++
						return containersToReturn, nil
					}
				})

				It("waits for all the containers to go away and exits before evacuation timeout", func() {
					fakeClock.Increment(pollingInterval)
					Eventually(executorClient.ListContainersCallCount).Should(Equal(1))

					fakeClock.Increment(pollingInterval)
					Eventually(executorClient.ListContainersCallCount).Should(Equal(2))

					Eventually(errChan).Should(Receive(BeNil()))
				})

				Context("when the executor client returns an error", func() {