}) }) Context("when running in parallel", func() { Context("as the first node", func() { BeforeEach(func() { server.AppendHandlers(ghttp.CombineHandlers( ghttp.VerifyRequest("GET", "/RemoteAfterSuiteData"), func(writer http.ResponseWriter, request *http.Request) { ranThing("Request1") }, ghttp.RespondWithJSONEncoded(200, types.RemoteAfterSuiteData{false}), ), ghttp.CombineHandlers( ghttp.VerifyRequest("GET", "/RemoteAfterSuiteData"), func(writer http.ResponseWriter, request *http.Request) { ranThing("Request2") }, ghttp.RespondWithJSONEncoded(200, types.RemoteAfterSuiteData{false}), ), ghttp.CombineHandlers( ghttp.VerifyRequest("GET", "/RemoteAfterSuiteData"), func(writer http.ResponseWriter, request *http.Request) { ranThing("Request3") }, ghttp.RespondWithJSONEncoded(200, types.RemoteAfterSuiteData{true}), )) node = newNode(func() { ranThing("A") }, func() { ranThing("B") })
var parallelNode, parallelTotal int BeforeEach(func() { ranB = false parallelNode, parallelTotal = 1, 3 }) Context("as the first node, it runs A", func() { var expectedState types.RemoteBeforeSuiteData BeforeEach(func() { parallelNode, parallelTotal = 1, 3 }) JustBeforeEach(func() { server.AppendHandlers(ghttp.CombineHandlers( ghttp.VerifyRequest("POST", "/BeforeSuiteState"), ghttp.VerifyJSONRepresenting(expectedState), )) outcome = node.Run(parallelNode, parallelTotal, server.URL()) }) Context("when A succeeds", func() { BeforeEach(func() { expectedState = types.RemoteBeforeSuiteData{[]byte("my data"), types.RemoteBeforeSuiteStatePassed} node = newNode(func() []byte { return []byte("my data") }, func([]byte) { ranB = true }) })