vendor: Mega update all dependencies
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4080
This commit is contained in:
9
vendor/github.com/onsi/ginkgo/internal/remote/aggregator.go
generated
vendored
9
vendor/github.com/onsi/ginkgo/internal/remote/aggregator.go
generated
vendored
@@ -125,14 +125,12 @@ func (aggregator *Aggregator) registerSuiteBeginning(configAndSuite configAndSui
|
||||
|
||||
aggregator.stenographer.AnnounceSuite(configAndSuite.summary.SuiteDescription, configAndSuite.config.RandomSeed, configAndSuite.config.RandomizeAllSpecs, aggregator.config.Succinct)
|
||||
|
||||
numberOfSpecsToRun := 0
|
||||
totalNumberOfSpecs := 0
|
||||
for _, configAndSuite := range aggregator.aggregatedSuiteBeginnings {
|
||||
numberOfSpecsToRun += configAndSuite.summary.NumberOfSpecsThatWillBeRun
|
||||
totalNumberOfSpecs += configAndSuite.summary.NumberOfTotalSpecs
|
||||
if len(aggregator.aggregatedSuiteBeginnings) > 0 {
|
||||
totalNumberOfSpecs = configAndSuite.summary.NumberOfSpecsBeforeParallelization
|
||||
}
|
||||
|
||||
aggregator.stenographer.AnnounceNumberOfSpecs(numberOfSpecsToRun, totalNumberOfSpecs, aggregator.config.Succinct)
|
||||
aggregator.stenographer.AnnounceTotalNumberOfSpecs(totalNumberOfSpecs, aggregator.config.Succinct)
|
||||
aggregator.stenographer.AnnounceAggregatedParallelRun(aggregator.nodeCount, aggregator.config.Succinct)
|
||||
aggregator.flushCompletedSpecs()
|
||||
}
|
||||
@@ -239,6 +237,7 @@ func (aggregator *Aggregator) registerSuiteEnding(suite *types.SuiteSummary) (fi
|
||||
aggregatedSuiteSummary.NumberOfFailedSpecs += suiteSummary.NumberOfFailedSpecs
|
||||
aggregatedSuiteSummary.NumberOfPendingSpecs += suiteSummary.NumberOfPendingSpecs
|
||||
aggregatedSuiteSummary.NumberOfSkippedSpecs += suiteSummary.NumberOfSkippedSpecs
|
||||
aggregatedSuiteSummary.NumberOfFlakedSpecs += suiteSummary.NumberOfFlakedSpecs
|
||||
}
|
||||
|
||||
aggregatedSuiteSummary.RunTime = time.Since(aggregator.startTime)
|
||||
|
||||
311
vendor/github.com/onsi/ginkgo/internal/remote/aggregator_test.go
generated
vendored
311
vendor/github.com/onsi/ginkgo/internal/remote/aggregator_test.go
generated
vendored
@@ -1,311 +0,0 @@
|
||||
package remote_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"github.com/onsi/ginkgo/config"
|
||||
. "github.com/onsi/ginkgo/internal/remote"
|
||||
st "github.com/onsi/ginkgo/reporters/stenographer"
|
||||
"github.com/onsi/ginkgo/types"
|
||||
"time"
|
||||
)
|
||||
|
||||
var _ = Describe("Aggregator", func() {
|
||||
var (
|
||||
aggregator *Aggregator
|
||||
reporterConfig config.DefaultReporterConfigType
|
||||
stenographer *st.FakeStenographer
|
||||
result chan bool
|
||||
|
||||
ginkgoConfig1 config.GinkgoConfigType
|
||||
ginkgoConfig2 config.GinkgoConfigType
|
||||
|
||||
suiteSummary1 *types.SuiteSummary
|
||||
suiteSummary2 *types.SuiteSummary
|
||||
|
||||
beforeSummary *types.SetupSummary
|
||||
afterSummary *types.SetupSummary
|
||||
specSummary *types.SpecSummary
|
||||
|
||||
suiteDescription string
|
||||
)
|
||||
|
||||
BeforeEach(func() {
|
||||
reporterConfig = config.DefaultReporterConfigType{
|
||||
NoColor: false,
|
||||
SlowSpecThreshold: 0.1,
|
||||
NoisyPendings: true,
|
||||
Succinct: false,
|
||||
Verbose: true,
|
||||
}
|
||||
stenographer = st.NewFakeStenographer()
|
||||
result = make(chan bool, 1)
|
||||
aggregator = NewAggregator(2, result, reporterConfig, stenographer)
|
||||
|
||||
//
|
||||
// now set up some fixture data
|
||||
//
|
||||
|
||||
ginkgoConfig1 = config.GinkgoConfigType{
|
||||
RandomSeed: 1138,
|
||||
RandomizeAllSpecs: true,
|
||||
ParallelNode: 1,
|
||||
ParallelTotal: 2,
|
||||
}
|
||||
|
||||
ginkgoConfig2 = config.GinkgoConfigType{
|
||||
RandomSeed: 1138,
|
||||
RandomizeAllSpecs: true,
|
||||
ParallelNode: 2,
|
||||
ParallelTotal: 2,
|
||||
}
|
||||
|
||||
suiteDescription = "My Parallel Suite"
|
||||
|
||||
suiteSummary1 = &types.SuiteSummary{
|
||||
SuiteDescription: suiteDescription,
|
||||
|
||||
NumberOfSpecsBeforeParallelization: 30,
|
||||
NumberOfTotalSpecs: 17,
|
||||
NumberOfSpecsThatWillBeRun: 15,
|
||||
NumberOfPendingSpecs: 1,
|
||||
NumberOfSkippedSpecs: 1,
|
||||
}
|
||||
|
||||
suiteSummary2 = &types.SuiteSummary{
|
||||
SuiteDescription: suiteDescription,
|
||||
|
||||
NumberOfSpecsBeforeParallelization: 30,
|
||||
NumberOfTotalSpecs: 13,
|
||||
NumberOfSpecsThatWillBeRun: 8,
|
||||
NumberOfPendingSpecs: 2,
|
||||
NumberOfSkippedSpecs: 3,
|
||||
}
|
||||
|
||||
beforeSummary = &types.SetupSummary{
|
||||
State: types.SpecStatePassed,
|
||||
CapturedOutput: "BeforeSuiteOutput",
|
||||
}
|
||||
|
||||
afterSummary = &types.SetupSummary{
|
||||
State: types.SpecStatePassed,
|
||||
CapturedOutput: "AfterSuiteOutput",
|
||||
}
|
||||
|
||||
specSummary = &types.SpecSummary{
|
||||
State: types.SpecStatePassed,
|
||||
CapturedOutput: "SpecOutput",
|
||||
}
|
||||
})
|
||||
|
||||
call := func(method string, args ...interface{}) st.FakeStenographerCall {
|
||||
return st.NewFakeStenographerCall(method, args...)
|
||||
}
|
||||
|
||||
beginSuite := func() {
|
||||
stenographer.Reset()
|
||||
aggregator.SpecSuiteWillBegin(ginkgoConfig2, suiteSummary2)
|
||||
aggregator.SpecSuiteWillBegin(ginkgoConfig1, suiteSummary1)
|
||||
Eventually(func() interface{} {
|
||||
return len(stenographer.Calls())
|
||||
}).Should(BeNumerically(">=", 3))
|
||||
}
|
||||
|
||||
Describe("Announcing the beginning of the suite", func() {
|
||||
Context("When one of the parallel-suites starts", func() {
|
||||
BeforeEach(func() {
|
||||
aggregator.SpecSuiteWillBegin(ginkgoConfig2, suiteSummary2)
|
||||
})
|
||||
|
||||
It("should be silent", func() {
|
||||
Consistently(func() interface{} { return stenographer.Calls() }).Should(BeEmpty())
|
||||
})
|
||||
})
|
||||
|
||||
Context("once all of the parallel-suites have started", func() {
|
||||
BeforeEach(func() {
|
||||
aggregator.SpecSuiteWillBegin(ginkgoConfig2, suiteSummary2)
|
||||
aggregator.SpecSuiteWillBegin(ginkgoConfig1, suiteSummary1)
|
||||
Eventually(func() interface{} {
|
||||
return stenographer.Calls()
|
||||
}).Should(HaveLen(3))
|
||||
})
|
||||
|
||||
It("should announce the beginning of the suite", func() {
|
||||
Ω(stenographer.Calls()).Should(HaveLen(3))
|
||||
Ω(stenographer.Calls()[0]).Should(Equal(call("AnnounceSuite", suiteDescription, ginkgoConfig1.RandomSeed, true, false)))
|
||||
Ω(stenographer.Calls()[1]).Should(Equal(call("AnnounceNumberOfSpecs", 23, 30, false)))
|
||||
Ω(stenographer.Calls()[2]).Should(Equal(call("AnnounceAggregatedParallelRun", 2, false)))
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Describe("Announcing specs and before suites", func() {
|
||||
Context("when the parallel-suites have not all started", func() {
|
||||
BeforeEach(func() {
|
||||
aggregator.BeforeSuiteDidRun(beforeSummary)
|
||||
aggregator.AfterSuiteDidRun(afterSummary)
|
||||
aggregator.SpecDidComplete(specSummary)
|
||||
})
|
||||
|
||||
It("should not announce any specs", func() {
|
||||
Consistently(func() interface{} { return stenographer.Calls() }).Should(BeEmpty())
|
||||
})
|
||||
|
||||
Context("when the parallel-suites subsequently start", func() {
|
||||
BeforeEach(func() {
|
||||
beginSuite()
|
||||
})
|
||||
|
||||
It("should announce the specs, the before suites and the after suites", func() {
|
||||
Eventually(func() interface{} {
|
||||
return stenographer.Calls()
|
||||
}).Should(ContainElement(call("AnnounceSuccesfulSpec", specSummary)))
|
||||
|
||||
Ω(stenographer.Calls()).Should(ContainElement(call("AnnounceCapturedOutput", beforeSummary.CapturedOutput)))
|
||||
Ω(stenographer.Calls()).Should(ContainElement(call("AnnounceCapturedOutput", afterSummary.CapturedOutput)))
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Context("When the parallel-suites have all started", func() {
|
||||
BeforeEach(func() {
|
||||
beginSuite()
|
||||
stenographer.Reset()
|
||||
})
|
||||
|
||||
Context("When a spec completes", func() {
|
||||
BeforeEach(func() {
|
||||
aggregator.BeforeSuiteDidRun(beforeSummary)
|
||||
aggregator.SpecDidComplete(specSummary)
|
||||
aggregator.AfterSuiteDidRun(afterSummary)
|
||||
Eventually(func() interface{} {
|
||||
return stenographer.Calls()
|
||||
}).Should(HaveLen(5))
|
||||
})
|
||||
|
||||
It("should announce the captured output of the BeforeSuite", func() {
|
||||
Ω(stenographer.Calls()[0]).Should(Equal(call("AnnounceCapturedOutput", beforeSummary.CapturedOutput)))
|
||||
})
|
||||
|
||||
It("should announce that the spec will run (when in verbose mode)", func() {
|
||||
Ω(stenographer.Calls()[1]).Should(Equal(call("AnnounceSpecWillRun", specSummary)))
|
||||
})
|
||||
|
||||
It("should announce the captured stdout of the spec", func() {
|
||||
Ω(stenographer.Calls()[2]).Should(Equal(call("AnnounceCapturedOutput", specSummary.CapturedOutput)))
|
||||
})
|
||||
|
||||
It("should announce completion", func() {
|
||||
Ω(stenographer.Calls()[3]).Should(Equal(call("AnnounceSuccesfulSpec", specSummary)))
|
||||
})
|
||||
|
||||
It("should announce the captured output of the AfterSuite", func() {
|
||||
Ω(stenographer.Calls()[4]).Should(Equal(call("AnnounceCapturedOutput", afterSummary.CapturedOutput)))
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Describe("Announcing the end of the suite", func() {
|
||||
BeforeEach(func() {
|
||||
beginSuite()
|
||||
stenographer.Reset()
|
||||
})
|
||||
|
||||
Context("When one of the parallel-suites ends", func() {
|
||||
BeforeEach(func() {
|
||||
aggregator.SpecSuiteDidEnd(suiteSummary2)
|
||||
})
|
||||
|
||||
It("should be silent", func() {
|
||||
Consistently(func() interface{} { return stenographer.Calls() }).Should(BeEmpty())
|
||||
})
|
||||
|
||||
It("should not notify the channel", func() {
|
||||
Ω(result).Should(BeEmpty())
|
||||
})
|
||||
})
|
||||
|
||||
Context("once all of the parallel-suites end", func() {
|
||||
BeforeEach(func() {
|
||||
time.Sleep(200 * time.Millisecond)
|
||||
|
||||
suiteSummary1.SuiteSucceeded = true
|
||||
suiteSummary1.NumberOfPassedSpecs = 15
|
||||
suiteSummary1.NumberOfFailedSpecs = 0
|
||||
suiteSummary2.SuiteSucceeded = false
|
||||
suiteSummary2.NumberOfPassedSpecs = 5
|
||||
suiteSummary2.NumberOfFailedSpecs = 3
|
||||
|
||||
aggregator.SpecSuiteDidEnd(suiteSummary2)
|
||||
aggregator.SpecSuiteDidEnd(suiteSummary1)
|
||||
Eventually(func() interface{} {
|
||||
return stenographer.Calls()
|
||||
}).Should(HaveLen(2))
|
||||
})
|
||||
|
||||
It("should announce the end of the suite", func() {
|
||||
compositeSummary := stenographer.Calls()[1].Args[0].(*types.SuiteSummary)
|
||||
|
||||
Ω(compositeSummary.SuiteSucceeded).Should(BeFalse())
|
||||
Ω(compositeSummary.NumberOfSpecsThatWillBeRun).Should(Equal(23))
|
||||
Ω(compositeSummary.NumberOfTotalSpecs).Should(Equal(30))
|
||||
Ω(compositeSummary.NumberOfPassedSpecs).Should(Equal(20))
|
||||
Ω(compositeSummary.NumberOfFailedSpecs).Should(Equal(3))
|
||||
Ω(compositeSummary.NumberOfPendingSpecs).Should(Equal(3))
|
||||
Ω(compositeSummary.NumberOfSkippedSpecs).Should(Equal(4))
|
||||
Ω(compositeSummary.RunTime.Seconds()).Should(BeNumerically(">", 0.2))
|
||||
})
|
||||
})
|
||||
|
||||
Context("when all the parallel-suites pass", func() {
|
||||
BeforeEach(func() {
|
||||
suiteSummary1.SuiteSucceeded = true
|
||||
suiteSummary2.SuiteSucceeded = true
|
||||
|
||||
aggregator.SpecSuiteDidEnd(suiteSummary2)
|
||||
aggregator.SpecSuiteDidEnd(suiteSummary1)
|
||||
Eventually(func() interface{} {
|
||||
return stenographer.Calls()
|
||||
}).Should(HaveLen(2))
|
||||
})
|
||||
|
||||
It("should report success", func() {
|
||||
compositeSummary := stenographer.Calls()[1].Args[0].(*types.SuiteSummary)
|
||||
|
||||
Ω(compositeSummary.SuiteSucceeded).Should(BeTrue())
|
||||
})
|
||||
|
||||
It("should notify the channel that it succeded", func(done Done) {
|
||||
Ω(<-result).Should(BeTrue())
|
||||
close(done)
|
||||
})
|
||||
})
|
||||
|
||||
Context("when one of the parallel-suites fails", func() {
|
||||
BeforeEach(func() {
|
||||
suiteSummary1.SuiteSucceeded = true
|
||||
suiteSummary2.SuiteSucceeded = false
|
||||
|
||||
aggregator.SpecSuiteDidEnd(suiteSummary2)
|
||||
aggregator.SpecSuiteDidEnd(suiteSummary1)
|
||||
Eventually(func() interface{} {
|
||||
return stenographer.Calls()
|
||||
}).Should(HaveLen(2))
|
||||
})
|
||||
|
||||
It("should report failure", func() {
|
||||
compositeSummary := stenographer.Calls()[1].Args[0].(*types.SuiteSummary)
|
||||
|
||||
Ω(compositeSummary.SuiteSucceeded).Should(BeFalse())
|
||||
})
|
||||
|
||||
It("should notify the channel that it failed", func(done Done) {
|
||||
Ω(<-result).Should(BeFalse())
|
||||
close(done)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
17
vendor/github.com/onsi/ginkgo/internal/remote/fake_output_interceptor_test.go
generated
vendored
17
vendor/github.com/onsi/ginkgo/internal/remote/fake_output_interceptor_test.go
generated
vendored
@@ -1,17 +0,0 @@
|
||||
package remote_test
|
||||
|
||||
type fakeOutputInterceptor struct {
|
||||
DidStartInterceptingOutput bool
|
||||
DidStopInterceptingOutput bool
|
||||
InterceptedOutput string
|
||||
}
|
||||
|
||||
func (interceptor *fakeOutputInterceptor) StartInterceptingOutput() error {
|
||||
interceptor.DidStartInterceptingOutput = true
|
||||
return nil
|
||||
}
|
||||
|
||||
func (interceptor *fakeOutputInterceptor) StopInterceptingAndReturnOutput() (string, error) {
|
||||
interceptor.DidStopInterceptingOutput = true
|
||||
return interceptor.InterceptedOutput, nil
|
||||
}
|
||||
33
vendor/github.com/onsi/ginkgo/internal/remote/fake_poster_test.go
generated
vendored
33
vendor/github.com/onsi/ginkgo/internal/remote/fake_poster_test.go
generated
vendored
@@ -1,33 +0,0 @@
|
||||
package remote_test
|
||||
|
||||
import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type post struct {
|
||||
url string
|
||||
bodyType string
|
||||
bodyContent []byte
|
||||
}
|
||||
|
||||
type fakePoster struct {
|
||||
posts []post
|
||||
}
|
||||
|
||||
func newFakePoster() *fakePoster {
|
||||
return &fakePoster{
|
||||
posts: make([]post, 0),
|
||||
}
|
||||
}
|
||||
|
||||
func (poster *fakePoster) Post(url string, bodyType string, body io.Reader) (resp *http.Response, err error) {
|
||||
bodyContent, _ := ioutil.ReadAll(body)
|
||||
poster.posts = append(poster.posts, post{
|
||||
url: url,
|
||||
bodyType: bodyType,
|
||||
bodyContent: bodyContent,
|
||||
})
|
||||
return nil, nil
|
||||
}
|
||||
180
vendor/github.com/onsi/ginkgo/internal/remote/forwarding_reporter_test.go
generated
vendored
180
vendor/github.com/onsi/ginkgo/internal/remote/forwarding_reporter_test.go
generated
vendored
@@ -1,180 +0,0 @@
|
||||
package remote_test
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
. "github.com/onsi/ginkgo"
|
||||
"github.com/onsi/ginkgo/config"
|
||||
. "github.com/onsi/ginkgo/internal/remote"
|
||||
"github.com/onsi/ginkgo/types"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
var _ = Describe("ForwardingReporter", func() {
|
||||
var (
|
||||
reporter *ForwardingReporter
|
||||
interceptor *fakeOutputInterceptor
|
||||
poster *fakePoster
|
||||
suiteSummary *types.SuiteSummary
|
||||
specSummary *types.SpecSummary
|
||||
setupSummary *types.SetupSummary
|
||||
serverHost string
|
||||
)
|
||||
|
||||
BeforeEach(func() {
|
||||
serverHost = "http://127.0.0.1:7788"
|
||||
|
||||
poster = newFakePoster()
|
||||
|
||||
interceptor = &fakeOutputInterceptor{
|
||||
InterceptedOutput: "The intercepted output!",
|
||||
}
|
||||
|
||||
reporter = NewForwardingReporter(serverHost, poster, interceptor)
|
||||
|
||||
suiteSummary = &types.SuiteSummary{
|
||||
SuiteDescription: "My Test Suite",
|
||||
}
|
||||
|
||||
setupSummary = &types.SetupSummary{
|
||||
State: types.SpecStatePassed,
|
||||
}
|
||||
|
||||
specSummary = &types.SpecSummary{
|
||||
ComponentTexts: []string{"My", "Spec"},
|
||||
State: types.SpecStatePassed,
|
||||
}
|
||||
})
|
||||
|
||||
Context("When a suite begins", func() {
|
||||
BeforeEach(func() {
|
||||
reporter.SpecSuiteWillBegin(config.GinkgoConfig, suiteSummary)
|
||||
})
|
||||
|
||||
It("should start intercepting output", func() {
|
||||
Ω(interceptor.DidStartInterceptingOutput).Should(BeTrue())
|
||||
})
|
||||
|
||||
It("should POST the SuiteSummary and Ginkgo Config to the Ginkgo server", func() {
|
||||
Ω(poster.posts).Should(HaveLen(1))
|
||||
Ω(poster.posts[0].url).Should(Equal("http://127.0.0.1:7788/SpecSuiteWillBegin"))
|
||||
Ω(poster.posts[0].bodyType).Should(Equal("application/json"))
|
||||
|
||||
var sentData struct {
|
||||
SentConfig config.GinkgoConfigType `json:"config"`
|
||||
SentSuiteSummary *types.SuiteSummary `json:"suite-summary"`
|
||||
}
|
||||
|
||||
err := json.Unmarshal(poster.posts[0].bodyContent, &sentData)
|
||||
Ω(err).ShouldNot(HaveOccurred())
|
||||
|
||||
Ω(sentData.SentConfig).Should(Equal(config.GinkgoConfig))
|
||||
Ω(sentData.SentSuiteSummary).Should(Equal(suiteSummary))
|
||||
})
|
||||
})
|
||||
|
||||
Context("when a BeforeSuite completes", func() {
|
||||
BeforeEach(func() {
|
||||
reporter.BeforeSuiteDidRun(setupSummary)
|
||||
})
|
||||
|
||||
It("should stop, then start intercepting output", func() {
|
||||
Ω(interceptor.DidStopInterceptingOutput).Should(BeTrue())
|
||||
Ω(interceptor.DidStartInterceptingOutput).Should(BeTrue())
|
||||
})
|
||||
|
||||
It("should POST the SetupSummary to the Ginkgo server", func() {
|
||||
Ω(poster.posts).Should(HaveLen(1))
|
||||
Ω(poster.posts[0].url).Should(Equal("http://127.0.0.1:7788/BeforeSuiteDidRun"))
|
||||
Ω(poster.posts[0].bodyType).Should(Equal("application/json"))
|
||||
|
||||
var summary *types.SetupSummary
|
||||
err := json.Unmarshal(poster.posts[0].bodyContent, &summary)
|
||||
Ω(err).ShouldNot(HaveOccurred())
|
||||
setupSummary.CapturedOutput = interceptor.InterceptedOutput
|
||||
Ω(summary).Should(Equal(setupSummary))
|
||||
})
|
||||
})
|
||||
|
||||
Context("when an AfterSuite completes", func() {
|
||||
BeforeEach(func() {
|
||||
reporter.AfterSuiteDidRun(setupSummary)
|
||||
})
|
||||
|
||||
It("should stop, then start intercepting output", func() {
|
||||
Ω(interceptor.DidStopInterceptingOutput).Should(BeTrue())
|
||||
Ω(interceptor.DidStartInterceptingOutput).Should(BeTrue())
|
||||
})
|
||||
|
||||
It("should POST the SetupSummary to the Ginkgo server", func() {
|
||||
Ω(poster.posts).Should(HaveLen(1))
|
||||
Ω(poster.posts[0].url).Should(Equal("http://127.0.0.1:7788/AfterSuiteDidRun"))
|
||||
Ω(poster.posts[0].bodyType).Should(Equal("application/json"))
|
||||
|
||||
var summary *types.SetupSummary
|
||||
err := json.Unmarshal(poster.posts[0].bodyContent, &summary)
|
||||
Ω(err).ShouldNot(HaveOccurred())
|
||||
setupSummary.CapturedOutput = interceptor.InterceptedOutput
|
||||
Ω(summary).Should(Equal(setupSummary))
|
||||
})
|
||||
})
|
||||
|
||||
Context("When a spec will run", func() {
|
||||
BeforeEach(func() {
|
||||
reporter.SpecWillRun(specSummary)
|
||||
})
|
||||
|
||||
It("should POST the SpecSummary to the Ginkgo server", func() {
|
||||
Ω(poster.posts).Should(HaveLen(1))
|
||||
Ω(poster.posts[0].url).Should(Equal("http://127.0.0.1:7788/SpecWillRun"))
|
||||
Ω(poster.posts[0].bodyType).Should(Equal("application/json"))
|
||||
|
||||
var summary *types.SpecSummary
|
||||
err := json.Unmarshal(poster.posts[0].bodyContent, &summary)
|
||||
Ω(err).ShouldNot(HaveOccurred())
|
||||
Ω(summary).Should(Equal(specSummary))
|
||||
})
|
||||
|
||||
Context("When a spec completes", func() {
|
||||
BeforeEach(func() {
|
||||
specSummary.State = types.SpecStatePanicked
|
||||
reporter.SpecDidComplete(specSummary)
|
||||
})
|
||||
|
||||
It("should POST the SpecSummary to the Ginkgo server and include any intercepted output", func() {
|
||||
Ω(poster.posts).Should(HaveLen(2))
|
||||
Ω(poster.posts[1].url).Should(Equal("http://127.0.0.1:7788/SpecDidComplete"))
|
||||
Ω(poster.posts[1].bodyType).Should(Equal("application/json"))
|
||||
|
||||
var summary *types.SpecSummary
|
||||
err := json.Unmarshal(poster.posts[1].bodyContent, &summary)
|
||||
Ω(err).ShouldNot(HaveOccurred())
|
||||
specSummary.CapturedOutput = interceptor.InterceptedOutput
|
||||
Ω(summary).Should(Equal(specSummary))
|
||||
})
|
||||
|
||||
It("should stop, then start intercepting output", func() {
|
||||
Ω(interceptor.DidStopInterceptingOutput).Should(BeTrue())
|
||||
Ω(interceptor.DidStartInterceptingOutput).Should(BeTrue())
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Context("When a suite ends", func() {
|
||||
BeforeEach(func() {
|
||||
reporter.SpecSuiteDidEnd(suiteSummary)
|
||||
})
|
||||
|
||||
It("should POST the SuiteSummary to the Ginkgo server", func() {
|
||||
Ω(poster.posts).Should(HaveLen(1))
|
||||
Ω(poster.posts[0].url).Should(Equal("http://127.0.0.1:7788/SpecSuiteDidEnd"))
|
||||
Ω(poster.posts[0].bodyType).Should(Equal("application/json"))
|
||||
|
||||
var summary *types.SuiteSummary
|
||||
|
||||
err := json.Unmarshal(poster.posts[0].bodyContent, &summary)
|
||||
Ω(err).ShouldNot(HaveOccurred())
|
||||
|
||||
Ω(summary).Should(Equal(suiteSummary))
|
||||
})
|
||||
})
|
||||
})
|
||||
2
vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_unix.go
generated
vendored
2
vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_unix.go
generated
vendored
@@ -1,4 +1,4 @@
|
||||
// +build freebsd openbsd netbsd dragonfly darwin linux
|
||||
// +build freebsd openbsd netbsd dragonfly darwin linux solaris
|
||||
|
||||
package remote
|
||||
|
||||
|
||||
13
vendor/github.com/onsi/ginkgo/internal/remote/remote_suite_test.go
generated
vendored
13
vendor/github.com/onsi/ginkgo/internal/remote/remote_suite_test.go
generated
vendored
@@ -1,13 +0,0 @@
|
||||
package remote_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestRemote(t *testing.T) {
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(t, "Remote Spec Forwarding Suite")
|
||||
}
|
||||
26
vendor/github.com/onsi/ginkgo/internal/remote/server.go
generated
vendored
26
vendor/github.com/onsi/ginkgo/internal/remote/server.go
generated
vendored
@@ -9,13 +9,16 @@ package remote
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/onsi/ginkgo/config"
|
||||
"github.com/onsi/ginkgo/reporters"
|
||||
"github.com/onsi/ginkgo/types"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
"sync"
|
||||
|
||||
"github.com/onsi/ginkgo/internal/spec_iterator"
|
||||
|
||||
"github.com/onsi/ginkgo/config"
|
||||
"github.com/onsi/ginkgo/reporters"
|
||||
"github.com/onsi/ginkgo/types"
|
||||
)
|
||||
|
||||
/*
|
||||
@@ -29,6 +32,7 @@ type Server struct {
|
||||
lock *sync.Mutex
|
||||
beforeSuiteData types.RemoteBeforeSuiteData
|
||||
parallelTotal int
|
||||
counter int
|
||||
}
|
||||
|
||||
//Create a new server, automatically selecting a port
|
||||
@@ -63,6 +67,8 @@ func (server *Server) Start() {
|
||||
//synchronization endpoints
|
||||
mux.HandleFunc("/BeforeSuiteState", server.handleBeforeSuiteState)
|
||||
mux.HandleFunc("/RemoteAfterSuiteData", server.handleRemoteAfterSuiteData)
|
||||
mux.HandleFunc("/counter", server.handleCounter)
|
||||
mux.HandleFunc("/has-counter", server.handleHasCounter) //for backward compatibility
|
||||
|
||||
go httpServer.Serve(server.listener)
|
||||
}
|
||||
@@ -202,3 +208,17 @@ func (server *Server) handleRemoteAfterSuiteData(writer http.ResponseWriter, req
|
||||
enc := json.NewEncoder(writer)
|
||||
enc.Encode(afterSuiteData)
|
||||
}
|
||||
|
||||
func (server *Server) handleCounter(writer http.ResponseWriter, request *http.Request) {
|
||||
c := spec_iterator.Counter{}
|
||||
server.lock.Lock()
|
||||
c.Index = server.counter
|
||||
server.counter = server.counter + 1
|
||||
server.lock.Unlock()
|
||||
|
||||
json.NewEncoder(writer).Encode(c)
|
||||
}
|
||||
|
||||
func (server *Server) handleHasCounter(writer http.ResponseWriter, request *http.Request) {
|
||||
writer.Write([]byte(""))
|
||||
}
|
||||
|
||||
269
vendor/github.com/onsi/ginkgo/internal/remote/server_test.go
generated
vendored
269
vendor/github.com/onsi/ginkgo/internal/remote/server_test.go
generated
vendored
@@ -1,269 +0,0 @@
|
||||
package remote_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/ginkgo/internal/remote"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"github.com/onsi/ginkgo/config"
|
||||
"github.com/onsi/ginkgo/reporters"
|
||||
"github.com/onsi/ginkgo/types"
|
||||
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
var _ = Describe("Server", func() {
|
||||
var (
|
||||
server *Server
|
||||
)
|
||||
|
||||
BeforeEach(func() {
|
||||
var err error
|
||||
server, err = NewServer(3)
|
||||
Ω(err).ShouldNot(HaveOccurred())
|
||||
|
||||
server.Start()
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
server.Close()
|
||||
})
|
||||
|
||||
Describe("Streaming endpoints", func() {
|
||||
var (
|
||||
reporterA, reporterB *reporters.FakeReporter
|
||||
forwardingReporter *ForwardingReporter
|
||||
|
||||
suiteSummary *types.SuiteSummary
|
||||
setupSummary *types.SetupSummary
|
||||
specSummary *types.SpecSummary
|
||||
)
|
||||
|
||||
BeforeEach(func() {
|
||||
reporterA = reporters.NewFakeReporter()
|
||||
reporterB = reporters.NewFakeReporter()
|
||||
|
||||
server.RegisterReporters(reporterA, reporterB)
|
||||
|
||||
forwardingReporter = NewForwardingReporter(server.Address(), &http.Client{}, &fakeOutputInterceptor{})
|
||||
|
||||
suiteSummary = &types.SuiteSummary{
|
||||
SuiteDescription: "My Test Suite",
|
||||
}
|
||||
|
||||
setupSummary = &types.SetupSummary{
|
||||
State: types.SpecStatePassed,
|
||||
}
|
||||
|
||||
specSummary = &types.SpecSummary{
|
||||
ComponentTexts: []string{"My", "Spec"},
|
||||
State: types.SpecStatePassed,
|
||||
}
|
||||
})
|
||||
|
||||
It("should make its address available", func() {
|
||||
Ω(server.Address()).Should(MatchRegexp(`http://127.0.0.1:\d{2,}`))
|
||||
})
|
||||
|
||||
Describe("/SpecSuiteWillBegin", func() {
|
||||
It("should decode and forward the Ginkgo config and suite summary", func(done Done) {
|
||||
forwardingReporter.SpecSuiteWillBegin(config.GinkgoConfig, suiteSummary)
|
||||
Ω(reporterA.Config).Should(Equal(config.GinkgoConfig))
|
||||
Ω(reporterB.Config).Should(Equal(config.GinkgoConfig))
|
||||
Ω(reporterA.BeginSummary).Should(Equal(suiteSummary))
|
||||
Ω(reporterB.BeginSummary).Should(Equal(suiteSummary))
|
||||
close(done)
|
||||
})
|
||||
})
|
||||
|
||||
Describe("/BeforeSuiteDidRun", func() {
|
||||
It("should decode and forward the setup summary", func() {
|
||||
forwardingReporter.BeforeSuiteDidRun(setupSummary)
|
||||
Ω(reporterA.BeforeSuiteSummary).Should(Equal(setupSummary))
|
||||
Ω(reporterB.BeforeSuiteSummary).Should(Equal(setupSummary))
|
||||
})
|
||||
})
|
||||
|
||||
Describe("/AfterSuiteDidRun", func() {
|
||||
It("should decode and forward the setup summary", func() {
|
||||
forwardingReporter.AfterSuiteDidRun(setupSummary)
|
||||
Ω(reporterA.AfterSuiteSummary).Should(Equal(setupSummary))
|
||||
Ω(reporterB.AfterSuiteSummary).Should(Equal(setupSummary))
|
||||
})
|
||||
})
|
||||
|
||||
Describe("/SpecWillRun", func() {
|
||||
It("should decode and forward the spec summary", func(done Done) {
|
||||
forwardingReporter.SpecWillRun(specSummary)
|
||||
Ω(reporterA.SpecWillRunSummaries[0]).Should(Equal(specSummary))
|
||||
Ω(reporterB.SpecWillRunSummaries[0]).Should(Equal(specSummary))
|
||||
close(done)
|
||||
})
|
||||
})
|
||||
|
||||
Describe("/SpecDidComplete", func() {
|
||||
It("should decode and forward the spec summary", func(done Done) {
|
||||
forwardingReporter.SpecDidComplete(specSummary)
|
||||
Ω(reporterA.SpecSummaries[0]).Should(Equal(specSummary))
|
||||
Ω(reporterB.SpecSummaries[0]).Should(Equal(specSummary))
|
||||
close(done)
|
||||
})
|
||||
})
|
||||
|
||||
Describe("/SpecSuiteDidEnd", func() {
|
||||
It("should decode and forward the suite summary", func(done Done) {
|
||||
forwardingReporter.SpecSuiteDidEnd(suiteSummary)
|
||||
Ω(reporterA.EndSummary).Should(Equal(suiteSummary))
|
||||
Ω(reporterB.EndSummary).Should(Equal(suiteSummary))
|
||||
close(done)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Describe("Synchronization endpoints", func() {
|
||||
Describe("GETting and POSTing BeforeSuiteState", func() {
|
||||
getBeforeSuite := func() types.RemoteBeforeSuiteData {
|
||||
resp, err := http.Get(server.Address() + "/BeforeSuiteState")
|
||||
Ω(err).ShouldNot(HaveOccurred())
|
||||
Ω(resp.StatusCode).Should(Equal(http.StatusOK))
|
||||
|
||||
r := types.RemoteBeforeSuiteData{}
|
||||
decoder := json.NewDecoder(resp.Body)
|
||||
err = decoder.Decode(&r)
|
||||
Ω(err).ShouldNot(HaveOccurred())
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
postBeforeSuite := func(r types.RemoteBeforeSuiteData) {
|
||||
resp, err := http.Post(server.Address()+"/BeforeSuiteState", "application/json", bytes.NewReader(r.ToJSON()))
|
||||
Ω(err).ShouldNot(HaveOccurred())
|
||||
Ω(resp.StatusCode).Should(Equal(http.StatusOK))
|
||||
}
|
||||
|
||||
Context("when the first node's Alive has not been registered yet", func() {
|
||||
It("should return pending", func() {
|
||||
state := getBeforeSuite()
|
||||
Ω(state).Should(Equal(types.RemoteBeforeSuiteData{nil, types.RemoteBeforeSuiteStatePending}))
|
||||
|
||||
state = getBeforeSuite()
|
||||
Ω(state).Should(Equal(types.RemoteBeforeSuiteData{nil, types.RemoteBeforeSuiteStatePending}))
|
||||
})
|
||||
})
|
||||
|
||||
Context("when the first node is Alive but has not responded yet", func() {
|
||||
BeforeEach(func() {
|
||||
server.RegisterAlive(1, func() bool {
|
||||
return true
|
||||
})
|
||||
})
|
||||
|
||||
It("should return pending", func() {
|
||||
state := getBeforeSuite()
|
||||
Ω(state).Should(Equal(types.RemoteBeforeSuiteData{nil, types.RemoteBeforeSuiteStatePending}))
|
||||
|
||||
state = getBeforeSuite()
|
||||
Ω(state).Should(Equal(types.RemoteBeforeSuiteData{nil, types.RemoteBeforeSuiteStatePending}))
|
||||
})
|
||||
})
|
||||
|
||||
Context("when the first node has responded", func() {
|
||||
var state types.RemoteBeforeSuiteData
|
||||
BeforeEach(func() {
|
||||
server.RegisterAlive(1, func() bool {
|
||||
return false
|
||||
})
|
||||
|
||||
state = types.RemoteBeforeSuiteData{
|
||||
Data: []byte("my data"),
|
||||
State: types.RemoteBeforeSuiteStatePassed,
|
||||
}
|
||||
postBeforeSuite(state)
|
||||
})
|
||||
|
||||
It("should return the passed in state", func() {
|
||||
returnedState := getBeforeSuite()
|
||||
Ω(returnedState).Should(Equal(state))
|
||||
})
|
||||
})
|
||||
|
||||
Context("when the first node is no longer Alive and has not responded yet", func() {
|
||||
BeforeEach(func() {
|
||||
server.RegisterAlive(1, func() bool {
|
||||
return false
|
||||
})
|
||||
})
|
||||
|
||||
It("should return disappeared", func() {
|
||||
state := getBeforeSuite()
|
||||
Ω(state).Should(Equal(types.RemoteBeforeSuiteData{nil, types.RemoteBeforeSuiteStateDisappeared}))
|
||||
|
||||
state = getBeforeSuite()
|
||||
Ω(state).Should(Equal(types.RemoteBeforeSuiteData{nil, types.RemoteBeforeSuiteStateDisappeared}))
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Describe("GETting RemoteAfterSuiteData", func() {
|
||||
getRemoteAfterSuiteData := func() bool {
|
||||
resp, err := http.Get(server.Address() + "/RemoteAfterSuiteData")
|
||||
Ω(err).ShouldNot(HaveOccurred())
|
||||
Ω(resp.StatusCode).Should(Equal(http.StatusOK))
|
||||
|
||||
a := types.RemoteAfterSuiteData{}
|
||||
decoder := json.NewDecoder(resp.Body)
|
||||
err = decoder.Decode(&a)
|
||||
Ω(err).ShouldNot(HaveOccurred())
|
||||
|
||||
return a.CanRun
|
||||
}
|
||||
|
||||
Context("when there are unregistered nodes", func() {
|
||||
BeforeEach(func() {
|
||||
server.RegisterAlive(2, func() bool {
|
||||
return false
|
||||
})
|
||||
})
|
||||
|
||||
It("should return false", func() {
|
||||
Ω(getRemoteAfterSuiteData()).Should(BeFalse())
|
||||
})
|
||||
})
|
||||
|
||||
Context("when all none-node-1 nodes are still running", func() {
|
||||
BeforeEach(func() {
|
||||
server.RegisterAlive(2, func() bool {
|
||||
return true
|
||||
})
|
||||
|
||||
server.RegisterAlive(3, func() bool {
|
||||
return false
|
||||
})
|
||||
})
|
||||
|
||||
It("should return false", func() {
|
||||
Ω(getRemoteAfterSuiteData()).Should(BeFalse())
|
||||
})
|
||||
})
|
||||
|
||||
Context("when all none-1 nodes are done", func() {
|
||||
BeforeEach(func() {
|
||||
server.RegisterAlive(2, func() bool {
|
||||
return false
|
||||
})
|
||||
|
||||
server.RegisterAlive(3, func() bool {
|
||||
return false
|
||||
})
|
||||
})
|
||||
|
||||
It("should return true", func() {
|
||||
Ω(getRemoteAfterSuiteData()).Should(BeTrue())
|
||||
})
|
||||
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
2
vendor/github.com/onsi/ginkgo/internal/remote/syscall_dup_linux_arm64.go
generated
vendored
2
vendor/github.com/onsi/ginkgo/internal/remote/syscall_dup_linux_arm64.go
generated
vendored
@@ -8,4 +8,4 @@ import "syscall"
|
||||
// use the nearly identical syscall.Dup3 instead
|
||||
func syscallDup(oldfd int, newfd int) (err error) {
|
||||
return syscall.Dup3(oldfd, newfd, 0)
|
||||
}
|
||||
}
|
||||
9
vendor/github.com/onsi/ginkgo/internal/remote/syscall_dup_solaris.go
generated
vendored
Normal file
9
vendor/github.com/onsi/ginkgo/internal/remote/syscall_dup_solaris.go
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
// +build solaris
|
||||
|
||||
package remote
|
||||
|
||||
import "golang.org/x/sys/unix"
|
||||
|
||||
func syscallDup(oldfd int, newfd int) (err error) {
|
||||
return unix.Dup2(oldfd, newfd)
|
||||
}
|
||||
3
vendor/github.com/onsi/ginkgo/internal/remote/syscall_dup_unix.go
generated
vendored
3
vendor/github.com/onsi/ginkgo/internal/remote/syscall_dup_unix.go
generated
vendored
@@ -1,5 +1,6 @@
|
||||
// +build !linux !arm64
|
||||
// +build !windows
|
||||
// +build !solaris
|
||||
|
||||
package remote
|
||||
|
||||
@@ -7,4 +8,4 @@ import "syscall"
|
||||
|
||||
func syscallDup(oldfd int, newfd int) (err error) {
|
||||
return syscall.Dup2(oldfd, newfd)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user