"env2": "env2Value",
					},
				))
			})
		})

		Context("when the namespace parameter is true", func() {
			Context("and the image has not been translated yet", func() {
				BeforeEach(func() {
					fakeCake.GetReturns(nil, errors.New("no image here"))
				})

				It("fetches it, namespaces it, and creates a graph entry with it as the parent", func() {
					fakeRepositoryFetcher.FetchResult = "some-image-id"
					fakeCake.PathStub = func(id layercake.ID) (string, error) {
						return "/mount/point/" + id.GraphID(), nil
					}

					fakeNamespacer.CacheKeyReturns("jam")

					mountpoint, envvars, err := provider.ProvideRootFS(
						logger,
						"some-id",
						parseURL("docker:///some-repository-name"),
						true,
						0,
					)
					Expect(err).ToNot(HaveOccurred())

					Expect(fakeRepositoryFetcher.Fetched()).To(ContainElement(
						fake_repository_fetcher.FetchSpec{
Beispiel #2
0
				return nil
			},
			Logger: lagertest.NewTestLogger("test"),
		}

		runner.WhenRunning(fake_command_runner.CommandSpec{
			Path: "btrfs",
			Args: []string{"subvolume", "list", btrfsMountPoint},
		}, func(cmd *exec.Cmd) error {
			_, err := cmd.Stdout.Write([]byte(listSubvolumesOutput))
			Expect(err).NotTo(HaveOccurred())
			return listSubVolumeErr
		})

		fakeCake.PathStub = func(id layercake.ID) (string, error) {
			return "/absolute/btrfs_mount/relative/path/to/" + id.GraphID(), graphDriverErr
		}
	})

	Context("when there are no subvolumes", func() {
		BeforeEach(func() {
			listSubvolumesOutput = "\n"
		})

		It("does not invoke subvolume delete", func() {
			Expect(cleaner.Remove(layerId)).To(Succeed())
			Expect(runner).NotTo(HaveExecutedSerially(fake_command_runner.CommandSpec{
				Path: "btrfs",
				Args: []string{"subvolume", "delete", "/path/to/" + layerId.GraphID()},
			}))
		})