mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-10 15:20:56 +00:00
65aaa607ab
Change made by: - running "gvt fetch" on each of the packages mentioned in Godeps/Godeps.json - `rm -rf Godeps` - tweaking the build scripts to not mention Godeps - tweaking the build scripts to test `./lib/...`, `./cmd/...` explicitly (to avoid testing vendor) - tweaking the build scripts to not juggle GOPATH for Godeps and instead set GO15VENDOREXPERIMENT. This also results in some updated packages at the same time I bet. Building with Go 1.3 and 1.4 still *works* but won't use our vendored dependencies - the user needs to have the actual packages in their GOPATH then, which they'll get with a normal "go get". Building with Go 1.6+ will get our vendored dependencies by default even when not using our build script, which is nice. By doing this we gain some freedom in that we can pick and choose manually what to include in vendor, as it's not based on just dependency analysis of our own code. This is also a risk as we might pick up dependencies we are unaware of, as the build may work locally with those packages present in GOPATH. On the other hand the build server will detect this as it has no packages in it's GOPATH beyond what is included in the repo. Recommended tool to manage dependencies is github.com/FiloSottile/gvt.
142 lines
4.5 KiB
Go
142 lines
4.5 KiB
Go
package failer_test
|
|
|
|
import (
|
|
. "github.com/onsi/ginkgo"
|
|
. "github.com/onsi/ginkgo/internal/failer"
|
|
. "github.com/onsi/gomega"
|
|
|
|
"github.com/onsi/ginkgo/internal/codelocation"
|
|
"github.com/onsi/ginkgo/types"
|
|
)
|
|
|
|
var _ = Describe("Failer", func() {
|
|
var (
|
|
failer *Failer
|
|
codeLocationA types.CodeLocation
|
|
codeLocationB types.CodeLocation
|
|
)
|
|
|
|
BeforeEach(func() {
|
|
codeLocationA = codelocation.New(0)
|
|
codeLocationB = codelocation.New(0)
|
|
failer = New()
|
|
})
|
|
|
|
Context("with no failures", func() {
|
|
It("should return success when drained", func() {
|
|
failure, state := failer.Drain(types.SpecComponentTypeIt, 3, codeLocationB)
|
|
Ω(failure).Should(BeZero())
|
|
Ω(state).Should(Equal(types.SpecStatePassed))
|
|
})
|
|
})
|
|
|
|
Describe("Skip", func() {
|
|
It("should handle failures", func() {
|
|
failer.Skip("something skipped", codeLocationA)
|
|
failure, state := failer.Drain(types.SpecComponentTypeIt, 3, codeLocationB)
|
|
Ω(failure).Should(Equal(types.SpecFailure{
|
|
Message: "something skipped",
|
|
Location: codeLocationA,
|
|
ForwardedPanic: "",
|
|
ComponentType: types.SpecComponentTypeIt,
|
|
ComponentIndex: 3,
|
|
ComponentCodeLocation: codeLocationB,
|
|
}))
|
|
Ω(state).Should(Equal(types.SpecStateSkipped))
|
|
})
|
|
})
|
|
|
|
Describe("Fail", func() {
|
|
It("should handle failures", func() {
|
|
failer.Fail("something failed", codeLocationA)
|
|
failure, state := failer.Drain(types.SpecComponentTypeIt, 3, codeLocationB)
|
|
Ω(failure).Should(Equal(types.SpecFailure{
|
|
Message: "something failed",
|
|
Location: codeLocationA,
|
|
ForwardedPanic: "",
|
|
ComponentType: types.SpecComponentTypeIt,
|
|
ComponentIndex: 3,
|
|
ComponentCodeLocation: codeLocationB,
|
|
}))
|
|
Ω(state).Should(Equal(types.SpecStateFailed))
|
|
})
|
|
})
|
|
|
|
Describe("Panic", func() {
|
|
It("should handle panics", func() {
|
|
failer.Panic(codeLocationA, "some forwarded panic")
|
|
failure, state := failer.Drain(types.SpecComponentTypeIt, 3, codeLocationB)
|
|
Ω(failure).Should(Equal(types.SpecFailure{
|
|
Message: "Test Panicked",
|
|
Location: codeLocationA,
|
|
ForwardedPanic: "some forwarded panic",
|
|
ComponentType: types.SpecComponentTypeIt,
|
|
ComponentIndex: 3,
|
|
ComponentCodeLocation: codeLocationB,
|
|
}))
|
|
Ω(state).Should(Equal(types.SpecStatePanicked))
|
|
})
|
|
})
|
|
|
|
Describe("Timeout", func() {
|
|
It("should handle timeouts", func() {
|
|
failer.Timeout(codeLocationA)
|
|
failure, state := failer.Drain(types.SpecComponentTypeIt, 3, codeLocationB)
|
|
Ω(failure).Should(Equal(types.SpecFailure{
|
|
Message: "Timed out",
|
|
Location: codeLocationA,
|
|
ForwardedPanic: "",
|
|
ComponentType: types.SpecComponentTypeIt,
|
|
ComponentIndex: 3,
|
|
ComponentCodeLocation: codeLocationB,
|
|
}))
|
|
Ω(state).Should(Equal(types.SpecStateTimedOut))
|
|
})
|
|
})
|
|
|
|
Context("when multiple failures are registered", func() {
|
|
BeforeEach(func() {
|
|
failer.Fail("something failed", codeLocationA)
|
|
failer.Fail("something else failed", codeLocationA)
|
|
})
|
|
|
|
It("should only report the first one when drained", func() {
|
|
failure, state := failer.Drain(types.SpecComponentTypeIt, 3, codeLocationB)
|
|
|
|
Ω(failure).Should(Equal(types.SpecFailure{
|
|
Message: "something failed",
|
|
Location: codeLocationA,
|
|
ForwardedPanic: "",
|
|
ComponentType: types.SpecComponentTypeIt,
|
|
ComponentIndex: 3,
|
|
ComponentCodeLocation: codeLocationB,
|
|
}))
|
|
Ω(state).Should(Equal(types.SpecStateFailed))
|
|
})
|
|
|
|
It("should report subsequent failures after being drained", func() {
|
|
failer.Drain(types.SpecComponentTypeIt, 3, codeLocationB)
|
|
failer.Fail("yet another thing failed", codeLocationA)
|
|
|
|
failure, state := failer.Drain(types.SpecComponentTypeIt, 3, codeLocationB)
|
|
|
|
Ω(failure).Should(Equal(types.SpecFailure{
|
|
Message: "yet another thing failed",
|
|
Location: codeLocationA,
|
|
ForwardedPanic: "",
|
|
ComponentType: types.SpecComponentTypeIt,
|
|
ComponentIndex: 3,
|
|
ComponentCodeLocation: codeLocationB,
|
|
}))
|
|
Ω(state).Should(Equal(types.SpecStateFailed))
|
|
})
|
|
|
|
It("should report sucess on subsequent drains if no errors occur", func() {
|
|
failer.Drain(types.SpecComponentTypeIt, 3, codeLocationB)
|
|
failure, state := failer.Drain(types.SpecComponentTypeIt, 3, codeLocationB)
|
|
Ω(failure).Should(BeZero())
|
|
Ω(state).Should(Equal(types.SpecStatePassed))
|
|
})
|
|
})
|
|
})
|