Use Go 1.5 vendoring instead of Godeps
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.
This commit is contained in:
92
vendor/github.com/onsi/ginkgo/internal/failer/failer.go
generated
vendored
Normal file
92
vendor/github.com/onsi/ginkgo/internal/failer/failer.go
generated
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
package failer
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"github.com/onsi/ginkgo/types"
|
||||
)
|
||||
|
||||
type Failer struct {
|
||||
lock *sync.Mutex
|
||||
failure types.SpecFailure
|
||||
state types.SpecState
|
||||
}
|
||||
|
||||
func New() *Failer {
|
||||
return &Failer{
|
||||
lock: &sync.Mutex{},
|
||||
state: types.SpecStatePassed,
|
||||
}
|
||||
}
|
||||
|
||||
func (f *Failer) Panic(location types.CodeLocation, forwardedPanic interface{}) {
|
||||
f.lock.Lock()
|
||||
defer f.lock.Unlock()
|
||||
|
||||
if f.state == types.SpecStatePassed {
|
||||
f.state = types.SpecStatePanicked
|
||||
f.failure = types.SpecFailure{
|
||||
Message: "Test Panicked",
|
||||
Location: location,
|
||||
ForwardedPanic: fmt.Sprintf("%v", forwardedPanic),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (f *Failer) Timeout(location types.CodeLocation) {
|
||||
f.lock.Lock()
|
||||
defer f.lock.Unlock()
|
||||
|
||||
if f.state == types.SpecStatePassed {
|
||||
f.state = types.SpecStateTimedOut
|
||||
f.failure = types.SpecFailure{
|
||||
Message: "Timed out",
|
||||
Location: location,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (f *Failer) Fail(message string, location types.CodeLocation) {
|
||||
f.lock.Lock()
|
||||
defer f.lock.Unlock()
|
||||
|
||||
if f.state == types.SpecStatePassed {
|
||||
f.state = types.SpecStateFailed
|
||||
f.failure = types.SpecFailure{
|
||||
Message: message,
|
||||
Location: location,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (f *Failer) Drain(componentType types.SpecComponentType, componentIndex int, componentCodeLocation types.CodeLocation) (types.SpecFailure, types.SpecState) {
|
||||
f.lock.Lock()
|
||||
defer f.lock.Unlock()
|
||||
|
||||
failure := f.failure
|
||||
outcome := f.state
|
||||
if outcome != types.SpecStatePassed {
|
||||
failure.ComponentType = componentType
|
||||
failure.ComponentIndex = componentIndex
|
||||
failure.ComponentCodeLocation = componentCodeLocation
|
||||
}
|
||||
|
||||
f.state = types.SpecStatePassed
|
||||
f.failure = types.SpecFailure{}
|
||||
|
||||
return failure, outcome
|
||||
}
|
||||
|
||||
func (f *Failer) Skip(message string, location types.CodeLocation) {
|
||||
f.lock.Lock()
|
||||
defer f.lock.Unlock()
|
||||
|
||||
if f.state == types.SpecStatePassed {
|
||||
f.state = types.SpecStateSkipped
|
||||
f.failure = types.SpecFailure{
|
||||
Message: message,
|
||||
Location: location,
|
||||
}
|
||||
}
|
||||
}
|
||||
13
vendor/github.com/onsi/ginkgo/internal/failer/failer_suite_test.go
generated
vendored
Normal file
13
vendor/github.com/onsi/ginkgo/internal/failer/failer_suite_test.go
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
package failer_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestFailer(t *testing.T) {
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(t, "Failer Suite")
|
||||
}
|
||||
141
vendor/github.com/onsi/ginkgo/internal/failer/failer_test.go
generated
vendored
Normal file
141
vendor/github.com/onsi/ginkgo/internal/failer/failer_test.go
generated
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
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))
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user