Exemplo n.º 1
0
					workerClient.AllSatisfyingReturns([]worker.Worker{satisfyingWorker}, nil)

					satisfyingWorker.CreateContainerReturns(fakeContainer, nil)
				})

				Context("when some volumes are found on the worker", func() {
					var (
						inputVolume1 *bfakes.FakeVolume
						inputVolume3 *bfakes.FakeVolume
					)

					BeforeEach(func() {
						inputVolume1 = new(bfakes.FakeVolume)
						inputVolume3 = new(bfakes.FakeVolume)

						inputSource1.VolumeOnReturns(inputVolume1, true, nil)
						inputSource2.VolumeOnReturns(nil, false, nil)
						inputSource3.VolumeOnReturns(inputVolume3, true, nil)
					})

					It("does not error and returns a resource", func() {
						Expect(initErr).NotTo(HaveOccurred())
						Expect(initResource).NotTo(BeNil())
					})

					It("chose the worker satisfying the resource type and tags", func() {
						Expect(workerClient.AllSatisfyingCallCount()).To(Equal(1))
						Expect(workerClient.AllSatisfyingArgsForCall(0)).To(Equal(worker.WorkerSpec{
							ResourceType: "type1",
							Tags:         []string{"resource", "tags"},
						}))