Пример #1
0
					throttleChan <- struct{}{}
					<-doneChan
					return nil
				}
			})

			It("throttles the requests to Garden", func() {
				stopContainerCount := 0
				deleteContainerCount := 0
				for i, request := range requests {
					if i%2 == 0 {
						stopContainerCount++
						go depotClient.StopContainer(request.Guid)
					} else {
						deleteContainerCount++
						go depotClient.DeleteContainer(request.Guid)
					}
				}

				Eventually(func() int {
					return len(throttleChan)
				}).Should(Equal(workPoolSettings.DeleteWorkPoolSize))
				Consistently(func() int {
					return len(throttleChan)
				}).Should(Equal(workPoolSettings.DeleteWorkPoolSize))

				doneChan <- struct{}{}

				Eventually(func() int {
					return gardenStore.StopCallCount() + gardenStore.DestroyCallCount()
				}).Should(Equal(workPoolSettings.DeleteWorkPoolSize + 1))
Пример #2
0
								It("stops the container", func() {
									Eventually(containerStatePoller(guid)).Should(Equal(executor.StateCompleted))
								})
							})
						})
					})

					Context("after running succeeds", func() {
						Describe("deleting the container", func() {
							It("works", func(done Done) {
								defer close(done)

								Eventually(containerStatePoller(guid)).Should(Equal(executor.StateCompleted))

								err := executorClient.DeleteContainer(guid)
								Expect(err).NotTo(HaveOccurred())
							}, 5)
						})
					})

					Context("when running fails", func() {
						BeforeEach(func() {
							container.Action = models.WrapAction(&models.RunAction{
								User: "******",
								Path: "false",
							})
						})

						It("saves the failed result and reason", func() {
							Eventually(containerStatePoller(guid)).Should(Equal(executor.StateCompleted))