Merge pull request #6445 from containers/dependabot/go_modules/github.com/onsi/ginkgo-1.12.3

Bump github.com/onsi/ginkgo from 1.12.2 to 1.12.3
This commit is contained in:
OpenShift Merge Robot 2020-06-02 09:02:08 -04:00 committed by GitHub
commit 2937151e37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 121 additions and 84 deletions

2
go.mod
View File

@ -35,7 +35,7 @@ require (
github.com/hpcloud/tail v1.0.0 github.com/hpcloud/tail v1.0.0
github.com/json-iterator/go v1.1.9 github.com/json-iterator/go v1.1.9
github.com/mrunalp/fileutils v0.0.0-20171103030105-7d4729fb3618 github.com/mrunalp/fileutils v0.0.0-20171103030105-7d4729fb3618
github.com/onsi/ginkgo v1.12.2 github.com/onsi/ginkgo v1.12.3
github.com/onsi/gomega v1.10.1 github.com/onsi/gomega v1.10.1
github.com/opencontainers/go-digest v1.0.0 github.com/opencontainers/go-digest v1.0.0
github.com/opencontainers/image-spec v1.0.2-0.20190823105129-775207bd45b6 github.com/opencontainers/image-spec v1.0.2-0.20190823105129-775207bd45b6

2
go.sum
View File

@ -316,6 +316,8 @@ github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
github.com/onsi/ginkgo v1.12.2 h1:Ke9m3h2Hu0wsZ45yewCqhYr3Z+emcNTuLY2nMWCkrSI= github.com/onsi/ginkgo v1.12.2 h1:Ke9m3h2Hu0wsZ45yewCqhYr3Z+emcNTuLY2nMWCkrSI=
github.com/onsi/ginkgo v1.12.2/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/ginkgo v1.12.2/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY=
github.com/onsi/ginkgo v1.12.3 h1:+RYp9QczoWz9zfUyLP/5SLXQVhfr6gZOoKGfQqHuLZQ=
github.com/onsi/ginkgo v1.12.3/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY=
github.com/onsi/gomega v0.0.0-20151007035656-2152b45fa28a/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v0.0.0-20151007035656-2152b45fa28a/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
github.com/onsi/gomega v0.0.0-20190113212917-5533ce8a0da3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v0.0.0-20190113212917-5533ce8a0da3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=

View File

@ -1,3 +1,8 @@
## 1.12.3
### Fixes
- Print correct code location of failing table test (#666) [c6d7afb]
## 1.12.2 ## 1.12.2
### Fixes ### Fixes

View File

@ -4,7 +4,23 @@
Jump to the [docs](https://onsi.github.io/ginkgo/) to learn more. To start rolling your Ginkgo tests *now* [keep reading](#set-me-up)! Jump to the [docs](https://onsi.github.io/ginkgo/) to learn more. To start rolling your Ginkgo tests *now* [keep reading](#set-me-up)!
If you have a question, comment, bug report, feature request, etc. please open a GitHub issue. If you have a question, comment, bug report, feature request, etc. please open a GitHub issue, or visit the [Ginkgo Slack channel](https://app.slack.com/client/T029RQSE6/CQQ50BBNW).
## TLDR
Ginkgo builds on Go's `testing` package, allowing expressive [Behavior-Driven Development](https://en.wikipedia.org/wiki/Behavior-driven_development) ("BDD") style tests.
It is typically (and optionally) paired with the [Gomega](https://github.com/onsi/gomega) matcher library.
```go
Describe("the strings package", func() {
Context("strings.Contains()", func() {
When("the string contains the substring in the middle", func() {
It("returns `true`", func() {
Expect(strings.Contains("Ginkgo is awesome", "is")).To(BeTrue())
})
})
})
})
```
## Feature List ## Feature List

View File

@ -20,7 +20,7 @@ import (
"fmt" "fmt"
) )
const VERSION = "1.12.2" const VERSION = "1.12.3"
type GinkgoConfigType struct { type GinkgoConfigType struct {
RandomSeed int64 RandomSeed int64

View File

@ -12,7 +12,9 @@ import (
"fmt" "fmt"
"reflect" "reflect"
"github.com/onsi/ginkgo" "github.com/onsi/ginkgo/internal/codelocation"
"github.com/onsi/ginkgo/internal/global"
"github.com/onsi/ginkgo/types"
) )
/* /*
@ -42,7 +44,7 @@ It's important to understand that the `Describe`s and `It`s are generated at eva
Individual Entries can be focused (with FEntry) or marked pending (with PEntry or XEntry). In addition, the entire table can be focused or marked pending with FDescribeTable and PDescribeTable/XDescribeTable. Individual Entries can be focused (with FEntry) or marked pending (with PEntry or XEntry). In addition, the entire table can be focused or marked pending with FDescribeTable and PDescribeTable/XDescribeTable.
*/ */
func DescribeTable(description string, itBody interface{}, entries ...TableEntry) bool { func DescribeTable(description string, itBody interface{}, entries ...TableEntry) bool {
describeTable(description, itBody, entries, false, false) describeTable(description, itBody, entries, types.FlagTypeNone)
return true return true
} }
@ -50,7 +52,7 @@ func DescribeTable(description string, itBody interface{}, entries ...TableEntry
You can focus a table with `FDescribeTable`. This is equivalent to `FDescribe`. You can focus a table with `FDescribeTable`. This is equivalent to `FDescribe`.
*/ */
func FDescribeTable(description string, itBody interface{}, entries ...TableEntry) bool { func FDescribeTable(description string, itBody interface{}, entries ...TableEntry) bool {
describeTable(description, itBody, entries, false, true) describeTable(description, itBody, entries, types.FlagTypeFocused)
return true return true
} }
@ -58,7 +60,7 @@ func FDescribeTable(description string, itBody interface{}, entries ...TableEntr
You can mark a table as pending with `PDescribeTable`. This is equivalent to `PDescribe`. You can mark a table as pending with `PDescribeTable`. This is equivalent to `PDescribe`.
*/ */
func PDescribeTable(description string, itBody interface{}, entries ...TableEntry) bool { func PDescribeTable(description string, itBody interface{}, entries ...TableEntry) bool {
describeTable(description, itBody, entries, true, false) describeTable(description, itBody, entries, types.FlagTypePending)
return true return true
} }
@ -66,33 +68,24 @@ func PDescribeTable(description string, itBody interface{}, entries ...TableEntr
You can mark a table as pending with `XDescribeTable`. This is equivalent to `XDescribe`. You can mark a table as pending with `XDescribeTable`. This is equivalent to `XDescribe`.
*/ */
func XDescribeTable(description string, itBody interface{}, entries ...TableEntry) bool { func XDescribeTable(description string, itBody interface{}, entries ...TableEntry) bool {
describeTable(description, itBody, entries, true, false) describeTable(description, itBody, entries, types.FlagTypePending)
return true return true
} }
func describeTable(description string, itBody interface{}, entries []TableEntry, pending bool, focused bool) { func describeTable(description string, itBody interface{}, entries []TableEntry, flag types.FlagType) {
itBodyValue := reflect.ValueOf(itBody) itBodyValue := reflect.ValueOf(itBody)
if itBodyValue.Kind() != reflect.Func { if itBodyValue.Kind() != reflect.Func {
panic(fmt.Sprintf("DescribeTable expects a function, got %#v", itBody)) panic(fmt.Sprintf("DescribeTable expects a function, got %#v", itBody))
} }
if pending { global.Suite.PushContainerNode(
ginkgo.PDescribe(description, func() { description,
func() {
for _, entry := range entries { for _, entry := range entries {
entry.generateIt(itBodyValue) entry.generateIt(itBodyValue)
} }
}) },
} else if focused { flag,
ginkgo.FDescribe(description, func() { codelocation.New(2),
for _, entry := range entries { )
entry.generateIt(itBodyValue)
}
})
} else {
ginkgo.Describe(description, func() {
for _, entry := range entries {
entry.generateIt(itBodyValue)
}
})
}
} }

View File

@ -3,22 +3,31 @@ package table
import ( import (
"reflect" "reflect"
"github.com/onsi/ginkgo" "github.com/onsi/ginkgo/internal/codelocation"
"github.com/onsi/ginkgo/internal/global"
"github.com/onsi/ginkgo/types"
) )
/* /*
TableEntry represents an entry in a table test. You generally use the `Entry` constructor. TableEntry represents an entry in a table test. You generally use the `Entry` constructor.
*/ */
type TableEntry struct { type TableEntry struct {
Description string Description string
Parameters []interface{} Parameters []interface{}
Pending bool Pending bool
Focused bool Focused bool
codeLocation types.CodeLocation
} }
func (t TableEntry) generateIt(itBody reflect.Value) { func (t TableEntry) generateIt(itBody reflect.Value) {
if t.codeLocation == (types.CodeLocation{}) {
// The user created the TableEntry struct directly instead of having used the (F/P/X)Entry constructors.
// Therefore default to the code location of the surrounding DescribeTable.
t.codeLocation = codelocation.New(5)
}
if t.Pending { if t.Pending {
ginkgo.PIt(t.Description) global.Suite.PushItNode(t.Description, func() {}, types.FlagTypePending, t.codeLocation, 0)
return return
} }
@ -38,9 +47,9 @@ func (t TableEntry) generateIt(itBody reflect.Value) {
} }
if t.Focused { if t.Focused {
ginkgo.FIt(t.Description, body) global.Suite.PushItNode(t.Description, body, types.FlagTypeFocused, t.codeLocation, global.DefaultTimeout)
} else { } else {
ginkgo.It(t.Description, body) global.Suite.PushItNode(t.Description, body, types.FlagTypeNone, t.codeLocation, global.DefaultTimeout)
} }
} }
@ -53,26 +62,26 @@ Subsequent parameters are saved off and sent to the callback passed in to `Descr
Each Entry ends up generating an individual Ginkgo It. Each Entry ends up generating an individual Ginkgo It.
*/ */
func Entry(description string, parameters ...interface{}) TableEntry { func Entry(description string, parameters ...interface{}) TableEntry {
return TableEntry{description, parameters, false, false} return TableEntry{description, parameters, false, false, codelocation.New(1)}
} }
/* /*
You can focus a particular entry with FEntry. This is equivalent to FIt. You can focus a particular entry with FEntry. This is equivalent to FIt.
*/ */
func FEntry(description string, parameters ...interface{}) TableEntry { func FEntry(description string, parameters ...interface{}) TableEntry {
return TableEntry{description, parameters, false, true} return TableEntry{description, parameters, false, true, codelocation.New(1)}
} }
/* /*
You can mark a particular entry as pending with PEntry. This is equivalent to PIt. You can mark a particular entry as pending with PEntry. This is equivalent to PIt.
*/ */
func PEntry(description string, parameters ...interface{}) TableEntry { func PEntry(description string, parameters ...interface{}) TableEntry {
return TableEntry{description, parameters, true, false} return TableEntry{description, parameters, true, false, codelocation.New(1)}
} }
/* /*
You can mark a particular entry as pending with XEntry. This is equivalent to XIt. You can mark a particular entry as pending with XEntry. This is equivalent to XIt.
*/ */
func XEntry(description string, parameters ...interface{}) TableEntry { func XEntry(description string, parameters ...interface{}) TableEntry {
return TableEntry{description, parameters, true, false} return TableEntry{description, parameters, true, false, codelocation.New(1)}
} }

View File

@ -22,9 +22,8 @@ import (
"github.com/onsi/ginkgo/config" "github.com/onsi/ginkgo/config"
"github.com/onsi/ginkgo/internal/codelocation" "github.com/onsi/ginkgo/internal/codelocation"
"github.com/onsi/ginkgo/internal/failer" "github.com/onsi/ginkgo/internal/global"
"github.com/onsi/ginkgo/internal/remote" "github.com/onsi/ginkgo/internal/remote"
"github.com/onsi/ginkgo/internal/suite"
"github.com/onsi/ginkgo/internal/testingtproxy" "github.com/onsi/ginkgo/internal/testingtproxy"
"github.com/onsi/ginkgo/internal/writer" "github.com/onsi/ginkgo/internal/writer"
"github.com/onsi/ginkgo/reporters" "github.com/onsi/ginkgo/reporters"
@ -46,16 +45,10 @@ To circumvent this, you should call
at the top of the goroutine that caused this panic. at the top of the goroutine that caused this panic.
` `
const defaultTimeout = 1
var globalSuite *suite.Suite
var globalFailer *failer.Failer
func init() { func init() {
config.Flags(flag.CommandLine, "ginkgo", true) config.Flags(flag.CommandLine, "ginkgo", true)
GinkgoWriter = writer.New(os.Stdout) GinkgoWriter = writer.New(os.Stdout)
globalFailer = failer.New()
globalSuite = suite.New(globalFailer)
} }
//GinkgoWriter implements an io.Writer //GinkgoWriter implements an io.Writer
@ -156,7 +149,7 @@ type GinkgoTestDescription struct {
//CurrentGinkgoTestDescripton returns information about the current running test. //CurrentGinkgoTestDescripton returns information about the current running test.
func CurrentGinkgoTestDescription() GinkgoTestDescription { func CurrentGinkgoTestDescription() GinkgoTestDescription {
summary, ok := globalSuite.CurrentRunningSpecSummary() summary, ok := global.Suite.CurrentRunningSpecSummary()
if !ok { if !ok {
return GinkgoTestDescription{} return GinkgoTestDescription{}
} }
@ -223,7 +216,7 @@ func RunSpecsWithCustomReporters(t GinkgoTestingT, description string, specRepor
for i, reporter := range specReporters { for i, reporter := range specReporters {
reporters[i] = reporter reporters[i] = reporter
} }
passed, hasFocusedTests := globalSuite.Run(t, description, reporters, writer, config.GinkgoConfig) passed, hasFocusedTests := global.Suite.Run(t, description, reporters, writer, config.GinkgoConfig)
if passed && hasFocusedTests && strings.TrimSpace(os.Getenv("GINKGO_EDITOR_INTEGRATION")) == "" { if passed && hasFocusedTests && strings.TrimSpace(os.Getenv("GINKGO_EDITOR_INTEGRATION")) == "" {
fmt.Println("PASS | FOCUSED") fmt.Println("PASS | FOCUSED")
os.Exit(types.GINKGO_FOCUS_EXIT_CODE) os.Exit(types.GINKGO_FOCUS_EXIT_CODE)
@ -252,7 +245,7 @@ func Skip(message string, callerSkip ...int) {
skip = callerSkip[0] skip = callerSkip[0]
} }
globalFailer.Skip(message, codelocation.New(skip+1)) global.Failer.Skip(message, codelocation.New(skip+1))
panic(GINKGO_PANIC) panic(GINKGO_PANIC)
} }
@ -263,7 +256,7 @@ func Fail(message string, callerSkip ...int) {
skip = callerSkip[0] skip = callerSkip[0]
} }
globalFailer.Fail(message, codelocation.New(skip+1)) global.Failer.Fail(message, codelocation.New(skip+1))
panic(GINKGO_PANIC) panic(GINKGO_PANIC)
} }
@ -280,7 +273,7 @@ func Fail(message string, callerSkip ...int) {
func GinkgoRecover() { func GinkgoRecover() {
e := recover() e := recover()
if e != nil { if e != nil {
globalFailer.Panic(codelocation.New(1), e) global.Failer.Panic(codelocation.New(1), e)
} }
} }
@ -291,25 +284,25 @@ func GinkgoRecover() {
//equivalent. The difference is purely semantic -- you typically Describe the behavior of an object //equivalent. The difference is purely semantic -- you typically Describe the behavior of an object
//or method and, within that Describe, outline a number of Contexts and Whens. //or method and, within that Describe, outline a number of Contexts and Whens.
func Describe(text string, body func()) bool { func Describe(text string, body func()) bool {
globalSuite.PushContainerNode(text, body, types.FlagTypeNone, codelocation.New(1)) global.Suite.PushContainerNode(text, body, types.FlagTypeNone, codelocation.New(1))
return true return true
} }
//You can focus the tests within a describe block using FDescribe //You can focus the tests within a describe block using FDescribe
func FDescribe(text string, body func()) bool { func FDescribe(text string, body func()) bool {
globalSuite.PushContainerNode(text, body, types.FlagTypeFocused, codelocation.New(1)) global.Suite.PushContainerNode(text, body, types.FlagTypeFocused, codelocation.New(1))
return true return true
} }
//You can mark the tests within a describe block as pending using PDescribe //You can mark the tests within a describe block as pending using PDescribe
func PDescribe(text string, body func()) bool { func PDescribe(text string, body func()) bool {
globalSuite.PushContainerNode(text, body, types.FlagTypePending, codelocation.New(1)) global.Suite.PushContainerNode(text, body, types.FlagTypePending, codelocation.New(1))
return true return true
} }
//You can mark the tests within a describe block as pending using XDescribe //You can mark the tests within a describe block as pending using XDescribe
func XDescribe(text string, body func()) bool { func XDescribe(text string, body func()) bool {
globalSuite.PushContainerNode(text, body, types.FlagTypePending, codelocation.New(1)) global.Suite.PushContainerNode(text, body, types.FlagTypePending, codelocation.New(1))
return true return true
} }
@ -320,25 +313,25 @@ func XDescribe(text string, body func()) bool {
//equivalent. The difference is purely semantic -- you typical Describe the behavior of an object //equivalent. The difference is purely semantic -- you typical Describe the behavior of an object
//or method and, within that Describe, outline a number of Contexts and Whens. //or method and, within that Describe, outline a number of Contexts and Whens.
func Context(text string, body func()) bool { func Context(text string, body func()) bool {
globalSuite.PushContainerNode(text, body, types.FlagTypeNone, codelocation.New(1)) global.Suite.PushContainerNode(text, body, types.FlagTypeNone, codelocation.New(1))
return true return true
} }
//You can focus the tests within a describe block using FContext //You can focus the tests within a describe block using FContext
func FContext(text string, body func()) bool { func FContext(text string, body func()) bool {
globalSuite.PushContainerNode(text, body, types.FlagTypeFocused, codelocation.New(1)) global.Suite.PushContainerNode(text, body, types.FlagTypeFocused, codelocation.New(1))
return true return true
} }
//You can mark the tests within a describe block as pending using PContext //You can mark the tests within a describe block as pending using PContext
func PContext(text string, body func()) bool { func PContext(text string, body func()) bool {
globalSuite.PushContainerNode(text, body, types.FlagTypePending, codelocation.New(1)) global.Suite.PushContainerNode(text, body, types.FlagTypePending, codelocation.New(1))
return true return true
} }
//You can mark the tests within a describe block as pending using XContext //You can mark the tests within a describe block as pending using XContext
func XContext(text string, body func()) bool { func XContext(text string, body func()) bool {
globalSuite.PushContainerNode(text, body, types.FlagTypePending, codelocation.New(1)) global.Suite.PushContainerNode(text, body, types.FlagTypePending, codelocation.New(1))
return true return true
} }
@ -349,25 +342,25 @@ func XContext(text string, body func()) bool {
//equivalent. The difference is purely semantic -- you typical Describe the behavior of an object //equivalent. The difference is purely semantic -- you typical Describe the behavior of an object
//or method and, within that Describe, outline a number of Contexts and Whens. //or method and, within that Describe, outline a number of Contexts and Whens.
func When(text string, body func()) bool { func When(text string, body func()) bool {
globalSuite.PushContainerNode("when "+text, body, types.FlagTypeNone, codelocation.New(1)) global.Suite.PushContainerNode("when "+text, body, types.FlagTypeNone, codelocation.New(1))
return true return true
} }
//You can focus the tests within a describe block using FWhen //You can focus the tests within a describe block using FWhen
func FWhen(text string, body func()) bool { func FWhen(text string, body func()) bool {
globalSuite.PushContainerNode("when "+text, body, types.FlagTypeFocused, codelocation.New(1)) global.Suite.PushContainerNode("when "+text, body, types.FlagTypeFocused, codelocation.New(1))
return true return true
} }
//You can mark the tests within a describe block as pending using PWhen //You can mark the tests within a describe block as pending using PWhen
func PWhen(text string, body func()) bool { func PWhen(text string, body func()) bool {
globalSuite.PushContainerNode("when "+text, body, types.FlagTypePending, codelocation.New(1)) global.Suite.PushContainerNode("when "+text, body, types.FlagTypePending, codelocation.New(1))
return true return true
} }
//You can mark the tests within a describe block as pending using XWhen //You can mark the tests within a describe block as pending using XWhen
func XWhen(text string, body func()) bool { func XWhen(text string, body func()) bool {
globalSuite.PushContainerNode("when "+text, body, types.FlagTypePending, codelocation.New(1)) global.Suite.PushContainerNode("when "+text, body, types.FlagTypePending, codelocation.New(1))
return true return true
} }
@ -377,25 +370,25 @@ func XWhen(text string, body func()) bool {
//Ginkgo will normally run It blocks synchronously. To perform asynchronous tests, pass a //Ginkgo will normally run It blocks synchronously. To perform asynchronous tests, pass a
//function that accepts a Done channel. When you do this, you can also provide an optional timeout. //function that accepts a Done channel. When you do this, you can also provide an optional timeout.
func It(text string, body interface{}, timeout ...float64) bool { func It(text string, body interface{}, timeout ...float64) bool {
globalSuite.PushItNode(text, body, types.FlagTypeNone, codelocation.New(1), parseTimeout(timeout...)) global.Suite.PushItNode(text, body, types.FlagTypeNone, codelocation.New(1), parseTimeout(timeout...))
return true return true
} }
//You can focus individual Its using FIt //You can focus individual Its using FIt
func FIt(text string, body interface{}, timeout ...float64) bool { func FIt(text string, body interface{}, timeout ...float64) bool {
globalSuite.PushItNode(text, body, types.FlagTypeFocused, codelocation.New(1), parseTimeout(timeout...)) global.Suite.PushItNode(text, body, types.FlagTypeFocused, codelocation.New(1), parseTimeout(timeout...))
return true return true
} }
//You can mark Its as pending using PIt //You can mark Its as pending using PIt
func PIt(text string, _ ...interface{}) bool { func PIt(text string, _ ...interface{}) bool {
globalSuite.PushItNode(text, func() {}, types.FlagTypePending, codelocation.New(1), 0) global.Suite.PushItNode(text, func() {}, types.FlagTypePending, codelocation.New(1), 0)
return true return true
} }
//You can mark Its as pending using XIt //You can mark Its as pending using XIt
func XIt(text string, _ ...interface{}) bool { func XIt(text string, _ ...interface{}) bool {
globalSuite.PushItNode(text, func() {}, types.FlagTypePending, codelocation.New(1), 0) global.Suite.PushItNode(text, func() {}, types.FlagTypePending, codelocation.New(1), 0)
return true return true
} }
@ -403,25 +396,25 @@ func XIt(text string, _ ...interface{}) bool {
//which "It" does not fit into a natural sentence flow. All the same protocols apply for Specify blocks //which "It" does not fit into a natural sentence flow. All the same protocols apply for Specify blocks
//which apply to It blocks. //which apply to It blocks.
func Specify(text string, body interface{}, timeout ...float64) bool { func Specify(text string, body interface{}, timeout ...float64) bool {
globalSuite.PushItNode(text, body, types.FlagTypeNone, codelocation.New(1), parseTimeout(timeout...)) global.Suite.PushItNode(text, body, types.FlagTypeNone, codelocation.New(1), parseTimeout(timeout...))
return true return true
} }
//You can focus individual Specifys using FSpecify //You can focus individual Specifys using FSpecify
func FSpecify(text string, body interface{}, timeout ...float64) bool { func FSpecify(text string, body interface{}, timeout ...float64) bool {
globalSuite.PushItNode(text, body, types.FlagTypeFocused, codelocation.New(1), parseTimeout(timeout...)) global.Suite.PushItNode(text, body, types.FlagTypeFocused, codelocation.New(1), parseTimeout(timeout...))
return true return true
} }
//You can mark Specifys as pending using PSpecify //You can mark Specifys as pending using PSpecify
func PSpecify(text string, is ...interface{}) bool { func PSpecify(text string, is ...interface{}) bool {
globalSuite.PushItNode(text, func() {}, types.FlagTypePending, codelocation.New(1), 0) global.Suite.PushItNode(text, func() {}, types.FlagTypePending, codelocation.New(1), 0)
return true return true
} }
//You can mark Specifys as pending using XSpecify //You can mark Specifys as pending using XSpecify
func XSpecify(text string, is ...interface{}) bool { func XSpecify(text string, is ...interface{}) bool {
globalSuite.PushItNode(text, func() {}, types.FlagTypePending, codelocation.New(1), 0) global.Suite.PushItNode(text, func() {}, types.FlagTypePending, codelocation.New(1), 0)
return true return true
} }
@ -452,25 +445,25 @@ func By(text string, callbacks ...func()) {
//The body function must have the signature: //The body function must have the signature:
// func(b Benchmarker) // func(b Benchmarker)
func Measure(text string, body interface{}, samples int) bool { func Measure(text string, body interface{}, samples int) bool {
globalSuite.PushMeasureNode(text, body, types.FlagTypeNone, codelocation.New(1), samples) global.Suite.PushMeasureNode(text, body, types.FlagTypeNone, codelocation.New(1), samples)
return true return true
} }
//You can focus individual Measures using FMeasure //You can focus individual Measures using FMeasure
func FMeasure(text string, body interface{}, samples int) bool { func FMeasure(text string, body interface{}, samples int) bool {
globalSuite.PushMeasureNode(text, body, types.FlagTypeFocused, codelocation.New(1), samples) global.Suite.PushMeasureNode(text, body, types.FlagTypeFocused, codelocation.New(1), samples)
return true return true
} }
//You can mark Measurements as pending using PMeasure //You can mark Measurements as pending using PMeasure
func PMeasure(text string, _ ...interface{}) bool { func PMeasure(text string, _ ...interface{}) bool {
globalSuite.PushMeasureNode(text, func(b Benchmarker) {}, types.FlagTypePending, codelocation.New(1), 0) global.Suite.PushMeasureNode(text, func(b Benchmarker) {}, types.FlagTypePending, codelocation.New(1), 0)
return true return true
} }
//You can mark Measurements as pending using XMeasure //You can mark Measurements as pending using XMeasure
func XMeasure(text string, _ ...interface{}) bool { func XMeasure(text string, _ ...interface{}) bool {
globalSuite.PushMeasureNode(text, func(b Benchmarker) {}, types.FlagTypePending, codelocation.New(1), 0) global.Suite.PushMeasureNode(text, func(b Benchmarker) {}, types.FlagTypePending, codelocation.New(1), 0)
return true return true
} }
@ -481,7 +474,7 @@ func XMeasure(text string, _ ...interface{}) bool {
// //
//You may only register *one* BeforeSuite handler per test suite. You typically do so in your bootstrap file at the top level. //You may only register *one* BeforeSuite handler per test suite. You typically do so in your bootstrap file at the top level.
func BeforeSuite(body interface{}, timeout ...float64) bool { func BeforeSuite(body interface{}, timeout ...float64) bool {
globalSuite.SetBeforeSuiteNode(body, codelocation.New(1), parseTimeout(timeout...)) global.Suite.SetBeforeSuiteNode(body, codelocation.New(1), parseTimeout(timeout...))
return true return true
} }
@ -494,7 +487,7 @@ func BeforeSuite(body interface{}, timeout ...float64) bool {
// //
//You may only register *one* AfterSuite handler per test suite. You typically do so in your bootstrap file at the top level. //You may only register *one* AfterSuite handler per test suite. You typically do so in your bootstrap file at the top level.
func AfterSuite(body interface{}, timeout ...float64) bool { func AfterSuite(body interface{}, timeout ...float64) bool {
globalSuite.SetAfterSuiteNode(body, codelocation.New(1), parseTimeout(timeout...)) global.Suite.SetAfterSuiteNode(body, codelocation.New(1), parseTimeout(timeout...))
return true return true
} }
@ -539,7 +532,7 @@ func AfterSuite(body interface{}, timeout ...float64) bool {
// Ω(err).ShouldNot(HaveOccurred()) // Ω(err).ShouldNot(HaveOccurred())
// }) // })
func SynchronizedBeforeSuite(node1Body interface{}, allNodesBody interface{}, timeout ...float64) bool { func SynchronizedBeforeSuite(node1Body interface{}, allNodesBody interface{}, timeout ...float64) bool {
globalSuite.SetSynchronizedBeforeSuiteNode( global.Suite.SetSynchronizedBeforeSuiteNode(
node1Body, node1Body,
allNodesBody, allNodesBody,
codelocation.New(1), codelocation.New(1),
@ -566,7 +559,7 @@ func SynchronizedBeforeSuite(node1Body interface{}, allNodesBody interface{}, ti
// dbRunner.Stop() // dbRunner.Stop()
// }) // })
func SynchronizedAfterSuite(allNodesBody interface{}, node1Body interface{}, timeout ...float64) bool { func SynchronizedAfterSuite(allNodesBody interface{}, node1Body interface{}, timeout ...float64) bool {
globalSuite.SetSynchronizedAfterSuiteNode( global.Suite.SetSynchronizedAfterSuiteNode(
allNodesBody, allNodesBody,
node1Body, node1Body,
codelocation.New(1), codelocation.New(1),
@ -581,7 +574,7 @@ func SynchronizedAfterSuite(allNodesBody interface{}, node1Body interface{}, tim
//Like It blocks, BeforeEach blocks can be made asynchronous by providing a body function that accepts //Like It blocks, BeforeEach blocks can be made asynchronous by providing a body function that accepts
//a Done channel //a Done channel
func BeforeEach(body interface{}, timeout ...float64) bool { func BeforeEach(body interface{}, timeout ...float64) bool {
globalSuite.PushBeforeEachNode(body, codelocation.New(1), parseTimeout(timeout...)) global.Suite.PushBeforeEachNode(body, codelocation.New(1), parseTimeout(timeout...))
return true return true
} }
@ -591,7 +584,7 @@ func BeforeEach(body interface{}, timeout ...float64) bool {
//Like It blocks, BeforeEach blocks can be made asynchronous by providing a body function that accepts //Like It blocks, BeforeEach blocks can be made asynchronous by providing a body function that accepts
//a Done channel //a Done channel
func JustBeforeEach(body interface{}, timeout ...float64) bool { func JustBeforeEach(body interface{}, timeout ...float64) bool {
globalSuite.PushJustBeforeEachNode(body, codelocation.New(1), parseTimeout(timeout...)) global.Suite.PushJustBeforeEachNode(body, codelocation.New(1), parseTimeout(timeout...))
return true return true
} }
@ -601,7 +594,7 @@ func JustBeforeEach(body interface{}, timeout ...float64) bool {
//Like It blocks, JustAfterEach blocks can be made asynchronous by providing a body function that accepts //Like It blocks, JustAfterEach blocks can be made asynchronous by providing a body function that accepts
//a Done channel //a Done channel
func JustAfterEach(body interface{}, timeout ...float64) bool { func JustAfterEach(body interface{}, timeout ...float64) bool {
globalSuite.PushJustAfterEachNode(body, codelocation.New(1), parseTimeout(timeout...)) global.Suite.PushJustAfterEachNode(body, codelocation.New(1), parseTimeout(timeout...))
return true return true
} }
@ -611,13 +604,13 @@ func JustAfterEach(body interface{}, timeout ...float64) bool {
//Like It blocks, AfterEach blocks can be made asynchronous by providing a body function that accepts //Like It blocks, AfterEach blocks can be made asynchronous by providing a body function that accepts
//a Done channel //a Done channel
func AfterEach(body interface{}, timeout ...float64) bool { func AfterEach(body interface{}, timeout ...float64) bool {
globalSuite.PushAfterEachNode(body, codelocation.New(1), parseTimeout(timeout...)) global.Suite.PushAfterEachNode(body, codelocation.New(1), parseTimeout(timeout...))
return true return true
} }
func parseTimeout(timeout ...float64) time.Duration { func parseTimeout(timeout ...float64) time.Duration {
if len(timeout) == 0 { if len(timeout) == 0 {
return time.Duration(defaultTimeout * int64(time.Second)) return global.DefaultTimeout
} else { } else {
return time.Duration(timeout[0] * float64(time.Second)) return time.Duration(timeout[0] * float64(time.Second))
} }

18
vendor/github.com/onsi/ginkgo/internal/global/init.go generated vendored Normal file
View File

@ -0,0 +1,18 @@
package global
import (
"time"
"github.com/onsi/ginkgo/internal/failer"
"github.com/onsi/ginkgo/internal/suite"
)
const DefaultTimeout = time.Duration(1 * time.Second)
var Suite *suite.Suite
var Failer *failer.Failer
func init() {
Failer = failer.New()
Suite = suite.New(Failer)
}

3
vendor/modules.txt vendored
View File

@ -361,7 +361,7 @@ github.com/nxadm/tail/ratelimiter
github.com/nxadm/tail/util github.com/nxadm/tail/util
github.com/nxadm/tail/watch github.com/nxadm/tail/watch
github.com/nxadm/tail/winfile github.com/nxadm/tail/winfile
# github.com/onsi/ginkgo v1.12.2 # github.com/onsi/ginkgo v1.12.3
github.com/onsi/ginkgo github.com/onsi/ginkgo
github.com/onsi/ginkgo/config github.com/onsi/ginkgo/config
github.com/onsi/ginkgo/extensions/table github.com/onsi/ginkgo/extensions/table
@ -375,6 +375,7 @@ github.com/onsi/ginkgo/ginkgo/watch
github.com/onsi/ginkgo/internal/codelocation github.com/onsi/ginkgo/internal/codelocation
github.com/onsi/ginkgo/internal/containernode github.com/onsi/ginkgo/internal/containernode
github.com/onsi/ginkgo/internal/failer github.com/onsi/ginkgo/internal/failer
github.com/onsi/ginkgo/internal/global
github.com/onsi/ginkgo/internal/leafnodes github.com/onsi/ginkgo/internal/leafnodes
github.com/onsi/ginkgo/internal/remote github.com/onsi/ginkgo/internal/remote
github.com/onsi/ginkgo/internal/spec github.com/onsi/ginkgo/internal/spec