Esempio n. 1
0
			})
		})
	})

	Context("when the cake does not contain any of the layers", func() {
		JustBeforeEach(func() {
			_, err := remote.Fetch(parseURL("docker:///foo#some-tag"), 67)
			Expect(err).NotTo(HaveOccurred())
		})

		It("registers each of the layers in the graph", func() {
			Expect(fakeCake.RegisterCallCount()).To(Equal(3))
		})

		It("registers the layer contents under its Strong IDs", func() {
			image, reader := fakeCake.RegisterArgsForCall(0)
			Expect(image.ID).To(Equal("abc-id"))
			Expect(image.Parent).To(Equal("abc-parent-id"))

			b, err := ioutil.ReadAll(reader)
			Expect(err).NotTo(HaveOccurred())
			Expect(string(b)).To(Equal("abc-def-contents"))
		})

		It("registers the layer with the correct size", func() {
			image, _ := fakeCake.RegisterArgsForCall(0)
			Expect(image.Size).To(BeEquivalentTo(1))
		})
	})

	Context("when the graph already contains a layer", func() {