Esempio n. 1
0
			Context("when parsing the rootfs path fails", func() {
				It("should return an error", func() {
					_, err := gdnr.Create(garden.ContainerSpec{
						RootFSPath: "://banana",
					})
					Expect(err).To(HaveOccurred())
				})

				It("should clean up networking configuration", func() {
					_, err := gdnr.Create(garden.ContainerSpec{
						Handle:     "banana-container",
						RootFSPath: "://banana",
					})
					Expect(err).To(HaveOccurred())

					Expect(networker.DestroyCallCount()).To(Equal(1))
					_, handle := networker.DestroyArgsForCall(0)
					Expect(handle).To(Equal("banana-container"))
				})
			})

			It("passes the created rootfs to the containerizer", func() {
				volumeCreator.CreateStub = func(handle string, spec rootfs_provider.Spec) (string, []string, error) {
					return "/path/to/rootfs/" + spec.RootFS.String() + "/" + handle, []string{}, nil
				}

				_, err := gdnr.Create(garden.ContainerSpec{
					Handle:     "bob",
					RootFSPath: "alice",
				})
				Expect(err).NotTo(HaveOccurred())