Example #1
0
								cowVolume1 = new(bfakes.FakeVolume)
								cowVolume1.HandleReturns("cow-volume1")
								cowVolume1.PathReturns("/some/cow/src/path")

								cowVolume2 = new(bfakes.FakeVolume)
								cowVolume2.HandleReturns("cow-volume2")
								cowVolume2.PathReturns("/some/other/cow/src/path")

								fakeBaggageclaimClient.CreateVolumeStub = func(logger lager.Logger, spec baggageclaim.VolumeSpec) (baggageclaim.Volume, error) {
									Expect(spec.Privileged).To(BeTrue())
									Expect(spec.TTL).To(Equal(5 * time.Minute))

									if reflect.DeepEqual(spec.Strategy, baggageclaim.COWStrategy{Parent: volume1}) {
										return cowVolume1, nil
									} else if reflect.DeepEqual(spec.Strategy, baggageclaim.COWStrategy{Parent: volume2}) {
										return cowVolume2, nil
									} else {
										Fail(fmt.Sprintf("unknown strategy: %#v", spec.Strategy))
										return nil, nil
									}
								}
							})

							It("creates the container with read-write copy-on-write bind-mounts for each cache", func() {
								Expect(fakeGardenClient.CreateCallCount()).To(Equal(1))

								spec := fakeGardenClient.CreateArgsForCall(0)
								Expect(spec.RootFSPath).To(Equal("some-resource-image"))
								Expect(spec.Privileged).To(BeTrue())
								Expect(spec.BindMounts).To(Equal([]garden.BindMount{