Exemplo n.º 1
0
				var (
					e1 = errors.New("error: cannot connect to remote registry")
					e2 = errors.New("error: socket timeout")
				)

				BeforeEach(func() {

					c = getDefaultConfiguration()
					d = docker.NewMock()

					d.PushHandler = func(option docker.PushOptions, stream docker.LogStream) error {
						return e1
					}

					d.RemoveImageHandler = func(name string) error {
						return e2
					}

				})
				JustBeforeEach(func() {
					err = Publish(d, ls, c)
				})
				It("should return a push error and not a remove error", func() {
					Expect(err).To(HaveOccurred())
					Expect(err).To(Equal(e1))
				})
				It("should try to push an image on the registry", func() {
					Expect(d.TagCalled).To(BeTrue())
					Expect(d.PushCalled).To(BeTrue())
				})
				It("should try to remove the registry tag", func() {