return NewSynchronizedBeforeSuiteNode(bodyA, bodyB, codeLocation, time.Millisecond, failer)
	}

	Describe("when not running in parallel", func() {
		Context("when all is well", func() {
			var data []byte
			BeforeEach(func() {
				data = nil

				node = newNode(func() []byte {
					return []byte("my data")
				}, func(d []byte) {
					data = d
				})

				outcome = node.Run(1, 1, server.URL())
			})

			It("should run A, then B passing the output from A to B", func() {
				Ω(data).Should(Equal([]byte("my data")))
			})

			It("should report success", func() {
				Ω(outcome).Should(BeTrue())
				Ω(node.Passed()).Should(BeTrue())
				Ω(node.Summary().State).Should(Equal(types.SpecStatePassed))
			})
		})

		Context("when A fails", func() {
			var ranB bool
		})
	})

	Describe("FetchMetadata", func() {
		var registryHost string
		var repoName string
		var tag string
		var insecureRegistries []string
		var authConfig *registry.AuthConfig

		BeforeEach(func() {
			server = ghttp.NewServer()
			endpoint1 = ghttp.NewServer()
			endpoint2 = ghttp.NewServer()

			parts, _ := url.Parse(server.URL())
			registryHost = parts.Host

			repoName = ""
			tag = "latest"

			insecureRegistries = []string{}
			authConfig = &registry.AuthConfig{}
		})

		Context("with an invalid host", func() {
			BeforeEach(func() {
				setupPingableRegistry()
				repoName = "qwer:5123/some_user/some_repo"
			})
	thingsThatRan := func() []string {
		lock.Lock()
		defer lock.Unlock()
		return things
	}

	Context("when not running in parallel", func() {
		Context("when all is well", func() {
			BeforeEach(func() {
				node = newNode(func() {
					ranThing("A")
				}, func() {
					ranThing("B")
				})

				outcome = node.Run(1, 1, server.URL())
			})

			It("should run A, then B", func() {
				Ω(thingsThatRan()).Should(Equal([]string{"A", "B"}))
			})

			It("should report success", func() {
				Ω(outcome).Should(BeTrue())
				Ω(node.Passed()).Should(BeTrue())
				Ω(node.Summary().State).Should(Equal(types.SpecStatePassed))
			})
		})

		Context("when A fails", func() {
			BeforeEach(func() {
Пример #4
0
		if len(dockerPassword) > 0 {
			args = append(args, "-dockerPassword", dockerPassword)
		}

		if len(dockerEmail) > 0 {
			args = append(args, "-dockerEmail", dockerEmail)
		}

		builderCmd = exec.Command(builderPath, args...)

		builderCmd.Env = os.Environ()
	})

	buildDockerImageURL := func() string {
		parts, err := url.Parse(fakeDockerRegistry.URL())
		Expect(err).NotTo(HaveOccurred())
		return fmt.Sprintf("docker://%s/some-repo", parts.Host)
	}

	Context("when running the main", func() {
		Context("when signalled", func() {
			var session *gexec.Session

			BeforeEach(func() {
				dockerImageURL = buildDockerImageURL()

				parts, err := url.Parse(fakeDockerRegistry.URL())
				Expect(err).NotTo(HaveOccurred())
				dockerRegistryAddresses = parts.Host